latex3 / fontspec

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

Get access to the different layers of a glyph \char<No> #485

Closed cis555 closed 8 months ago

cis555 commented 1 year ago

0

Sometimes a glyph is composed of different layers. Random example: 1

But a command of type \char[layer=2]"1F0AE is not available at the moment. Would it be possible to create an addition that allows access to the contents of the different layers? Then outputs of the following type could be possible: 2

\documentclass{article}
\usepackage{fontspec}
\setmainfont{<a font whose glyphs have several layers>}
 \char[<layer options>]"1F0AE
\end{document}

PS: I added ExampleFontWithLayers.ttf, where \char0 contains the shown situation with layers. ExampleFontWithLayers01.zip

wspr commented 1 year ago

Do you know how to access the layers with plain luaotfload interfaces? (I am guessing this is not possible in XeTeX)

khaledhosny commented 1 year ago

There is no such thing as glyph layers in TrueType/OpenType fonts. This font was created with FontForge and the layers are a proprietary FontForge extension meant to be used by FontForge when re-editing the font. The glyf table has only one glyph and it is the layer 1 showed above.

khaledhosny commented 1 year ago

To create colored glyphs, you can use COLR table (but it is not supported by FontForge).

wspr commented 8 months ago

Based on Khaled's comments I think we have to close this one, nothing that can be done within fontspec sorry.