diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-02-13 21:58:49 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-02-13 21:58:49 +0100 |
| commit | 1658b00282b631fb5218f477ea7f45f925644cea (patch) | |
| tree | 13a0f51f335e687c363a5afb9cc73993a69489cc /src/layout/text.rs | |
| parent | 60099aed50b89daef29543c4700470e566c48798 (diff) | |
New syntax features 👔
- Forced line breaks with backslash followed by whitespace
- (Multline) raw text in backticks
- Set font class fallbacks with [font.family] (e.g. [font.family: monospace=("CMU Typewriter Text")])
- More sophisticated procedure to find end of function, which accounts for comments, strings, raw text and nested functions (this is a mix of a feature and a bug fix)
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs index 614d59fd..286ccc68 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -118,23 +118,13 @@ impl<'a> TextLayouter<'a> { variant.weight.0 += 300; } - let queried = if self.ctx.style.monospace { - loader.get(FontQuery { - // FIXME: This is a hack. - fallback: std::iter::once("source code pro") - .chain(self.ctx.style.fallback.iter()), - variant, - c, - }).await - } else { - loader.get(FontQuery { - fallback: self.ctx.style.fallback.iter(), - variant, - c, - }).await + let query = FontQuery { + fallback: self.ctx.style.fallback.iter(), + variant, + c, }; - if let Some((font, index)) = queried { + if let Some((font, index)) = loader.get(query).await { // Determine the width of the char. let header = font.read_table::<Header>().ok()?; let font_unit_ratio = 1.0 / (header.units_per_em as f32); |
