[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: documented fallback (46468a6)
Ulrike Fischer
fischer at troubleshooting-tex.de
Thu Jan 30 16:43:12 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/46468a6252a755503c3f1a197d074569fdffc4de
>---------------------------------------------------------------
commit 46468a6252a755503c3f1a197d074569fdffc4de
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu Jan 30 16:43:12 2020 +0100
documented fallback
>---------------------------------------------------------------
46468a6252a755503c3f1a197d074569fdffc4de
doc/luaotfload-latex.tex | 12 ++++++++++
doc/luaotfload-main.tex | 59 +++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 8d51b04..cdcb26e 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -208,6 +208,7 @@
%% one that we could map directly onto Latex’s \verb|…|.
\usepackage{pdfpages}
\usepackage {listings}
+\usepackage{csquotes}
\usepackage {luatexbase}
\lstset {
basicstyle=\ttfamily,
@@ -300,6 +301,17 @@
}
)
}
+ \directlua
+ {luaotfload.add_fallback
+ ("myfallback",
+ {
+ "DejaVuSans:mode=harf;script=grek;color=FF0000;",
+ "cmuserif:mode=node;script=cyrl;color=00FF00;",
+ "NotoSansBengali:mode=harf;script=bng2;color=0000FF;",
+ "NotoColorEmoji:mode=harf;"
+ }
+ )
+ }
\def \listingpar {\endgraf}
\let \endlistingline \relax
diff --git a/doc/luaotfload-main.tex b/doc/luaotfload-main.tex
index f6193f4..ae407fa 100644
--- a/doc/luaotfload-main.tex
+++ b/doc/luaotfload-main.tex
@@ -1115,6 +1115,7 @@ obviously, \inlinecode{random}.
\item \identifier{multiscript} doesn't change hyphenation patterns or other language or script related features.
\item Language packages like \identifier{babel} or \identifier{polyglossia} have code to change the script too which could interfere or clash. This hasn't been tested yet.
+
\end{itemize}
It is possible to use the value \identifier{auto} with \identifier{multiscript}. luaotfload will then switch the script if it detects a char belonging to another script (and if the font support this script). This can be useful for fonts supporting more than one script or when using the \identifier{fallback} key described below.
@@ -1126,7 +1127,59 @@ obviously, \inlinecode{random}.
\endaltitem
\beginaltitem {fallback}\label{fallback}
- XX\marginpar{New in 3.12 -- experimental}
+ This\marginpar{New in 3.12 -- experimental} allows you to define a chain of fonts which are used if glyphs are missing in the main font. It works only for text fonts, not for math fonts set with the \identifier{unicode-math} package.
+ The feature is experimental and bound to change. Feedback is welcome but you use it at your risk.
+ For example
+
+ \beginlisting
+ \directlua
+ {luaotfload.add_fallback
+ ("myfallback",
+ {
+ "DejaVuSans:mode=harf;script=grek;color=FF0000;",
+ "cmuserif:mode=node;script=cyrl;color=00FF00;",
+ "NotoSansBengali:mode=harf;script=bng2;color=0000FF;"
+ "NotoColorEmoji:mode=harf;"
+ }
+ )
+ }
+ \endlisting
+
+ This fallback can then be used e.g. like this:
+
+ \beginlisting
+ \font\test={name:LatinModernRoman:mode=node;fallback=myfallback;}
+ \endlisting
+
+ {\Large
+ \font\test={name:LatinModernRoman:mode=node;fallback=myfallback;}\test
+ 1234 a^^^^0301 π^^^^0301 a!? π123!? a БѨ123!? a \char"1F600\ \char"1F986\ \char"0995\char"09BF a „π“ a „Б“
+ }
+
+ Interesting points in the output are
+ \begin{itemize}
+ \item The accent over the pi, the digits and the quotes are all from the base font. Only missing glyphs are from the fallback.
+ \item The cyrillic is printed with the DejaVu font, despite the fact that is sets the script to \identifier{grek} and that the next font in the fallback chain would fit better.
+ \item The duck emoji is from the Noto font, while the face is from DejaVu as it comes first in the chain.
+ \end{itemize}
+
+ The \identifier{fallback} can be combined with the \identifier{multiscript}. For example
+
+ \beginlisting
+ \font\test={name:LatinModernRoman:mode=node;fallback=myfallback;multiscript=auto;}
+ \endlisting
+
+ {\Large
+ \font\test={name:LatinModernRoman:mode=node;fallback=myfallback;multiscript=auto;}\test
+ 1234 a^^^^0301 π^^^^0301 a!? π123!? a БѨ123!? a \char"1F600\ \char"1F986\ \char"0995\char"09BF a „π“ a „Б“
+ }
+
+ Now the accent over the pi is better. The digits after the pi and the closing quote use the DejaVu font. The digits after
+ the cyrillic use the Latin Modern font because of an interesting \enquote{feature} of this font: It claims to know the \identifier{cyrl} script despite the fact that it doesn't contain any cyrillic glyphs.
+
+ \identifier{fallback} can be nested: fonts in the fallback table can refer to another \identifier{fallback} table.
+
+ As with the \identifier{multiscript} key more control over the used glyph and script in edge cases will be needed.
\endaltitem
\enddescriptions
@@ -1196,8 +1249,8 @@ Currently (2014) there are three of them:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\beginsection {Combining fonts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Version 2.7 and later support combining characters from multiple fonts into a
+Beside the new keys \identifier{multiscript} and \identifier{fallback} described earlier
+Version 2.7 and later support another method to combine characters from multiple fonts into a
single virtualized one. This requires that the affected fonts be loaded in
advance as well as a special \emphasis{request syntax}. Furthermore, this
allows to define \emphasis{fallback fonts} to supplement fonts that may lack
More information about the latex3-commits
mailing list.