[luatex] Unicode composite characters and TrueType fonts

Ulrike Fischer luatex at nililand.de
Thu May 25 19:00:37 CEST 2017


Am Wed, 24 May 2017 20:08:49 +0200 schrieb Daniel Flipo:

> Most TrueType fonts fail to output Unicode composite characters properly
> when using LuaTeX while they do a good job with XeTeX.
> 
> Let's take <e-acute> as an example. In principle, <e-acute> can be coded
> as U+00E9 or as U+0065 U+0301 (e+acute). The following example compiled
> with LuaTeX shows differences which depend on the font:

There has been a rather long discussion about this on the context
list in februar:

http://www.mail-archive.com/ntg-context@ntg.nl/msg84424.html

In short: the harfbuzz library in xetex tries to use the composed
glyph if it exists. 

You can mimick this feature, by adding "ligatures" which combine the
accent and the char. This here works for me on texlive 2017:

\documentclass{article}

\directlua
{
  fonts.handlers.otf.addfeature
  {
    name = "compose",
    type = "ligature",
    data =
        {
          ["Ạ"] = { "A", "^^^^0323"},
          ["Ḅ"] = { "B", "^^^^0323"},
          ["é"] = { "e","^^^^0301"},  
        },
  }
}

\begin{document}


\font\verdana={file:verdana.ttf:mode=node;+compose;}
\font\georgia={file:georgia.ttf:mode=node;+compose;}
\font\arial={file:arial.ttf:mode=node;+compose;}
\font\roboto={file:roboto-regular.ttf:mode=node;+compose;}

% été is coded as U+00E9 U+0074 U+0065 U+0301
% (visible using emacs for instance).
\verdana e^^^^0301, été    % misplaces accent

\georgia e^^^^0301, été    % swallows accent

\arial e^^^^0301, été      % places accent (a lot) too high

\roboto e^^^^0301, été     % correct

\end{document}

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the luatex mailing list