[XeTeX] Fractions
Jonathan Kew
jonathan_kew at sil.org
Wed Mar 1 17:31:19 CET 2006
On 1 Mar 2006, at 1:55 pm, Carlo Strub wrote:
> Hi all,
> I have a problem with Fractions and fontspec. Whenever I use the
> option [Fractions=On] with the Opentype Font Adobe Caslon Pro all
> numbers and all dots, commata etc. move up. The simplest possible
> example for this bug is:
>
> \documentclass[12pt]{article}
> \usepackage{fontspec,xunicode}
>
> \renewcommand{\encodingdefault}{U}
>
> \setromanfont[Fractions=On]{Adobe Caslon Pro}
>
> \begin{document}
>
> Hello, I was born in 2005 on the 6th of the month.
>
> \end{document}
It is behaving correctly; this is how the OpenType feature is
designed. (IMO, it's not as convenient as Apple's approach to this
type of thing.)
Adobe's "fractions" feature will turn all glyphs that it considers
potential "numerator" glyphs into small, raised forms, until it
encounters a slash, and then it'll start turning them into small low
forms instead. But it doesn't look ahead to see whether a suitable
slash really is coming, when it first finds a digit.
The intention is that you will only apply such a feature to the
specific range of text that makes up the fraction; you aren't
expected to turn it on "globally". This contrasts with Apple's AAT
features, which are smarter about context.
So here's a sample which shows the OT Fraction feature in use (though
if you do much of this, you'll want to define some macros to make it
easier to enter... and perhaps use \newfontinstance to predeclare the
"fraction" version of the font, rather than re-evaluating the feature
string every time.
HTH,
JK
% - - - - - - - - - - - - - -
\documentclass[12pt]{article}
\usepackage{fontspec,xunicode}
\renewcommand{\encodingdefault}{U}
\setromanfont{Adobe Garamond Pro}
\begin{document}
Pi is roughly 3{\addfontfeature{Fractions=On}1/7}, or {\addfontfeature
{Fractions=On}355/113} to be slightly more accurate.
\end{document}
% - - - - - - - - - - - - - -
More information about the XeTeX
mailing list