summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Lopes <95137505+joserlopes@users.noreply.github.com>2024-04-08 09:46:31 +0100
committerGitHub <noreply@github.com>2024-04-08 08:46:31 +0000
commit351cf127f2849f5947e74449753ae790965df4b1 (patch)
tree0f61e16150cc177b012e728e41e5a247f180fbdd
parent5de36f7b97c237ad0fc4a0b4ccecd7adcb43181b (diff)
Fix missing blackboard bold letters (#3759)
-rw-r--r--crates/typst/src/math/style.rs32
-rw-r--r--tests/ref/math/style.pngbin25050 -> 29726 bytes
-rw-r--r--tests/typ/math/style.typ9
3 files changed, 30 insertions, 11 deletions
diff --git a/crates/typst/src/math/style.rs b/crates/typst/src/math/style.rs
index bd910a79..332ce586 100644
--- a/crates/typst/src/math/style.rs
+++ b/crates/typst/src/math/style.rs
@@ -300,7 +300,8 @@ pub fn styled_char(styles: StyleChain, c: char, auto_italic: bool) -> char {
c,
'a'..='z' | 'ı' | 'ȷ' | 'A'..='Z' | 'α'..='ω' |
'∂' | 'ϵ' | 'ϑ' | 'ϰ' | 'ϕ' | 'ϱ' | 'ϖ'
- ),
+ )
+ && matches!(variant, Sans | Serif),
);
if let Some(c) = basic_exception(c) {
@@ -444,6 +445,11 @@ fn latin_exception(
('Q', Bb, ..) => 'ℚ',
('R', Bb, ..) => 'ℝ',
('Z', Bb, ..) => 'ℤ',
+ ('D', Bb, _, true) => 'ⅅ',
+ ('d', Bb, _, true) => 'ⅆ',
+ ('e', Bb, _, true) => 'ⅇ',
+ ('i', Bb, _, true) => 'ⅈ',
+ ('j', Bb, _, true) => 'ⅉ',
('h', Serif, false, true) => 'ℎ',
('e', Cal, false, _) => 'ℯ',
('g', Cal, false, _) => 'ℊ',
@@ -462,15 +468,20 @@ fn greek_exception(
) -> Option<char> {
use MathVariant::*;
let list = match c {
- 'ϴ' => ['𝚹', '𝛳', '𝜭', '𝝧', '𝞡'],
- '∇' => ['𝛁', '𝛻', '𝜵', '𝝯', '𝞩'],
- '∂' => ['𝛛', '𝜕', '𝝏', '𝞉', '𝟃'],
- 'ϵ' => ['𝛜', '𝜖', '𝝐', '𝞊', '𝟄'],
- 'ϑ' => ['𝛝', '𝜗', '𝝑', '𝞋', '𝟅'],
- 'ϰ' => ['𝛞', '𝜘', '𝝒', '𝞌', '𝟆'],
- 'ϕ' => ['𝛟', '𝜙', '𝝓', '𝞍', '𝟇'],
- 'ϱ' => ['𝛠', '𝜚', '𝝔', '𝞎', '𝟈'],
- 'ϖ' => ['𝛡', '𝜛', '𝝕', '𝞏', '𝟉'],
+ 'ϴ' => ['𝚹', '𝛳', '𝜭', '𝝧', '𝞡', 'ϴ'],
+ '∇' => ['𝛁', '𝛻', '𝜵', '𝝯', '𝞩', '∇'],
+ '∂' => ['𝛛', '𝜕', '𝝏', '𝞉', '𝟃', '∂'],
+ 'ϵ' => ['𝛜', '𝜖', '𝝐', '𝞊', '𝟄', 'ϵ'],
+ 'ϑ' => ['𝛝', '𝜗', '𝝑', '𝞋', '𝟅', 'ϑ'],
+ 'ϰ' => ['𝛞', '𝜘', '𝝒', '𝞌', '𝟆', 'ϰ'],
+ 'ϕ' => ['𝛟', '𝜙', '𝝓', '𝞍', '𝟇', 'ϕ'],
+ 'ϱ' => ['𝛠', '𝜚', '𝝔', '𝞎', '𝟈', 'ϱ'],
+ 'ϖ' => ['𝛡', '𝜛', '𝝕', '𝞏', '𝟉', 'ϖ'],
+ 'Γ' => ['𝚪', '𝛤', '𝜞', '𝝘', '𝞒', 'ℾ'],
+ 'γ' => ['𝛄', '𝛾', '𝜸', '𝝲', '𝞬', 'ℽ'],
+ 'Π' => ['𝚷', '𝛱', '𝜫', '𝝥', '𝞟', 'ℿ'],
+ 'π' => ['𝛑', '𝜋', '𝝅', '𝝿', '𝞹', 'ℼ'],
+ '∑' => ['∑', '∑', '∑', '∑', '∑', '⅀'],
_ => return None,
};
@@ -480,6 +491,7 @@ fn greek_exception(
(Serif, true, true) => list[2],
(Sans, _, false) => list[3],
(Sans, _, true) => list[4],
+ (Bb, ..) => list[5],
_ => return None,
})
}
diff --git a/tests/ref/math/style.png b/tests/ref/math/style.png
index 5201181e..a52136dc 100644
--- a/tests/ref/math/style.png
+++ b/tests/ref/math/style.png
Binary files differ
diff --git a/tests/typ/math/style.typ b/tests/typ/math/style.typ
index 30cb4aa0..f1a38405 100644
--- a/tests/typ/math/style.typ
+++ b/tests/typ/math/style.typ
@@ -20,7 +20,14 @@ $a/b, display(a/b), display(a)/display(b), inline(a/b), script(a/b), sscript(a/b
---
// Test a few style exceptions.
-$h, bb(N), cal(R), Theta, italic(Theta), sans(Theta), sans(italic(Theta))$
+$h, bb(N), cal(R), Theta, italic(Theta), sans(Theta), sans(italic(Theta)) \
+ bb(d), bb(italic(d)), italic(bb(d)), bb(e), bb(italic(e)), italic(bb(e)) \
+ bb(i), bb(italic(i)), italic(bb(i)), bb(j), bb(italic(j)), italic(bb(j)) \
+ bb(D), bb(italic(D)), italic(bb(D))$
+
+---
+// Test a few greek exceptions.
+$bb(Gamma) , bb(gamma), bb(Pi), bb(pi), bb(sum)$
---
// Test hebrew exceptions.