diff options
| author | Laurenz Mädje <laurmaedje@gmail.com> | 2019-06-02 19:51:37 +0200 |
|---|---|---|
| committer | Laurenz Mädje <laurmaedje@gmail.com> | 2019-06-02 19:51:37 +0200 |
| commit | 236ebab23a106ca817de527ce6b6440d3b66c150 (patch) | |
| tree | c2fd931722f8215ebc87ab0404283c846df00fb6 /src/layout | |
| parent | 3e9f42661ed19464f1a33c279b315dae8d1e6e83 (diff) | |
Add more fonts 📜
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/mod.rs | 6 | ||||
| -rw-r--r-- | src/layout/text.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index ab27314d..1c1f743e 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -144,8 +144,8 @@ impl Default for PageStyle { /// The error type for layouting. pub enum LayoutError { - /// There was no suitable font. - NoSuitableFont, + /// There was no suitable font for the given character. + NoSuitableFont(char), /// An error occured while gathering font data. Font(FontError), } @@ -156,7 +156,7 @@ pub type LayoutResult<T> = Result<T, LayoutError>; error_type! { err: LayoutError, show: f => match err { - LayoutError::NoSuitableFont => write!(f, "no suitable font"), + LayoutError::NoSuitableFont(c) => write!(f, "no suitable font for '{}'", c), LayoutError::Font(err) => write!(f, "font error: {}", err), }, source: match err { diff --git a/src/layout/text.rs b/src/layout/text.rs index 11a1e38c..d1e2afd7 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -104,7 +104,7 @@ impl<'a, 'p> TextLayouter<'a, 'p> { italic: self.italic, bold: self.bold, character, - }).ok_or_else(|| LayoutError::NoSuitableFont) + }).ok_or_else(|| LayoutError::NoSuitableFont(character)) } /// The width of a char in a specific font. |
