diff options
Diffstat (limited to 'tests/suite/layout/inline')
| -rw-r--r-- | tests/suite/layout/inline/baseline.typ | 17 | ||||
| -rw-r--r-- | tests/suite/layout/inline/bidi.typ | 77 | ||||
| -rw-r--r-- | tests/suite/layout/inline/cjk.typ | 90 | ||||
| -rw-r--r-- | tests/suite/layout/inline/hyphenate.typ | 51 | ||||
| -rw-r--r-- | tests/suite/layout/inline/justify.typ | 170 | ||||
| -rw-r--r-- | tests/suite/layout/inline/linebreak.typ | 109 | ||||
| -rw-r--r-- | tests/suite/layout/inline/overhang.typ | 24 | ||||
| -rw-r--r-- | tests/suite/layout/inline/shaping.typ | 65 | ||||
| -rw-r--r-- | tests/suite/layout/inline/text.typ | 89 |
9 files changed, 692 insertions, 0 deletions
diff --git a/tests/suite/layout/inline/baseline.typ b/tests/suite/layout/inline/baseline.typ new file mode 100644 index 00000000..e9f9a645 --- /dev/null +++ b/tests/suite/layout/inline/baseline.typ @@ -0,0 +1,17 @@ +// Test baseline handling. + +--- baseline-text --- +Hi #text(1.5em)[You], #text(0.75em)[how are you?] + +Our cockatoo was one of the +#text(baseline: -0.2em)[#box(circle(radius: 2pt)) first] +#text(baseline: 0.2em)[birds #box(circle(radius: 2pt))] +that ever learned to mimic a human voice. + +--- baseline-box --- +Hey #box(baseline: 40%, image("/assets/images/tiger.jpg", width: 1.5cm)) there! + +--- issue-2214-baseline-math --- +// The math content should also be affected by the TextElem baseline. +hello #text(baseline: -5pt)[123 #sym.WW\orld]\ +hello #text(baseline: -5pt)[$123 WW#text[or]$ld]\ diff --git a/tests/suite/layout/inline/bidi.typ b/tests/suite/layout/inline/bidi.typ new file mode 100644 index 00000000..7da23b41 --- /dev/null +++ b/tests/suite/layout/inline/bidi.typ @@ -0,0 +1,77 @@ +// Test bidirectional text and language configuration. + +--- bidi-en-he-top-level --- +// Test reordering with different top-level paragraph directions. +#let content = par[Text טֶקסט] +#text(lang: "he", content) +#text(lang: "de", content) + +--- bidi-consecutive-embedded-ltr-runs --- +// Test that consecutive, embedded LTR runs stay LTR. +// Here, we have two runs: "A" and italic "B". +#let content = par[أنت A#emph[B]مطرC] +#set text(font: ("PT Sans", "Noto Sans Arabic")) +#text(lang: "ar", content) +#text(lang: "de", content) + +--- bidi-consecutive-embedded-rtl-runs --- +// Test that consecutive, embedded RTL runs stay RTL. +// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם". +#let content = par[Aגֶ#strong[שֶׁ]םB] +#set text(font: ("Linux Libertine", "Noto Serif Hebrew")) +#text(lang: "he", content) +#text(lang: "de", content) + +--- bidi-nesting --- +// Test embedding up to level 4 with isolates. +#set text(dir: rtl) +א\u{2066}A\u{2067}Bב\u{2069}? + +--- bidi-manual-linebreak --- +// Test hard line break (leads to two paragraphs in unicode-bidi). +#set text(lang: "ar", font: ("Noto Sans Arabic", "PT Sans")) +Life المطر هو الحياة \ +الحياة تمطر is rain. + +--- bidi-spacing --- +// Test spacing. +L #h(1cm) ריווחR \ +Lריווח #h(1cm) R + +--- bidi-obj --- +// Test inline object. +#set text(lang: "he") +קרנפיםRh#box(image("/assets/images/rhino.png", height: 11pt))inoחיים + +--- bidi-whitespace-reset --- +// Test whether L1 whitespace resetting destroys stuff. +الغالب #h(70pt) ن#" "ة + +--- bidi-explicit-dir --- +// Test explicit dir +#set text(dir: rtl) +#text("8:00 - 9:00", dir: ltr) בבוקר +#linebreak() +ב #text("12:00 - 13:00", dir: ltr) בצהריים + +--- bidi-raw --- +// Mixing raw +#set text(lang: "he") +לדוג. `if a == b:` זה תנאי +#set raw(lang: "python") +לדוג. `if a == b:` זה תנאי + +#show raw: set text(dir:rtl) +לתכנת בעברית `אם א == ב:` + +--- bidi-vertical --- +// Test setting a vertical direction. +// Error: 16-19 text direction must be horizontal +#set text(dir: ttb) + +--- issue-1373-bidi-tofus --- +// Test that shaping missing characters in both left-to-right and +// right-to-left directions does not cause a crash. +#"\u{590}\u{591}\u{592}\u{593}" + +#"\u{30000}\u{30001}\u{30002}\u{30003}" diff --git a/tests/suite/layout/inline/cjk.typ b/tests/suite/layout/inline/cjk.typ new file mode 100644 index 00000000..0540cd19 --- /dev/null +++ b/tests/suite/layout/inline/cjk.typ @@ -0,0 +1,90 @@ +// Test CJK-specific features. + +--- text-chinese-basic --- +// Test basic Chinese text from Wikipedia. +#set text(font: "Noto Serif CJK SC") + +是美国广播公司电视剧《迷失》第3季的第22和23集,也是全剧的第71集和72集 +由执行制作人戴蒙·林道夫和卡尔顿·库斯编剧,导演则是另一名执行制作人杰克·本德 +节目于2007年5月23日在美国和加拿大首播,共计吸引了1400万美国观众收看 +本集加上插播广告一共也持续有两个小时 + +--- text-cjk-latin-spacing --- +#set page(width: 50pt + 10pt, margin: (x: 5pt)) +#set text(lang: "zh", font: "Noto Serif CJK SC", cjk-latin-spacing: auto) +#set par(justify: true) + +中文,中12文1中,文12中文 + +中文,中ab文a中,文ab中文 + +#set text(cjk-latin-spacing: none) + +中文,中12文1中,文12中文 + +中文,中ab文a中,文ab中文 + +--- cjk-punctuation-adjustment-1 --- +#set page(width: 15em) + +// In the following example, the space between 》! and ? should be squeezed. +// because zh-CN follows GB style +#set text(lang: "zh", region: "CN", font: "Noto Serif CJK SC") +原来,你也玩《原神》!? + +// However, in the following example, the space between 》! and ? should not be squeezed. +// because zh-TW does not follow GB style +#set text(lang: "zh", region: "TW", font: "Noto Serif CJK TC") +原來,你也玩《原神》! ? + +#set text(lang: "zh", region: "CN", font: "Noto Serif CJK SC") +「真的吗?」 + +#set text(lang: "ja", font: "Noto Serif CJK JP") +「本当に?」 + +--- cjk-punctuation-adjustment-2 --- +#set text(lang: "zh", region: "CN", font: "Noto Serif CJK SC") +《书名〈章节〉》 // the space between 〉 and 》 should be squeezed + +〔茸毛〕:很细的毛 // the space between 〕 and : should be squeezed + +--- cjk-punctuation-adjustment-3 --- +#set page(width: 21em) +#set text(lang: "zh", region: "CN", font: "Noto Serif CJK SC") + +// These examples contain extensive use of Chinese punctuation marks, +// from 《Which parentheses should be used when applying parentheses?》. +// link: https://archive.md/2bb1N + + +(〔中〕医、〔中〕药、技)系列评审 + +(长三角[长江三角洲])(GB/T 16159—2012《汉语拼音正词法基本规则》) + +【爱因斯坦(Albert Einstein)】物理学家 + +〔(2009)民申字第1622号〕 + +“江南海北长相忆,浅水深山独掩扉。”([唐]刘长卿《会赦后酬主簿所问》) + +参看1378页〖象形文字〗。(《现代汉语词典》修订本) + +--- issue-2538-cjk-latin-spacing-before-linebreak --- +// Issue #2538 +#set text(cjk-latin-spacing: auto) + +abc字 + +abc字#linebreak() + +abc字#linebreak() +母 + +abc字\ +母 + +--- issue-2650-cjk-latin-spacing-meta --- +测a试 + +测#context [a]试 diff --git a/tests/suite/layout/inline/hyphenate.typ b/tests/suite/layout/inline/hyphenate.typ new file mode 100644 index 00000000..aaabe816 --- /dev/null +++ b/tests/suite/layout/inline/hyphenate.typ @@ -0,0 +1,51 @@ +// Test hyphenation. + +--- hyphenate --- +// Test hyphenating english and greek. +#set text(hyphenate: true) +#set page(width: auto) +#grid( + columns: (50pt, 50pt), + [Warm welcomes to Typst.], + text(lang: "el")[διαμερίσματα. \ λατρευτός], +) + +--- hyphenate-off-temporarily --- +// Test disabling hyphenation for short passages. +#set page(width: 110pt) +#set text(hyphenate: true) + +Welcome to wonderful experiences. \ +Welcome to `wonderful` experiences. \ +Welcome to #text(hyphenate: false)[wonderful] experiences. \ +Welcome to wonde#text(hyphenate: false)[rf]ul experiences. \ + +// Test enabling hyphenation for short passages. +#set text(hyphenate: false) +Welcome to wonderful experiences. \ +Welcome to wo#text(hyphenate: true)[nd]erful experiences. \ + +--- hyphenate-between-shape-runs --- +// Hyphenate between shape runs. +#set page(width: 80pt) +#set text(hyphenate: true) +It's a #emph[Tree]beard. + +--- hyphenate-shy --- +// Test shy hyphens. +#set text(lang: "de", hyphenate: true) +#grid( + columns: 2 * (20pt,), + gutter: 20pt, + [Barankauf], + [Bar-?ankauf], +) + +--- hyphenate-punctuation --- +// This sequence would confuse hypher if we passed trailing / leading +// punctuation instead of just the words. So this tests that we don't +// do that. The test passes if there's just one hyphenation between +// "net" and "works". +#set page(width: 60pt) +#set text(hyphenate: true) +#h(6pt) networks, the rest. diff --git a/tests/suite/layout/inline/justify.typ b/tests/suite/layout/inline/justify.typ new file mode 100644 index 00000000..e1e15578 --- /dev/null +++ b/tests/suite/layout/inline/justify.typ @@ -0,0 +1,170 @@ +--- justify --- +#set page(width: 180pt) +#set block(spacing: 5pt) +#set par(justify: true, first-line-indent: 14pt, leading: 5pt) + +This text is justified, meaning that spaces are stretched so that the text +forms a "block" with flush edges at both sides. + +First line indents and hyphenation play nicely with justified text. + +--- justify-knuth-story --- +// LARGE +#set page(width: auto, height: auto) +#set par(leading: 4pt, justify: true) +#set text(font: "New Computer Modern") + +#let story = [ + In olden times when wishing still helped one, there lived a king whose + daughters were all beautiful; and the youngest was so beautiful that the sun + itself, which has seen so much, was astonished whenever it shone in her face. + Close by the king’s castle lay a great dark forest, and under an old lime-tree + in the forest was a well, and when the day was very warm, the king’s child + went out into the forest and sat down by the side of the cool fountain; and + when she was bored she took a golden ball, and threw it up on high and caught + it; and this ball was her favorite plaything. +] + +#let column(title, linebreaks, hyphenate) = { + rect(inset: 0pt, width: 132pt, fill: rgb("eee"))[ + #set par(linebreaks: linebreaks) + #set text(hyphenate: hyphenate) + #strong(title) \ #story + ] +} + +#grid( + columns: 3, + gutter: 10pt, + column([Simple without hyphens], "simple", false), + column([Simple with hyphens], "simple", true), + column([Optimized with hyphens], "optimized", true), +) + +--- justify-manual-linebreak --- +// Test that lines with hard breaks aren't justified. +#set par(justify: true) +A B C \ +D + +--- justify-justified-linebreak --- +// Test forced justification with justified break. +A B C #linebreak(justify: true) +D E F #linebreak(justify: true) + +--- justify-basically-empty --- +// Test that there are no hick-ups with justification enabled and +// basically empty paragraph. +#set par(justify: true) +#"" + +--- justify-shrink-last-line --- +// Test that the last line can be shrunk +#set page(width: 155pt) +#set par(justify: true) +This text can be fitted in one line. + +--- justify-avoid-runts --- +// Test that runts are avoided when it's not too costly to do so. +#set page(width: 124pt) +#set par(justify: true) +#for i in range(0, 20) { + "a b c " +} +#"d" + +--- justify-no-leading-spaces --- +// Test that justification cannot lead to a leading space +#set par(justify: true) +#set text(size: 12pt) +#set page(width: 45mm, height: auto) + +lorem ipsum 1234, lorem ipsum dolor sit amet + +#" leading whitespace should still be displayed" + +--- justify-code-blocks --- +// Test that justification doesn't break code blocks +#set par(justify: true) + +```cpp +int main() { + printf("Hello world\n"); + return 0; +} +``` + +--- justify-chinese --- +// In Chinese typography, line length should be multiples of the character size +// and the line ends should be aligned with each other. Most Chinese +// publications do not use hanging punctuation at line end. +#set page(width: auto) +#set par(justify: true) +#set text(lang: "zh", font: "Noto Serif CJK SC") + +#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[ + 中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加; +] + +--- justify-japanese --- +// Japanese typography is more complex, make sure it is at least a bit sensible. +#set page(width: auto) +#set par(justify: true) +#set text(lang: "ja", font: ("Linux Libertine", "Noto Serif CJK JP")) +#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[ + ウィキペディア(英: Wikipedia)は、世界中のボランティアの共同作業によって執筆及び作成されるフリーの多言語インターネット百科事典である。主に寄付に依って活動している非営利団体「ウィキメディア財団」が所有・運営している。 + + 専門家によるオンライン百科事典プロジェクトNupedia(ヌーペディア)を前身として、2001年1月、ラリー・サンガーとジミー・ウェールズ(英: Jimmy Donal "Jimbo" Wales)により英語でプロジェクトが開始された。 +] + +--- justify-whitespace-adjustment --- +// Test punctuation whitespace adjustment +#set page(width: auto) +#set text(lang: "zh", font: "Noto Serif CJK SC") +#set par(justify: true) +#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[ + “引号测试”,还, + + 《书名》《测试》下一行 + + 《书名》《测试》。 +] + +「『引号』」。“‘引号’”。 + +--- justify-variants --- +// Test Variants of Mainland China, Hong Kong, and Japan. + +// 17 characters a line. +#set page(width: 170pt + 10pt, margin: (x: 5pt)) +#set text(lang: "zh", font: "Noto Serif CJK SC") +#set par(justify: true) + +孔雀最早见于《山海经》中的《海内经》:“有孔雀。”东汉杨孚著《异物志》记载,岭南:“孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。” + +#set text(lang: "zh", region: "hk", font: "Noto Serif CJK TC") +孔雀最早见于《山海经》中的《海内经》:「有孔雀。」东汉杨孚著《异物志》记载,岭南:「孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。」 + +--- justify-punctuation-adjustment --- +// Test punctuation marks adjustment in justified paragraph. + +// The test case includes the following scenarios: +// - Compression of punctuation marks at line start or line end +// - Adjustment of adjacent punctuation marks + +#set page(width: 110pt + 10pt, margin: (x: 5pt)) +#set text(lang: "zh", font: "Noto Serif CJK SC") +#set par(justify: true) + +标注在字间的标点符号(乙式括号省略号以外)通常占一个汉字宽度,使其易于识别、适合配置及排版,有些排版风格完全不对标点宽度进行任何调整。但是为了让文字体裁更加紧凑易读,,,以及执行3.1.4 行首行尾禁则时,就需要对标点符号的宽度进行调整。是否调整取决于…… + +--- justify-without-justifiables --- +// Test breaking a line without justifiables. +#set par(justify: true) +#block(width: 1cm, fill: aqua, lorem(2)) + +--- issue-2419-justify-hanging-indent --- +// Test that combination of justification and hanging indent doesn't result in +// an underfull first line. +#set par(hanging-indent: 2.5cm, justify: true) +#lorem(5) diff --git a/tests/suite/layout/inline/linebreak.typ b/tests/suite/layout/inline/linebreak.typ new file mode 100644 index 00000000..2fa29b6c --- /dev/null +++ b/tests/suite/layout/inline/linebreak.typ @@ -0,0 +1,109 @@ +// Test line breaks. + +--- linebreak-overflow --- +// Test overlong word that is not directly after a hard break. +This is a spaceexceedinglylongy. + +--- linebreak-overflow-double --- +// Test two overlong words in a row. +Supercalifragilisticexpialidocious Expialigoricmetrioxidation. + +--- linebreak-hyphen-nbsp --- +// Test for non-breaking space and hyphen. +There are non\u{2011}breaking~characters. + +--- linebreak-narrow-nbsp --- +// Test for narrow non-breaking space. +#show "_": sym.space.nobreak.narrow +0.1_g, 1_g, 10_g, 100_g, 1_000_g, 10_000_g, 100_000_g, 1_000_000_g + +--- linebreak-shape-run --- +// Test that there are no unwanted line break opportunities on run change. +This is partly emp#emph[has]ized. + +--- linebreak-manual --- +Hard #linebreak() break. + +--- linebreak-manual-directly-after-automatic --- +// Test hard break directly after normal break. +Hard break directly after \ normal break. + +--- linebreak-manual-consecutive --- +// Test consecutive breaks. +Two consecutive \ \ breaks and three \ \ more. + +--- linebreak-manual-trailing-multiple --- +// Test forcing an empty trailing line. +Trailing break \ \ + +--- linebreak-manual-justified --- +// Test justified breaks. +#set par(justify: true) +With a soft #linebreak(justify: true) +break you can force a break without #linebreak(justify: true) +breaking justification. #linebreak(justify: false) +Nice! + +--- linebreak-thai --- +// Test linebreak for East Asian languages +ทีวีตรวจทานนอร์ทแฟรีเลคเชอร์โกลด์อัลบัมเชอร์รี่เย้วสโตร์กฤษณ์เคลมเยอบีร่าพ่อค้าบลูเบอร์รี่สหัสวรรษโฮปแคนูโยโย่จูนสตรอว์เบอร์รีซื่อบื้อเยนแบ็กโฮเป็นไงโดนัททอมสเตริโอแคนูวิทย์แดรี่โดนัทวิทย์แอปพริคอทเซอร์ไพรส์ไฮบริดกิฟท์อินเตอร์โซนเซอร์วิสเทียมทานโคโยตี้ม็อบเที่ยงคืนบุญคุณ + +--- linebreak-cite-punctuation --- +// Test punctuation after citations. +#set page(width: 162pt) + +They can look for the details in @netwok, +which is the authoritative source. + +#bibliography("/assets/bib/works.bib") + +--- linebreak-math-punctuation --- +// Test punctuation after math equations. +#set page(width: 85pt) + +We prove $1 < 2$. \ +We prove $1 < 2$! \ +We prove $1 < 2$? \ +We prove $1 < 2$, \ +We prove $1 < 2$; \ +We prove $1 < 2$: \ +We prove $1 < 2$- \ +We prove $1 < 2$– \ +We prove $1 < 2$— \ + +--- linebreak-link --- +#link("https://example.com/(ab") \ +#link("https://example.com/(ab)") \ +#link("https://example.com/(paren)") \ +#link("https://example.com/paren)") \ +#link("https://hi.com/%%%%%%%%abcdef") \ + +--- linebreak-link-justify --- +#set page(width: 240pt) +#set par(justify: true) + +Here's a link https://url.com/data/extern12840%data_urlenc and then there are more +links #link("www.url.com/data/extern12840%data_urlenc") in my text of links +http://mydataurl/hash/12098541029831025981024980124124214/incremental/progress%linkdata_information_setup_my_link_just_never_stops_going/on?query=false + +--- linebreak-link-end --- +// Ensure that there's no unconditional break at the end of a link. +#set page(width: 180pt, height: auto, margin: auto) +#set text(11pt) + +For info see #link("https://myhost.tld"). + +--- issue-2105-linebreak-tofu --- +#linebreak()中文 + +--- issue-3082-chinese-punctuation --- +#set text(font: "Noto Serif CJK TC", lang: "zh") +#set page(width: 230pt) + +課有手冬,朱得過已誰卜服見以大您即乙太邊良,因且行肉因和拉幸,念姐遠米巴急(abc0),松黃貫誰。 + +--- issue-80-emoji-linebreak --- +// Test that there are no linebreaks in composite emoji (issue #80). +#set page(width: 50pt, height: auto) +#h(99%) 🏳️🌈 +🏳️🌈 diff --git a/tests/suite/layout/inline/overhang.typ b/tests/suite/layout/inline/overhang.typ new file mode 100644 index 00000000..40b0e7f7 --- /dev/null +++ b/tests/suite/layout/inline/overhang.typ @@ -0,0 +1,24 @@ +// Test micro-typographical shenanigans. + +--- overhang --- +// Test hanging punctuation. +// TODO: This test was broken at some point. +#set page(width: 130pt, margin: 15pt) +#set par(justify: true, linebreaks: "simple") +#set text(size: 9pt) +#rect(inset: 0pt, fill: rgb(0, 0, 0, 0), width: 100%)[ + This is a little bit of text that builds up to + hang-ing hyphens and dash---es and then, you know, + some punctuation in the margin. +] + +// Test hanging punctuation with RTL. +#set text(lang: "he", font: ("PT Sans", "Noto Serif Hebrew")) +בנייה נכונה של משפטים ארוכים דורשת ידע בשפה. אז בואו נדבר על מזג האוויר. + +--- overhang-lone --- +// Test that lone punctuation doesn't overhang into the margin. +#set page(margin: 0pt) +#set align(end) +#set text(dir: rtl) +: diff --git a/tests/suite/layout/inline/shaping.typ b/tests/suite/layout/inline/shaping.typ new file mode 100644 index 00000000..ec93eb47 --- /dev/null +++ b/tests/suite/layout/inline/shaping.typ @@ -0,0 +1,65 @@ +// Test shaping quirks. + +--- shaping-script-separation --- +// Test separation by script. +#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari")) +ABCअपार्टमेंट + +// This is how it should look like. +अपार्टमेंट + +// This (without the spaces) is how it would look +// if we didn't separate by script. +अ पा र् ट में ट + +--- shaping-forced-script-font-feature-inhibited --- +// A forced `latn` script inhibits Devanagari font features. +#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari"), script: "latn") +ABCअपार्टमेंट + +--- shaping-forced-script-font-feature-enabled --- +// A forced `deva` script enables Devanagari font features. +#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari"), script: "deva") +ABCअपार्टमेंट + +--- issue-rtl-safe-to-break-panic --- +// Test that RTL safe-to-break doesn't panic even though newline +// doesn't exist in shaping output. +#set text(dir: rtl, font: "Noto Serif Hebrew") +\ ט + +--- shaping-font-fallback --- +// Font fallback for emoji. +A😀B + +// Font fallback for entire text. +دع النص يمطر عليك + +// Font fallback in right-to-left text. +ب🐈😀سم + +// Multi-layer font fallback. +Aب😀🏞سمB + +// Font fallback with composed emojis and multiple fonts. +01️⃣2 + +// Tofus are rendered with the first font. +A🐈ዲሞB + +--- shaping-emoji-basic --- +// This should form a three-member family. +👩👩👦 + +// This should form a pride flag. +🏳️🌈 + +// Skin tone modifier should be applied. +👍🏿 + +// This should be a 1 in a box. +1️⃣ + +--- shaping-emoji-bad-zwj --- +// These two shouldn't be affected by a zero-width joiner. +🏞🌋 diff --git a/tests/suite/layout/inline/text.typ b/tests/suite/layout/inline/text.typ new file mode 100644 index 00000000..e2bc84ef --- /dev/null +++ b/tests/suite/layout/inline/text.typ @@ -0,0 +1,89 @@ +// Test OpenType features. + +--- text-kerning --- +// Test turning kerning off. +#text(kerning: true)[Tq] \ +#text(kerning: false)[Tq] + +--- text-alternates-and-stylistic-sets --- +// Test alternates and stylistic sets. +#set text(font: "IBM Plex Serif") +a vs #text(alternates: true)[a] \ +ß vs #text(stylistic-set: 5)[ß] + +--- text-ligatures --- +// Test ligatures. +fi vs. #text(ligatures: false)[No fi] + +--- text-number-type --- +// Test number type. +#set text(number-type: "old-style") +0123456789 \ +#text(number-type: auto)[0123456789] + +--- text-number-width --- +// Test number width. +#text(number-width: "proportional")[0123456789] \ +#text(number-width: "tabular")[3456789123] \ +#text(number-width: "tabular")[0123456789] + +--- text-slashed-zero-and-fractions --- +// Test extra number stuff. +#set text(font: "IBM Plex Serif") +0 vs. #text(slashed-zero: true)[0] \ +1/2 vs. #text(fractions: true)[1/2] + +--- text-features --- +// Test raw features. +#text(features: ("smcp",))[Smcp] \ +fi vs. #text(features: (liga: 0))[No fi] + +--- text-stylistic-set-bad-type --- +// Error: 26-31 expected integer or none, found boolean +#set text(stylistic-set: false) + +--- text-stylistic-set-out-of-bounds --- +// Error: 26-28 stylistic set must be between 1 and 20 +#set text(stylistic-set: 25) + +--- text-number-type-bad --- +// Error: 24-25 expected "lining", "old-style", or auto, found integer +#set text(number-type: 2) + +--- text-features-bad --- +// Error: 21-26 expected array or dictionary, found boolean +#set text(features: false) + +--- text-features-bad-nested-type --- +// Error: 21-35 expected string, found boolean +#set text(features: ("tag", false)) + +--- text-tracking-negative --- +// Test tracking. +#set text(tracking: -0.01em) +I saw Zoe yӛsterday, on the tram. + +--- text-tracking-changed-temporarily --- +// Test tracking for only part of paragraph. +I'm in#text(tracking: 0.15em + 1.5pt)[ spaace]! + +--- text-tracking-mark-placement --- +// Test that tracking doesn't disrupt mark placement. +#set text(font: ("PT Sans", "Noto Serif Hebrew")) +#set text(tracking: 0.3em) +טֶקסט + +--- text-tracking-arabic --- +// Test tracking in arabic text (makes no sense whatsoever) +#set text(tracking: 0.3em) +النص + +--- text-spacing --- +// Test word spacing. +#set text(spacing: 1em) +My text has spaces. + +--- text-spacing-relative --- +// Test word spacing relative to the font's space width. +#set text(spacing: 50% + 1pt) +This is tight. |
