summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-30 14:30:44 +0200
committerLaurenz <laurmaedje@gmail.com>2021-03-30 14:31:50 +0200
commit12a604fec85c6feec7d4c7a6acde8b220c2c1d80 (patch)
tree02e21682a4b99e6ba9f3a379214e3eca11cba970
parent79948c0c5e7e8df49a0f2f47ca44c7b6643fbb63 (diff)
BiDi tests ✅
-rw-r--r--fonts/NotoSerifHebrew-Bold.ttfbin0 -> 21376 bytes
-rw-r--r--fonts/NotoSerifHebrew-Regular.ttfbin0 -> 21488 bytes
-rw-r--r--tests/ref/text/bidi.pngbin0 -> 14920 bytes
-rw-r--r--tests/ref/text/shaping.pngbin12247 -> 12536 bytes
-rw-r--r--tests/typ/text/bidi.typ49
-rw-r--r--tests/typ/text/shaping.typ4
6 files changed, 51 insertions, 2 deletions
diff --git a/fonts/NotoSerifHebrew-Bold.ttf b/fonts/NotoSerifHebrew-Bold.ttf
new file mode 100644
index 00000000..e7cbd93a
--- /dev/null
+++ b/fonts/NotoSerifHebrew-Bold.ttf
Binary files differ
diff --git a/fonts/NotoSerifHebrew-Regular.ttf b/fonts/NotoSerifHebrew-Regular.ttf
new file mode 100644
index 00000000..27893f10
--- /dev/null
+++ b/fonts/NotoSerifHebrew-Regular.ttf
Binary files differ
diff --git a/tests/ref/text/bidi.png b/tests/ref/text/bidi.png
new file mode 100644
index 00000000..c3ad156b
--- /dev/null
+++ b/tests/ref/text/bidi.png
Binary files differ
diff --git a/tests/ref/text/shaping.png b/tests/ref/text/shaping.png
index 88e7b0ad..e6da3e4d 100644
--- a/tests/ref/text/shaping.png
+++ b/tests/ref/text/shaping.png
Binary files differ
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ
new file mode 100644
index 00000000..44f0cc15
--- /dev/null
+++ b/tests/typ/text/bidi.typ
@@ -0,0 +1,49 @@
+// Test bidirectional text.
+
+---
+// Test reordering with different top-level paragraph directions.
+#let text = [Text טֶקסט]
+#font("EB Garamond", "Noto Serif Hebrew")
+#lang("de") {text}
+#lang("he") {text}
+
+---
+// Test that consecutiv, embedded LTR runs stay LTR.
+// Here, we have two runs: "A" and italic "B".
+#let text = [أنت A_B_مطرC]
+#font("EB Garamond", "Noto Sans Arabic")
+#lang("de") {text}
+#lang("ar") {text}
+
+---
+// Test that consecutive, embedded RTL runs stay RTL.
+// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
+#let text = [Aגֶ*שֶׁ*םB]
+#font("EB Garamond", "Noto Serif Hebrew")
+#lang("de") {text}
+#lang("he") {text}
+
+---
+// Test embedding up to level 4 with isolates.
+#font("EB Garamond", "Noto Serif Hebrew", "Twitter Color Emoji")
+#lang(dir: rtl)
+א\u{2066}A\u{2067}Bב\u{2069}?
+
+---
+// Test hard line break (leads to two paragraphs in unicode-bidi).
+#font("Noto Sans Arabic", "EB Garamond")
+#lang("ar")
+Life المطر هو الحياة \
+الحياة تمطر is rain.
+
+---
+// Test spacing.
+#font("EB Garamond", "Noto Serif Hebrew")
+L #h(1cm) ריווחR \
+Lריווח #h(1cm) R
+
+---
+// Test inline object.
+#font("Noto Serif Hebrew", "EB Garamond")
+#lang("he")
+קרנפיםRh#image("res/rhino.png", height: 11pt)inoחיים
diff --git a/tests/typ/text/shaping.typ b/tests/typ/text/shaping.typ
index 567a208d..5a469a45 100644
--- a/tests/typ/text/shaping.typ
+++ b/tests/typ/text/shaping.typ
@@ -8,7 +8,7 @@ Le fira
// This should just shape nicely.
#font("Noto Sans Arabic")
-منش إلا بسم الله
+دع النص يمطر عليك
// This should form a three-member family.
#font("Twitter Color Emoji")
@@ -26,7 +26,7 @@ Le fira
A😀B
// Font fallback for entire text.
-منش إلا بسم الله
+دع النص يمطر عليك
// Font fallback in right-to-left text.
ب🐈😀سم