[XeTeX] substitutions for missing or wrong glyphs
Fr. Michael Gilmary, mma
frmichaelgilmary at maronitemonks.org
Wed Feb 2 17:03:16 CET 2011
On Feb 2 AD 2011, at 4:40 AM, Susan Dittmar wrote:
> I would like to use a font (several in fact, some of which are true
> type,
> others open type) which does not include all glyphs I need. For
> example
> the endash and emdash are missing, as are the german quotation
> marks. Is
> there a way, other than hacking the font file itself, to tell xetex
> to take
> those glyphs from another font? I know that might look ugly, but
> it's still
> less ugly than the 'missing glyph' glyph or another completely
> wrong glyph.
Hi Susan:
This seems to be a perfect case for XeTeX interchartoks!
This works, but you'll want to change the Scale for the \tgb font
I've used here (I made an exaggerated example so it could be seen to
work).
%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt]{article}
\XeTeXinterchartokenstate = 1
\usepackage{fontspec, realscripts}
\usepackage{polyglossia}
\setdefaultlanguage[variant=us]{english}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[Numbers={OldStyle,Proportional}, Contextuals=NoAlternate]
{Garamond Premier Pro}
\newfontfamily\tgb[Scale=2]{TeX Gyre Bonum}
\XeTeXinterchartoks 0 4 = {\tgb}
\XeTeXinterchartoks 4 0 = {\normalfont}
\XeTeXcharclass `\– 4
\XeTeXcharclass `\— 4
\XeTeXinterchartoks 255 0 = {\normalfont}
\XeTeXinterchartoks 0 255 = {\normalfont}
\XeTeXinterchartoks 255 4 = {\tgb}
\XeTeXinterchartoks 4 255 = {\normalfont}
\begin{document}
Try this — I mean does it really work from 2–3 times?
\end{document}
%%%%%%%%%%%%%%%%%%%%%
HTH.
United in adoration of Jesus,
fr. michael gilmary, mma
Most Holy Trinity Monastery
67 Dugway Road
Petersham, MA 01366
www.MaroniteMonks.org
More information about the XeTeX
mailing list