diff options
| author | Jeremie Knuesel <knuesel@gmail.com> | 2024-09-26 11:09:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-26 09:09:32 +0000 |
| commit | 4827f28a940b9610e55afb888ddde11e240caa20 (patch) | |
| tree | 6006e8ab9c69f430d7d20d677fb0e9878e1b2fbf | |
| parent | 8d38bd406669dacb1c9819f92a94fda2178dc452 (diff) | |
Fix smartquotes for Swiss French (#4992)
| -rw-r--r-- | crates/typst/src/text/smartquote.rs | 8 | ||||
| -rw-r--r-- | tests/ref/smartquote-fr-ch.png | bin | 0 -> 2353 bytes | |||
| -rw-r--r-- | tests/suite/text/smartquote.typ | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/crates/typst/src/text/smartquote.rs b/crates/typst/src/text/smartquote.rs index 0bcccf41..9b48c03a 100644 --- a/crates/typst/src/text/smartquote.rs +++ b/crates/typst/src/text/smartquote.rs @@ -207,8 +207,8 @@ impl<'s> SmartQuotes<'s> { /// Currently, the supported languages are: English, Czech, Danish, German, /// Swiss / Liechtensteinian German, Estonian, Icelandic, Italian, Latin, /// Lithuanian, Latvian, Slovak, Slovenian, Spanish, Bosnian, Finnish, - /// Swedish, French, Hungarian, Polish, Romanian, Japanese, Traditional - /// Chinese, Russian, Norwegian, and Hebrew. + /// Swedish, French, Swiss French, Hungarian, Polish, Romanian, Japanese, + /// Traditional Chinese, Russian, Norwegian, and Hebrew. /// /// For unknown languages, the English quotes are used as fallback. pub fn get( @@ -227,6 +227,10 @@ impl<'s> SmartQuotes<'s> { false => ("‹", "›", "«", "»"), true => low_high, }, + "fr" if matches!(region, Some("CH")) => match alternative { + false => ("‹\u{202F}", "\u{202F}›", "«\u{202F}", "\u{202F}»"), + true => default, + }, "cs" | "da" | "de" | "sk" | "sl" if alternative => ("›", "‹", "»", "«"), "cs" | "de" | "et" | "is" | "lt" | "lv" | "sk" | "sl" => low_high, "da" => ("‘", "’", "“", "”"), diff --git a/tests/ref/smartquote-fr-ch.png b/tests/ref/smartquote-fr-ch.png Binary files differnew file mode 100644 index 00000000..30e91e40 --- /dev/null +++ b/tests/ref/smartquote-fr-ch.png diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ index f5442ffd..fe4e8c85 100644 --- a/tests/suite/text/smartquote.typ +++ b/tests/suite/text/smartquote.typ @@ -22,6 +22,10 @@ #set text(lang: "fr") "Le cheval ne mange pas de salade de concombres" est la première phrase jamais prononcée au 'téléphone'. +--- smartquote-fr-ch --- +#set text(lang: "fr", region: "CH") +"Le cheval ne mange pas de salade de concombres" est la première phrase jamais prononcée au 'téléphone'. + --- smartquote-fi --- #set text(lang: "fi") "Hevonen ei syö kurkkusalaattia" oli ensimmäinen koskaan 'puhelimessa' lausuttu lause. |
