From 0523f22d839df60dcb7a983caf5c82016c972ff9 Mon Sep 17 00:00:00 2001 From: Niklas Mohrin Date: Wed, 17 Apr 2024 17:25:16 +0200 Subject: Warn about unknown font families during parsing (#3854) --- tests/ref/text-unknown-font-family-warning.png | Bin 0 -> 499 bytes tests/suite/math/interactions.typ | 1 + tests/suite/text/edge.typ | 2 ++ tests/suite/text/font.typ | 12 ++++++++++++ 4 files changed, 15 insertions(+) create mode 100644 tests/ref/text-unknown-font-family-warning.png (limited to 'tests') diff --git a/tests/ref/text-unknown-font-family-warning.png b/tests/ref/text-unknown-font-family-warning.png new file mode 100644 index 00000000..a46632cf Binary files /dev/null and b/tests/ref/text-unknown-font-family-warning.png differ diff --git a/tests/suite/math/interactions.typ b/tests/suite/math/interactions.typ index 37185962..03d5a6e7 100644 --- a/tests/suite/math/interactions.typ +++ b/tests/suite/math/interactions.typ @@ -17,6 +17,7 @@ $ x := #table(columns: 2)[x][y]/mat(1, 2, 3) --- math-font-switch --- // Test font switch. +// Warning: 29-40 unknown font family: noto sans #let here = text.with(font: "Noto Sans") $#here[f] := #here[Hi there]$. diff --git a/tests/suite/text/edge.typ b/tests/suite/text/edge.typ index 57732156..9ee9bd2f 100644 --- a/tests/suite/text/edge.typ +++ b/tests/suite/text/edge.typ @@ -5,11 +5,13 @@ #set text(size: 8pt) #let try(top, bottom) = rect(inset: 0pt, fill: conifer)[ + // Warning: 19-34 unknown font family: ibm plex mono #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) From #top to #bottom ] #let try-bounds(top, bottom) = rect(inset: 0pt, fill: conifer)[ + // Warning: 19-34 unknown font family: ibm plex mono #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) #top to #bottom: "yay, Typst" ] diff --git a/tests/suite/text/font.typ b/tests/suite/text/font.typ index 47ec6419..ecc4c5c7 100644 --- a/tests/suite/text/font.typ +++ b/tests/suite/text/font.typ @@ -64,3 +64,15 @@ Emoji: 🐪, 🌋, 🏞 --- text-bad-named-argument --- // Error: 11-31 unexpected argument: something #set text(something: "invalid") + +--- text-unknown-font-family-warning --- +#text(font: "linux libertine", "I exist, ") +// Warning: 13-27 unknown font family: non-existing +#text(font: "non-existing", "but") +// Warning: 17-36 unknown font family: also-non-existing +#set text(font: "also-non-existing") +I +// Warning: 23-56 unknown font family: list-of +// Warning: 23-56 unknown font family: non-existing-fonts +#let var = text(font: ("list-of", "non-existing-fonts"))[don't] +#var -- cgit v1.2.3