[XeTeX] Use of Apple Symbols font in XeLaTeX

Bruno Voisin bvoisin at mac.com
Wed Sep 15 18:35:50 CEST 2004


Hello,

I've been trying to use characters from Apple Symbols in XeLaTeX (to 
complement and replace those already in AMS fonts), by mimicking the 
way AMS symbols are used in amsfonts.sty and amssymb.sty (and trying to 
digest all the information in fntguide.dvi!):

- define a corresponding font family:

	\DeclareFontFamily{U}{appsym}{}
	\DeclareFontShape{U}{appsym}{m}{n}{<-> "Apple\space Symbols"}{}

- make it a symbol font, to be used in math mode:

	\DeclareSymbolFont{AppleSymbols}{U}{appsym}{m}{n}

- declare symbols from this font:

	\DeclareMathSymbol{\applehighplus}    {\mathord}{AppleSymbols}{"253C}
	\DeclareMathSymbol{\appleblacksquare} {\mathord}{AppleSymbols}{"25A0}
	\DeclareMathSymbol{\applewhitesquare} {\mathord}{AppleSymbols}{"25A1}
	\DeclareMathSymbol{\appleblackdiamond}{\mathord}{AppleSymbols}{"25C6}
	\DeclareMathSymbol{\applewhitediamond}{\mathord}{AppleSymbols}{"25C7}
	\DeclareMathSymbol{\applewhitecircle} {\mathord}{AppleSymbols}{"25CB}
	\DeclareMathSymbol{\appleblackcircle} {\mathord}{AppleSymbols}{"25CF}

- call the symbols in math mode, for example $\applehighplus$.

Alas this does not work, and I only get characters from the main text 
font instead of Apple symbols. For example, squares, diamonds, circles 
and a high "plus" sign should appear inside the parentheses in the 
following:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Image 1.pdf
Type: application/pdf
Size: 34025 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20040915/60682342/Image1-0001.pdf
-------------- next part --------------


The problem is (kind of) solved by defining a new text font command:

	\DeclareTextFontCommand{\applesym}
	  {\normalfont\fontencoding{U}\fontfamily{appsym}\selectfont}

and taking the symbols from this font, to be used in text mode instead 
of math mode:

	\DeclareRobustCommand{\applehighplus}    {\applesym{\char"253C}}
	\DeclareRobustCommand{\appleblacksquare} {\applesym{\char"25A0}}
	\DeclareRobustCommand{\applewhitesquare} {\applesym{\char"25A1}}
	\DeclareRobustCommand{\appleblackdiamond}{\applesym{\char"25C6}}
	\DeclareRobustCommand{\applewhitediamond}{\applesym{\char"25C7}}
	\DeclareRobustCommand{\applewhitecircle} {\applesym{\char"25CB}}
	\DeclareRobustCommand{\appleblackcircle} {\applesym{\char"25CF}}

Then I get what I expected:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Image 2.pdf
Type: application/pdf
Size: 34106 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20040915/60682342/Image2-0001.pdf
-------------- next part --------------


I probably have missed something obvious, but I can't figure it out. Is 
there a LaTeX expert around there who would know what's happening here?

I suspect the LaTeX definition of \DeclareMathSymbol is incompatible 
with Unicode, as it seems to first turn the code point (as 253C) into a 
counter, then apply \hexnumber@ to this counter to transform it into 
some hexadecimal quantity (if I understood correctly).

BTW, there seems to be two more pitfalls here:

- LaTeX refuses "253c and insists on "253C

- replacing \char"253C by ^^^^253C produces an error:

	! Text line contains an invalid character.
	l.109 ...Command{\applehighplus}    {\applesym{^^^
	                                                  ^253C}}

(A puzzled) Bruno Voisin


More information about the XeTeX mailing list