summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenzhuo Liu <mgt@oi-wiki.org>2024-01-06 03:30:45 +0800
committerGitHub <noreply@github.com>2024-01-05 19:30:45 +0000
commit46053b62e5d87118f33476d3c7f6ddf794fbafeb (patch)
treebd709170f9280d3a73ff2a81f9312701f2e3bebf
parent8fa573a9a203084ede03cb2f22a54a4b5973bb88 (diff)
Fix large operators in cambria math (#3115)
-rw-r--r--crates/typst/src/math/ctx.rs5
-rw-r--r--tests/ref/math/class.pngbin6454 -> 6460 bytes
2 files changed, 4 insertions, 1 deletions
diff --git a/crates/typst/src/math/ctx.rs b/crates/typst/src/math/ctx.rs
index b93d7cc2..2c88fe3c 100644
--- a/crates/typst/src/math/ctx.rs
+++ b/crates/typst/src/math/ctx.rs
@@ -1,3 +1,5 @@
+use std::f64::consts::SQRT_2;
+
use comemo::Prehashed;
use ecow::EcoString;
use rustybuzz::Feature;
@@ -207,7 +209,8 @@ impl<'a, 'b, 'v> MathContext<'a, 'b, 'v> {
let class = self.style.class.as_custom().or(glyph.class);
if class == Some(MathClass::Large) {
let mut variant = if self.style.size == MathSize::Display {
- let height = scaled!(self, display_operator_min_height);
+ let height = scaled!(self, display_operator_min_height)
+ .max(SQRT_2 * glyph.height());
glyph.stretch_vertical(self, height, Abs::zero())
} else {
glyph.into_variant()
diff --git a/tests/ref/math/class.png b/tests/ref/math/class.png
index c4a4cecc..27844ebe 100644
--- a/tests/ref/math/class.png
+++ b/tests/ref/math/class.png
Binary files differ