Fun with XeTeX and Fonts

XeTeX is an improvement upon the famous typesetting system TeX. XeTeX provides Unicode support and native support for standard fonts.

Unfortunately, XeTeX is fairly poorly documented. Here are some interesting findings I have come across (some particular to XeTeX, others just general ideas for TeX and LaTeX).

Ornament Symbols

I wanted to access the various ornament symbols in the Zapfino font. The standard font selection package, fontspec.sty, lacks support for such ornaments. So, to get support for ornaments, you must first teach the package about them.

This is done by including the following line in the preamble:

\newAATfeature{Ornaments}{Pi}{16}{2}

Then, to use ornaments, include Ornaments=Pi in the appropriate \fontspec or similar declaration.

The numbers 16 and 2 are Apple’s AAT codes for the ornaments (see the C structure at the bottom of that page).

For example, as requested:

\documentclass[11pt]{article}
\usepackage{xunicode}
\usepackage{fontspec}
\newcommand\ScriptFont{Zapfino}
\newAATfeature{Ornaments}{Pi}{16}{2}
\begin{document}
\fontspec[Ornaments=Pi]{\ScriptFont}
ABCDEFG
\end{document}

Font Variants

Font variants are zero-indexed, so the first variant of a letter is Variant=0.

Initial Capitals and Kerning

If you add a kern after an italicized letter, then the extra italics spacing will disappear.

Comments 4

  • Hi, could you please post a minimal working example of this?
    Thanks!

  • I’m getting this now:

    Package fontspec Warning: ‘Ornaments=Pi’ feature not supported for ICU font ‘”Zapfino/ICU” at 10.95pt’ on input line 7.

    I’m using XeLaTex on Ubuntu. Are you using Mac OS X?

  • Thanks for your help!
    This is how I fixed it:

    \documentclass[11pt]{article}
    \usepackage{xunicode}
    \usepackage{fontspec}
    \newcommand\ScriptFont{Zapfino Extra LT Pro}
    \newICUfeature{Ornaments}{Pi}{+ornm}
    \begin{document}
    \fontspec[Ornaments=Pi]{\ScriptFont}
    ABCDEFG
    \end{document}

  • It’s hard to find your blog in google. I found it on 11 spot,
    you should build quality backlinks , it will help you to increase traffic.
    I know how to help you, just type in google – k2 seo tips