# Looking for a package/method that can make “best-guess” (heuristic) accents onto a font that doesn't have latin-extended support

I have a lot of printed content using a particular font, and I'm trying to extend localisation with latin-extended-a charsets, but the font I'm using doesn't support it (It's a TTF - using fontspec and XeLaTeX).

Of course finding a similar font is a backup option, but I wonder if it's possible to make TeX draw accents onto a font using some heuristic or best-fit guess?

Something like H\={e}llo but for fonts that don't have ē - so maybe H\fit={e}llo-like command is available?

Cheers,

While I define \fit as suggested by the OP, it may prove easier to then incorporate \fit into macros tailored for the accent (shown for \macron and \umlaut).

\documentclass{article}
\usepackage{stackengine}
\newcommand\fit[3][.3ex]{\stackengine{#1}{#3}{#2}{O}{c}{F}{T}{S}}
\newcommand\macron[1]{\fit{\kern-.2ex\_}{#1}}
\newcommand\umlaut[1]{\fit{\kern-.05ex.\kern-.15ex.}{#1}}
%\let\=\macron
%\let\"\umlaut
\begin{document}
H\=ello  H\macron ello
\"Apfel \umlaut Apfel

\Huge
H\=ello  H\macron ello\par
\"Apfel \umlaut Apfel
\end{document}


If you truly have no need for the original definitions (because they don't work in your font), you could redefine the originals with these preamble declarations:

\let\=\macron
\let\"\umlaut

• I used this method and it worked pretty well - only took about an hour to make all the accents I needed for this particular font. This isn't really an "automatic" best guess, but the result is really nice. Thanks! – Blake Sep 8 '17 at 11:13
• @Blake Thanks. If you need under-accents, like a \c cedilla, for example, I would add an extra macro, \newcommand\ufit[3][0ex]{\stackengine{#1}{#3}{#2}{U}{c}{F}{T}{S}} which stacks under, rather than over, the argument. – Steven B. Segletes Sep 8 '17 at 11:15
• that's exactly what I did. Since the font is script, I actually made a few fits and underfits - fit, fitb, fitc, ufit, ufitb, to line up with all the examples. Then some nice macros for each like \ncedilla etc. Cheers! – Blake Sep 8 '17 at 11:18
• in lualatex this not working: avail lists: 1:2,2:39,3:4,4:1,5:20,6:57,7:62,8:1,9:26 ! error: (type 0): cannot find file '' ! ==> Fatal error occurred, no output PDF file produced! – Marko Lustro Sep 15 '17 at 10:24
• @MarkoLustro I just tried it with lualatex and it works fine for me. Make sure stackengine package is up to date (2017/02/13 v4.01). – Steven B. Segletes Sep 15 '17 at 22:56