typst/tests/typ/text/bidi.typ
Laurenz 8d1ce390e2 Rework strong and emph
- Star and underscore not parsed as strong/emph inside of words
- Stars/underscores must be balanced and they cannot go over paragraph break
- New `strong` and `emph` classes
2022-01-30 22:46:59 +01:00

57 lines
1.4 KiB
Typst
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Test bidirectional text and language configuration.
---
// Test reordering with different top-level paragraph directions.
#let content = [Text טֶקסט]
#set text(serif, "Noto Serif Hebrew")
#par(lang: "he", content)
#par(lang: "de", content)
---
// Test that consecutive, embedded LTR runs stay LTR.
// Here, we have two runs: "A" and italic "B".
#let content = [أنت A#emph[B]مطرC]
#set text(serif, "Noto Sans Arabic")
#par(lang: "ar", content)
#par(lang: "de", content)
---
// Test that consecutive, embedded RTL runs stay RTL.
// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
#let content = [Aגֶ#strong[שֶׁ]םB]
#set text(serif, "Noto Serif Hebrew")
#par(lang: "he", content)
#par(lang: "de", content)
---
// Test embedding up to level 4 with isolates.
#set text(serif, "Noto Serif Hebrew", "Twitter Color Emoji")
#set par(dir: rtl)
א\u{2066}A\u{2067}Bב\u{2069}?
---
// Test hard line break (leads to two paragraphs in unicode-bidi).
#set text("Noto Sans Arabic", serif)
#set par(lang: "ar")
Life المطر هو الحياة \
الحياة تمطر is rain.
---
// Test spacing.
#set text(serif, "Noto Serif Hebrew")
L #h(1cm) ריווחR \
יווח #h(1cm) R
---
// Test inline object.
#set text("Noto Serif Hebrew", serif)
#set par(lang: "he")
קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים
---
// Test setting a vertical direction.
// Ref: false
// Error: 15-18 must be horizontal
#set par(dir: ttb)