BiDi tests

This commit is contained in:
Laurenz 2021-03-30 14:30:44 +02:00
parent 79948c0c5e
commit 12a604fec8
6 changed files with 51 additions and 2 deletions

Binary file not shown.

Binary file not shown.

BIN
tests/ref/text/bidi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

49
tests/typ/text/bidi.typ Normal file
View File

@ -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 \
יווח #h(1cm) R
---
// Test inline object.
#font("Noto Serif Hebrew", "EB Garamond")
#lang("he")
קרנפיםRh#image("res/rhino.png", height: 11pt)inoחיים

View File

@ -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.
ب🐈😀سم