latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

Feature request for combined fonts #390

Open emojifreak opened 5 years ago

emojifreak commented 5 years ago

Description

This is a feature request. luaotfload.sty can combine multiples fonts, that is, if a glyph is absent in the first font, the glyph in the second font is used (if the second has that glyph). As far as I see fontspec does not offer an equivalent function. For example, luaotfload combines the Gilbert color font and the Twemoji font, by lualatex --shell-escape with a manual bug fix to luaotfload,

\documentclass{article}

\font\colorfont={[./Gilbert-Color Bold Preview5.otf]:+svg;+kern;} at 10pt
\font\twemoji={[./TwemojiMozilla.ttf]:+colr;+ccmp;+dist;} at 10pt
\font\combo={combo: 1->\fontid \colorfont ; 2->\fontid \twemoji ,fallback}
\begin{document}
\combo
Font Combination in \LaTeX❣✌
\end{document}

into

Screenshot at 2019-11-16 09-42-37

It would be nice if the fontspec can offer this underlying function of luaotfload. luatexja-fontspec package has a similar option AltFont for Japanese fonts used as

AltFont = {
  { Range=⟨range⟩,⟨features⟩},
  { Range=⟨range⟩, Font=⟨font name⟩,⟨features⟩},
  { Range=⟨range⟩, Font=⟨font name⟩},...}

which is explained Section 11.1 of its English documentation http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=blob_plain;f=doc/luatexja-en.pdf;hb=HEAD#subsection.11.1

Check/indicate

Minimal example demonstrating the issue

See above.

Further details

The Gilbert font is from https://www.typewithpride.com/download The Twemoji font is from https://github.com/mozilla/twemoji-colr/releases