so i'm trying to typeset a book with chinese characters and pinyin transcription, and xelatex is throwing errors. i managed to narrow down the problems to the doubly-accented ê̄ down here:
\documentclass{book}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont[Mapping=tex-text]{Sun-ExtA}
\begin{document}
ê̄
\end{document}
that's a u+00ea LATIN SMALL LETTER E WITH CIRCUMFLEX
followed by a u+0304 COMBINING MACRON
. now these suckers really don't behave all too well on my osx mountain lion—depending on application they're rendered ugly, don't want to get copy-and-pasted, all kinds of errors. but worst, they make xelatex—more specifically, xdvipdfmx
—quit:
otf_cmap>> Creating ToUnicode CMap for "Sun-ExtA/H/65536/0/0"...
No Unicode mapping available: GID=50878, name=(none)(CID:Sun-ExtA/H/65536/0/0[IPIDPM+Sun-ExtA][CIDFontType2]
** ERROR ** Invalid glyph index (gid 50878)
Output file removed.
)
Error 256 (driver return code) generating output;
file dictionary/output-pdf/dictionary.pdf may not be valid.
Now you might be tempted to point at the specific font i used here, and you would be right in a way—when i omit the font specification, i do get a page rendered (with a quite unsightly ê̄). i did check Sun-ExtA for code point availability, and yes, it does contain both codepoints. it doesn't seem to be the only culprit; in the process of narrowing down the location of the failure, i also removed another font (http://www.georgduffner.at/ebgaramond/) which lead to similar errors (with different alleged GIDs).
the document i'm typesetting is quite complex as it contains chinese characters from the Astral Planes (cjk extensions b and c), pinyin, hiragana, katakana, hangul and so on. it is quite difficult to find nice, correct fonts for all these characters that go together well, so i'm not like, well that one doesn't work so let's just replace it with another font. that won't fly.
to go on, i must specifically find out:
how to narrow down this class of errors in the first place. it took me many hours to superficially understand the cause and find the source. there is painfully little in the thousands of lines of output that goes to the screen and into the log file (hell i wasn't even able to redirect all output—how does tech print to the screen if its neither
stdout
norstderr
?). the message that i did manage to isolate does not tell any line number or textual context and is slightly crazy—i mean, when EB Garamond was still inxdvipdfmx
complained about GIDs that map to a unicode cyrillic block, which i do not use, and the GID in the above message would correspond to 욾, which does not occur in my data either. are those GIDs even supposed to be unicode codepoints? how are you expected to hunt this down?next, i need to know what the best practices are to typeset multiple diacritics in xelatex. it doesn't have to be the most general solution, as there are only a couple relevant cases.
edit others seem to believe just writing out combining accents is a solution, but my trials (also with other fonts) just lead to overlapping accents next to the letter.
edit per the recommendations from the discussion linked above, i tried to \usepackage{covington}
and \twoacc[\~|\={a}]
—that works with standard fonts and with Sun-ExtA, but not with the Ubuntu font; allegedly GID 1267 being the culprit. i consider this a TeX bug—i mean it's just stacking three outlines on top of each other, right?
edit i forgot to mention: i'm on osx 10.8.4 here; the xetex installation is the one from MacTeX-2012. i did check on multiple fonts, as i had heard about problems (there was a single double font, which i resolved).
edit this example makes xdvipdfmx
quit with Invalid glyph index (gid 1265)
:
\documentclass{book}
\usepackage{polyglossia}
\setmainfont{Ubuntu}
\setdefaultlanguage{english}
\begin{document}
x́
\end{document}
the combining accent used here is u+0301; with u+0304 it quits with a GID of 1268; other diacritics either show a missing chr box or throw similar errors.
fc-list --format="%{family}:%{file}\n" | grep Sun-ExtA
).