mirror of
https://github.com/typst/typst
synced 2025-05-20 12:05:27 +08:00
57 lines
1.5 KiB
Typst
57 lines
1.5 KiB
Typst
// Test bidirectional text and language configuration.
|
||
|
||
---
|
||
// Test reordering with different top-level paragraph directions.
|
||
#let text = [Text טֶקסט]
|
||
#font!(family: ("EB Garamond", "Noto Serif Hebrew"))
|
||
#lang!("he") {text}
|
||
#lang!("de") {text}
|
||
|
||
---
|
||
// Test that consecutive, embedded LTR runs stay LTR.
|
||
// Here, we have two runs: "A" and italic "B".
|
||
#let text = [أنت A_B_مطرC]
|
||
#font!(family: ("EB Garamond", "Noto Sans Arabic"))
|
||
#lang!("ar") {text}
|
||
#lang!("de") {text}
|
||
|
||
---
|
||
// Test that consecutive, embedded RTL runs stay RTL.
|
||
// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
|
||
#let text = [Aגֶ*שֶׁ*םB]
|
||
#font!(family: ("EB Garamond", "Noto Serif Hebrew"))
|
||
#lang!("he") {text}
|
||
#lang!("de") {text}
|
||
|
||
---
|
||
// Test embedding up to level 4 with isolates.
|
||
#font!(family: ("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!(family: ("Noto Sans Arabic", "EB Garamond"))
|
||
#lang!("ar")
|
||
Life المطر هو الحياة \
|
||
الحياة تمطر is rain.
|
||
|
||
---
|
||
// Test spacing.
|
||
#font!(family: ("EB Garamond", "Noto Serif Hebrew"))
|
||
L #h(1cm) ריווחR \
|
||
Lריווח #h(1cm) R
|
||
|
||
---
|
||
// Test inline object.
|
||
#font!(family: ("Noto Serif Hebrew", "EB Garamond"))
|
||
#lang!("he")
|
||
קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים
|
||
|
||
---
|
||
// Test the `lang` function.
|
||
// Ref: false
|
||
|
||
// Error: 13-16 must be horizontal
|
||
#lang!(dir: ttb)
|