summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authordamaxwell <damaxwell@alaska.edu>2023-08-02 14:34:54 -0800
committerGitHub <noreply@github.com>2023-08-03 00:34:54 +0200
commit20eb284318dda2a854c0f818ff05930ad47d5cec (patch)
treee799e41efaec15a7bd45df734e8a3830107ffc53 /crates
parent733c5c9913e0550d6c009eea639e4a7b77b88c1b (diff)
Ensure normal weight math font face is consistent (#1774)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-library/src/math/ctx.rs4
-rw-r--r--crates/typst/src/font/mod.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/crates/typst-library/src/math/ctx.rs b/crates/typst-library/src/math/ctx.rs
index acd60e48..2ebd55b9 100644
--- a/crates/typst-library/src/math/ctx.rs
+++ b/crates/typst-library/src/math/ctx.rs
@@ -258,7 +258,9 @@ impl<'a, 'b, 'v> MathContext<'a, 'b, 'v> {
self.local.set(TextElem::set_weight(if style.bold {
FontWeight::BOLD
} else {
- FontWeight::REGULAR
+ // The normal weight is what we started with.
+ // It's 400 for CM Regular, 450 for CM Book.
+ self.font.info().variant.weight
}));
self.style = style;
}
diff --git a/crates/typst/src/font/mod.rs b/crates/typst/src/font/mod.rs
index 2353e51c..888960f1 100644
--- a/crates/typst/src/font/mod.rs
+++ b/crates/typst/src/font/mod.rs
@@ -134,7 +134,7 @@ impl Hash for Font {
impl Debug for Font {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- write!(f, "Font({})", self.info().family)
+ write!(f, "Font({},{:?})", self.info().family, self.info().variant)
}
}