[XeTeX] fontspec v1.7

Bruno Voisin bvoisin at mac.com
Thu Jun 23 11:30:18 CEST 2005


Le 23 juin 05 à 03:06, Ross Moore a écrit :

> Note that the "correct" Unicode accent characters to use
> are the latter ones:  "0307  and  "0308 .
>
> However, the TeX syntax for  \mathaccent  doesn't accommodate
> hex-strings longer than 2 characters.
> So that's one change that Jonathan needs to make for XeTeX.

There were some indications in a thread last September "[XeTeX] Use  
of Apple Symbols font in XeLaTeX".

At one point I tried to redefine LaTeX's \DeclareMathAccent to  
accommodate 4-digits hex codepoints like "0307 and "0308. That's  
doable by using 4 counters (\count0\count2\count3\count4 say) instead  
of just 2 (\count0 \count2) for storing the digits.

In the definition of \DeclareMathAccent in latex.ltx, you need to  
replace

>       \count\z@=#4\relax
>       \count\tw@\count\z@
>       \divide\count\z@\sixt@@n
>       \count@\count\z@
>       \multiply\count@\sixt@@n
>       \advance\count\tw at -\count@

by, maybe,

>       \count0=#4\relax
> %
>       \count2=\count0
>       \divide\count0 by 4096
>       \count@=\count0
>       \multiply\count@ by 4096
>       \advance\count2 by -\count@
> %
>       \count3=\count2
>       \divide\count2 by 256
>       \count@=\count2
>       \multiply\count@ by 256
>       \advance\count3 by -\count@
> %
>       \count4=\count3
>       \divide\count3 by 16
>       \count@=\count3
>       \multiply\count@ by 16
>       \advance\count4 by -\count@

and then

>           \expandafter\set at mathaccent
>              \csname sym#3\endcsname#1#2%
>              {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%

by, maybe,

>           \expandafter\set at mathaccent
>              \csname sym#3\endcsname#1#2%
>              {\hexnumber@{\count0}\hexnumber@{\count2}%
>               \hexnumber@{\count3}\hexnumber@{\count4}}%

But that didn't work eventually, because TeX's \mathchar primitive  
accepts only 2-digits codepoints in XeTeX. The \char primitive has  
been extended in XeTeX to accept 4-digits codepoints, but not the  
\mathchar one. Omega, I think, did the extension and replaced  
\mathchar by \omathchar, but I've no idea whether their  
implementation can be useful for XeTeX.

What I ended up doing (not for accents, but for symbols) was using  
\char instead of \mathchar, combined with \text from amsmath. Ugly,  
but works:

> \DeclareFontFamily{U}{applesym}{}
> \DeclareFontShape{U}{applesym}{m}{n}{<-> "Apple\space Symbols"}{}
>
> % Doesn't work
>
> %\DeclareSymbolFont{applesymbols}{U}{applesym}{m}{n}
>
> %\DeclareMathSymbol{\appleblacksquare} {\mathord}{applesymbols}{"25A0}
> %\DeclareMathSymbol{\applewhitesquare} {\mathord}{applesymbols}{"0040}
> %\DeclareMathSymbol{\appleblackdiamond}{\mathord}{applesymbols}{"25C6}
> %\DeclareMathSymbol{\applewhitediamond}{\mathord}{applesymbols}{"25C7}
> %\DeclareMathSymbol{\applewhitecircle} {\mathord}{applesymbols}{"25CB}
> %\DeclareMathSymbol{\appleblackcircle} {\mathord}{applesymbols}{"25CF}
>
> % Works
>
> \DeclareTextFontCommand{\applesymbol}
>   {\normalfont\fontencoding{U}\fontfamily{applesym}\selectfont}
>
> \DeclareRobustCommand{\appleblacksquare} {\text{\applesymbol 
> {\char"25A0}}}
> \DeclareRobustCommand{\applewhitesquare} {\text{\applesymbol 
> {\char"25A1}}}
> \DeclareRobustCommand{\appleblackdiamond}{\text{\applesymbol 
> {\char"25C6}}}
> \DeclareRobustCommand{\applewhitediamond}{\text{\applesymbol 
> {\char"25C7}}}
> \DeclareRobustCommand{\applewhitecircle} {\text{\applesymbol 
> {\char"25CB}}}
> \DeclareRobustCommand{\appleblackcircle} {\text{\applesymbol 
> {\char"25CF}}}

Bruno



More information about the XeTeX mailing list