diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-24 19:30:09 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-24 19:30:09 +0200 |
| commit | 018860da9c72df846d80051a1408b3e632fbaaf6 (patch) | |
| tree | f499a4908cd59b087b107015789a606b370fd1fd /src/library | |
| parent | acdde6d3266d4158241c2e62aa88a1185a3016fd (diff) | |
Parse math fonts only once
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/math/rex.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/library/math/rex.rs b/src/library/math/rex.rs index addf56b6..0268fb9c 100644 --- a/src/library/math/rex.rs +++ b/src/library/math/rex.rs @@ -35,13 +35,13 @@ impl Layout for RexNode { .at(span)?; // Prepare the font. - let data = ctx.fonts.get(face_id).buffer(); - let font = MathFont::parse(data) - .map_err(|_| "failed to parse math font") + let face = ctx.fonts.get(face_id); + let ctx = face + .math() + .and_then(FontContext::new) + .ok_or("font is not suitable for math") .at(span)?; - let ctx = FontContext::new(&font).ok_or("failed to parse math font").at(span)?; - // Layout the formula. let em = styles.get(TextNode::SIZE); let style = if self.display { Style::Display } else { Style::Text }; |
