latex3 / luaotfload

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

letterspacing and combining accents #127

Open u-fischer opened 4 years ago

u-fischer commented 4 years ago

from https://tex.stackexchange.com/questions/521431/fontspec-shifts-some-diacritics-marks-when-letterspacing

letterspacing doesn't work well with char + combining accents.

\documentclass{article}
\begin{document}
\font\test={file:Erewhon-Regular.otf:mode=node;script=latn;language=DFLT;}
\test E^^^^0302 X^^^^0302 A^^^^0300 

\font\test={file:Erewhon-Regular.otf:mode=node;letterspace=20;script=latn;language=DFLT;}
\test E^^^^0302 X^^^^0302 A^^^^0300 

\end{document}

image

zauguin commented 4 years ago

In 6705174c this is fixed for combining accents which get the mark class defined in the fonts GDEF table. That works in most fonts which actually use this table, but e.g. in Latin Modern it doesn't help. We probably need to fallback to look at the Unicode properties for such fonts. I tried to avoid that for now because that makes it harder to handle glyphs which do not correspond to some unicode codepoint.

u-fischer commented 4 years ago

Hm, latin modern is a problem. I wonder if it were better if cm-unicode were the default font. We could also try to contact the font maintainer. I stepped the version number and date in dev so that one can better see the progress.

khaledhosny commented 4 years ago

The way this ought to be handled, is by implementing Unicode Grapheme Clusters segmentation, and treating each grapheme cluster as unit during letter spacing.