diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-02-19 22:41:23 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-02-19 22:48:02 +0100 |
commit | 3447815896954281938500d49bedef715078a140 (patch) | |
tree | d41348716e437e223fcf30ae636c9bc32e645639 /src/luaotfload-parsers.lua | |
parent | 9e04cce348b4de350b2e0612698c81311e6e6e9d (diff) | |
download | luaotfload-3447815896954281938500d49bedef715078a140.tar.gz |
[features,parsers] implement font fallbacks
Building on the combination mechanism, this allows defining fallback
fonts of which all glyphs are pulled that aren’t currently part of the
base font. Example:
\input luaotfload.sty
\font \lm = file:lmroman10-regular.otf:mode=base
\font \cmu = file:cmunrm.otf:mode=base
\font \lmu = "combo: 1->\fontid\lm; 2->\fontid\cmu,fallback"
\lmu Eh bien, mon prince. Gênes et Lueques ne sont plus que des
apanages, des поместья, de la famille Buonaparte.
\bye
This allows setting Latin Modern text that contains Cyrillic letters.
Note that -- as with the other combinations -- only glyphs are
considered, no other properties of the fallback font. So besides the
occasional letter in a different script this functionality is probably
useless.
Diffstat (limited to 'src/luaotfload-parsers.lua')
-rw-r--r-- | src/luaotfload-parsers.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua index 71e539d..b190c2c 100644 --- a/src/luaotfload-parsers.lua +++ b/src/luaotfload-parsers.lua @@ -591,11 +591,12 @@ local parenthesized = function (p) return P"(" * ws * p * ws * P")" end local comboidxpat = Cg(combouint, "idx") local comboidpat = Cg(combouint, "id" ) -local combocharspat = comboidpat * combodefsep * Cg(Ct(combochars^1), "chars") +local combocharspat = Cg(P"fallback" * Cc(true) + Ct(combochars^1), "chars") +local comboidcharspat = comboidpat * combodefsep * combocharspat -local comboidx = parenthesized (comboidxpat ) + comboidxpat -local comboid = parenthesized (comboidpat ) + comboidpat -local comboidchars = parenthesized (combocharspat) + combocharspat +local comboidx = parenthesized (comboidxpat ) + comboidxpat +local comboid = parenthesized (comboidpat ) + comboidpat +local comboidchars = parenthesized (comboidcharspat) + comboidcharspat local combodef1 = Ct(comboidx * combomapsep * comboid) --> no chars local combodef = Ct(comboidx * combomapsep * comboidchars) |