latex3 / luaotfload

OpenType font loader for LuaTeX
Other
56 stars 6 forks source link

How to go about a dynamically building font? #251

Open apparebit opened 1 year ago

apparebit commented 1 year ago

Hi,

I'm the author of the emo package for supporting emoji on all major TeX engines. So far, emo has been using PDF graphics for pdfLaTeX and XeLaTeX, Unicode code points with the Noto color emoji font for LuaLaTeX, and just Unicode for LaTeXML and TeX4ht. But I finally wisened up to the default distribution of Note's color emoji font using CBDT/CBLC bitmaps, which is less than ideal. Alas, the alternatives aren't very appealing either: Noto SVG requires Inkscape and --shell-escape. COLRv0 fonts work but Noto's COLRv1 doesn't seem supported (correct?).

So, in my quest to get Unicode code points and vector graphics, I was looking into virtual fonts but didn't find any good examples anywhere on how I'd go about dynamically instantiating and filling such a font. Also, since virtual fonts are restricted to 256 glyphs that would mean up to 15 virtual fonts for covering the range of emoji (sigh). I did discover a fascinating article by @hanshagen on User-defined Type 3 fonts in LuaTeX that seems to sketch just what I need, function-wise. But not having much experience with TeX/LaTeX and low level PDF, I'd like to get feedback please on whether this is a reasonable way forward. Also, are Type 3 fonts limited to 256 glyphs as well? And do you know of other code examples, ideally in production code, that achieve similar functionality? I suspect that luaotfload contains something like this as well for SVG support.

I guess, in the worst case, I could pre-create the 15 Type 3 or virtual fonts covering the full repertoire of emoji. Thankfully, I already have Python code for taking Unicode's emoji list and converting it a format more suitable for LaTeX (originally, just by \defing a lookup table; now, with indirection through a set of macros).

Thanks!