summaryrefslogtreecommitdiff
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
parent733c5c9913e0550d6c009eea639e4a7b77b88c1b (diff)
Ensure normal weight math font face is consistent (#1774)
-rw-r--r--crates/typst-library/src/math/ctx.rs4
-rw-r--r--crates/typst/src/font/mod.rs2
-rw-r--r--tests/ref/math/accent.pngbin8045 -> 8066 bytes
-rw-r--r--tests/ref/math/attach-p3.pngbin15600 -> 15493 bytes
-rw-r--r--tests/ref/math/cases.pngbin2979 -> 3007 bytes
-rw-r--r--tests/ref/math/content.pngbin10381 -> 10362 bytes
-rw-r--r--tests/ref/math/frac.pngbin28849 -> 28884 bytes
-rw-r--r--tests/ref/math/matrix-alignment.pngbin14032 -> 14136 bytes
-rw-r--r--tests/ref/math/multiline.pngbin13444 -> 13453 bytes
-rw-r--r--tests/ref/math/spacing.pngbin18058 -> 17941 bytes
-rw-r--r--tests/ref/math/style.pngbin23857 -> 23896 bytes
-rw-r--r--tests/ref/math/syntax.pngbin4882 -> 4905 bytes
-rw-r--r--tests/ref/math/underover.pngbin4731 -> 4885 bytes
13 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)
}
}
diff --git a/tests/ref/math/accent.png b/tests/ref/math/accent.png
index 78d5f498..e3ad7f4d 100644
--- a/tests/ref/math/accent.png
+++ b/tests/ref/math/accent.png
Binary files differ
diff --git a/tests/ref/math/attach-p3.png b/tests/ref/math/attach-p3.png
index 104534b7..03c5da09 100644
--- a/tests/ref/math/attach-p3.png
+++ b/tests/ref/math/attach-p3.png
Binary files differ
diff --git a/tests/ref/math/cases.png b/tests/ref/math/cases.png
index b9e54e75..d54246cd 100644
--- a/tests/ref/math/cases.png
+++ b/tests/ref/math/cases.png
Binary files differ
diff --git a/tests/ref/math/content.png b/tests/ref/math/content.png
index 4fbd4670..e7ec48fe 100644
--- a/tests/ref/math/content.png
+++ b/tests/ref/math/content.png
Binary files differ
diff --git a/tests/ref/math/frac.png b/tests/ref/math/frac.png
index 0b81e37b..59357cff 100644
--- a/tests/ref/math/frac.png
+++ b/tests/ref/math/frac.png
Binary files differ
diff --git a/tests/ref/math/matrix-alignment.png b/tests/ref/math/matrix-alignment.png
index c3059cfd..546f8757 100644
--- a/tests/ref/math/matrix-alignment.png
+++ b/tests/ref/math/matrix-alignment.png
Binary files differ
diff --git a/tests/ref/math/multiline.png b/tests/ref/math/multiline.png
index bfa85b7b..e0b13f15 100644
--- a/tests/ref/math/multiline.png
+++ b/tests/ref/math/multiline.png
Binary files differ
diff --git a/tests/ref/math/spacing.png b/tests/ref/math/spacing.png
index 10adc724..31768239 100644
--- a/tests/ref/math/spacing.png
+++ b/tests/ref/math/spacing.png
Binary files differ
diff --git a/tests/ref/math/style.png b/tests/ref/math/style.png
index 27f0a27d..d2e6776a 100644
--- a/tests/ref/math/style.png
+++ b/tests/ref/math/style.png
Binary files differ
diff --git a/tests/ref/math/syntax.png b/tests/ref/math/syntax.png
index d828a478..c156353c 100644
--- a/tests/ref/math/syntax.png
+++ b/tests/ref/math/syntax.png
Binary files differ
diff --git a/tests/ref/math/underover.png b/tests/ref/math/underover.png
index 62dcfefc..c3bb47f9 100644
--- a/tests/ref/math/underover.png
+++ b/tests/ref/math/underover.png
Binary files differ