[XeTeX] Accents, xunicode and \b

Philiрp Rеichmuth phil.ipp.reich.muth at gmail.com
Thu Jan 7 17:45:26 CET 2010


Hi,

I need to typeset a bit of text that contains accented Latin letters that
don't have glyphs in my font. I'm trying to get some of the "old-style"
accent commands to work, like \d \v \b etc., and some are working fine, but
with others I'm struggling, in particular \b. 

Here's a (not so) minimal example file:

%---------------
\documentclass[11pt,a4paper]{article}
\makeatletter
   \def\changefencoding#1{\def\cf at encoding{#1}}
\makeatother

\let\realaccent\v   
   \DeclareTextAccent{\v}{UX}{"02C7}
\let\v\realaccent

\let\realaccent\b   
   % the following gives a vertically misplaced glyph
   \DeclareTextAccent{\b}{OT1}{"02CD}
   %% % the following gives "there is no ^^I/^^V in font"
   %% % no matter what glyph is selected
   %% \DeclareTextAccent{\b}{UX}{"02CD} % missing ^^I
   %% \DeclareTextAccent{\b}{UX}{"02C9} % missing ^^V
   \expandafter\let\csname UX\string\b\expandafter%
\endcsname\csname OT1\string\b\endcsname
\let\b\realaccent   

\let\realaccent\d   
   \DeclareTextAccent{\d}{UX}{"002E}
   \expandafter\let\csname UX\string\d\expandafter%
\endcsname\csname OT1\string\d\endcsname
\let\d\realaccent   

\usepackage{fontspec}
\usepackage{xunicode}
%\setromanfont[Mapping=tex-text]{Garamond Premier Pro}
\setromanfont[Mapping=tex-text]{Times New Roman}
%\setromanfont[Mapping=tex-text]{Gentium}

\catcode `ṭ = \active
\catcode `ṯ = \active
\catcode `ǧ = \active

\DeclareRobustCommand{\tdotu}{{\changefencoding{UX}\d{t}}}
\DeclareRobustCommand{\tbaru}{{\changefencoding{UX}\b{t}}}
\DeclareRobustCommand{\gcaron}{{\changefencoding{UX}\v{g}}}

\def\activatetdotu{\catcode `ṭ = \active\let ṭ\tdotu}
\def\activatetbaru{\catcode `ṯ = \active\let ṯ\tbaru}
\def\activategcaron{\catcode `ǧ = \active\let ǧ\gcaron}

\catcode `ṭ = 12
\catcode `ṯ = 12
\catcode `ǧ = 12

\begin{document}

{\tracingall%
ǧ ṭ ṯ}

{\tracingall%
\changefencoding{UX}%
\v{g} \d{t} \b{t}}

{\tracingall%
\activatetdotu \activatetbaru \activategcaron%
ǧ ṭ ṯ}

\end{document}
%---------------

As you can see, I'm trying to work around xunicode's precomposition
mechanism by declaring UX font encoding, then getting TeX to compose
accents the old OT1 way. However, with \b I keep getting errors about
missing glyphs, depending on the font encoding I specify for my accent.
(Maybe not surprising? But then the macron character is there in the font.)
If I specify OT1 encoding for the accent, I get the correct character, but
vertically displaced.

I guess I'm just being stupid. I'm not a good TeX programmer. I find it
extremely cumbersome to wrap my head around, as if the natural way to
program it was a pile of punchcards. But then again others are quite good
at it, so it's probably just me.

Philipp



More information about the XeTeX mailing list