# Follow up question: TeX accents do not seem to work with fontspec and xe/lua/latex

This is a follow up to this question.

How would the same look for the dot above? That is, what's the standard definition for \. ?

Or does somebody in the meantime know a better solution to the whole problem? (The funny thing is that the whole issue cropped up when switching to TeX Live 2011 from the version coming with Ubuntu 11.04. Flying accents used to work with that version together with fontspec.)

A minimal example:

\documentclass{minimal}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Garamond Premier Pro}
\begin{document}
\.m ṁ
\end{document}


With texlive-2011, this gives two missing characters, while with the Ubuntu 11.04 version, the one with the flying accent appeared correctly. I am aware that the Ubuntu 11.04 version of fontspec did not pull in xunicode, but there I included it separately, so the problem should have nothing to do with this.

-
Would you pleas add a minimal example? It's quite strange: what font are you using? – egreg Nov 23 '11 at 21:49
@egreg: Newer versions of fontspec load xunicode so it is quite possible that documents which didn't load xunicode before change. – Ulrike Fischer Nov 24 '11 at 9:07
@UlrikeFischer That's why I asked for an example – egreg Nov 24 '11 at 9:32
@HyperBoar: Please edit your question to include this. – Martin Schröder Nov 24 '11 at 15:19
I have now included my minimal example in the question. – HyperBoar Nov 25 '11 at 10:39

The standard definition depends on the font encoding: With OT1 and T1 it is an accent (you can find the definitions in OT1enc.def and T1enc.def). When you use a newer fontspec(which loads xuniode) and so EU1 (xelatex) or EU2 (lualatex) fontencoding the general definition of \. is that it is a "combining dot":

\DeclareEncodedCompositeCharacter{\UTFencname}{\.}{0307}{02D9}  % Combining dot above


Some special combinations are mapped to specific glyph. E.g. \.e is Unicode U+0117:

\DeclareUTFcomposite[\UTFencname]{x0117}{\.}{e}


In theory is should be possible to rewrite the commands so that they check if the glyphs are available and use some fallback if not. In practice I doubt that it is sensible. It wouldn't help if you enter the glyphs directly instead of using accent commands, it would slow down compilation, it would mean a lot work to decide and implement sensible fallbacks in xunicode (and it would make xunicode much larger). If you want to use non-standard characters with xelatex the best is to use a font which has the glyphs. If a small number are missing add fallbacks based on the method suggested in the question you linked to.


\documentclass{article}
\usepackage{fontspec}
\setmainfont{Garamond}
%\DeclareTextCommand{\.}{\UTFencname}[1]{(#1)}
%\renewcommand\.[1]{(#1)}
%\DeclareTextAccent{\.}{\UTFencname}{"02D9}

\begin{document}
\.C \.a, \.w \.W

\fontencoding{OT1}\selectfont  \.w

\end{document}

-
Sorry, but I do not understand how you mean. In ot1enc.def I find a declaration like \DeclareTextAccent{\.}{OT1}{95} (and a similar one in t1enc.def), which I cannot use directly, can I? I mean, if I add this line to my minimal example above, it doesn't change anything. – HyperBoar Nov 24 '11 at 12:59
The declaration in ot1enc.def tells LaTeX how to handle \. when OT1-encoding is active. But with fontspec + xelatex you are using EU1-encoding. In this case you need declarations similar to those in xunicode. How the declaration should look exactly depends on the font (on the glyphs of the font). As I don't have your font I can't give you the details. – Ulrike Fischer Nov 24 '11 at 13:23
Thanks for your help, but… would it not be much easier to define \. plainly as a command, just as \d in the question I linked? What would be the equivalent of that definition for \.? – HyperBoar Nov 24 '11 at 20:04
Redefining such a command with renewcommand is not a good idea. It will break the command also for other encodings. You should use one of the encoding dependant commands. I have put an example above. – Ulrike Fischer Nov 25 '11 at 8:38