Skip to content

Commit

Permalink
Merge pull request #2040 from alerque/font-fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jun 3, 2024
2 parents 16dabf7 + 2b15de5 commit 6a27745
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/font-fallback/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function package:registerCommands ()
self:registerCommand("font:clear-fallbacks", function ()
if SILE.shaper._name == "fallback" and lastShaperType then
SU.debug("font-fallback", "Clearing fallbacks, switching from fallback enabled back to previous shaper")
SILE.shapers:clearFallbacks()
SILE.shaper:clearFallbacks()
SILE.typesetter:leaveHmode(true)
SILE.shapers[lastShaperType]:cast(SILE.shaper)
lastShaperType = nil
Expand Down
7 changes: 6 additions & 1 deletion tests/font-fallback-empty.expected
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
Set paper size 297.6377985 419.5275636
Begin page
Mx 14.8819
My 29.7654
My 28.6664
Set font Noto Serif CJK JP;10;400;;normal;;;LTR
T 1542 w=10.0000 (ん)
My 40.6664
Set font Gentium Plus;10;400;;normal;;;LTR
T 0 w=6.8359 (ん)
My 52.6664
T 0 w=6.8359 (ん)
End page
Finish
13 changes: 12 additions & 1 deletion tests/font-fallback-empty.sil
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
\begin[papersize=a6]{document}
\nofolios
\noindent
\neverindent
\use[module=packages.font-fallback]

% Adding Noto as a fallback should make this character render
\font:add-fallback[family=Noto Serif CJK JP]

% But removing it should give us tofu
\font:remove-fallback

% Also clearing all fallbacks should result in tofu
\font:add-fallback[family=Noto Serif CJK JP]
\font:clear-fallbacks

\end{document}

0 comments on commit 6a27745

Please sign in to comment.