[XeTeX] substitutions for missing or wrong glyphs

Fr. Michael Gilmary, mma frmichaelgilmary at maronitemonks.org
Thu Feb 3 23:29:34 CET 2011


On Feb 3 AD 2011, at 10:01 AM, Rik Kabel wrote:


> Well, it works fine for mono-font documents, or documents in which the
> substitution can be assured to always within the main font, but it  
> fails
> horribly in other cases. The OP indicated that she wants to work with
> several fonts.
>
> Consider what would happen if additionally the preamble defined a  
> Greek
> font, and an en- or em-dash appeared in the body within Greek text:  
> the
> text following the en- or em-dash would now be in the document's main
> font (defined by \normalfont).


This hadn't occurred to me, of course. But maybe the Greek range  
could be defined for the desired font and then included as a new  
class. Do you think that might work?




> Researching this, I saw that somebody asked (in 2007) if there is a  
> way
> to save and restore the current font. That was never answered. Perhaps
> it would be useful here. It wouldn't be completely foolproof as many
> character classes are defined, but saving the font on transitions  
> from 0
> and 255 to 4 (in this example), and restoring it on transitions  
> from 4,
> would go a long way towards addressing this.


Jonathan posted this code some time ago which I used for Syriac.  
Maybe it would be useful for your question:


%%%%%%%%%%%%%%%%%

\def\setclass#1#2{\def\theclass{#1}\def\charlist{#2}%
   \expandafter\dosetclass\charlist,\end}
\def\dosetclass#1,#2\end{%
   \def\test{#1}\def\charlist{#2}%
   \ifx\test\empty\let\next\finishsetclass
   \else \XeTeXcharclass "\test = \theclass
      \let\next\dosetclass \fi
   \expandafter\next\charlist,,\end}
\def\finishsetclass#1,,\end{}

%% code for Melthofonts = Syriac fonts (these are some of the Unicode  
position numbers for individual glyphs)

\setclass \V {0730,0731,0732,0733,0734,0735}
\setclass \V {0736,0737,0738,0739,073A,073B,073C}
\setclass \V {073D,073E,073F,0740,0741,0742,0743}
\setclass \V {0744,0745,0746,0747,0748}

%%%%%%%%%%%%%%%%%%%

Obviously, that might get very tedious. But it's just a suggestion ....

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