[XeTeX] Using the Unicode prime character (Was re. Single glyphs from a font)
Joel C. Salomon
joelcsalomon at gmail.com
Fri Sep 11 18:01:12 CEST 2009
Back on Mon, Jun 15, 2009 at 3:44 PM, I wrote:
> Ross Moore wrote:
>> Some software uses the Unicode character directly, while
>> other software (such as TeX) has a character that is required
>> to be superscripted; e.g., as $...^\prime ...$.
>> With these it is not normal to use the oversized character by itself.
>> It is only included in the font for the convenience of encoding,
>> and when it might be needed at \Large (etc.) sizes.
>
> I look a look at the character set specimen for Cambria Math at
> <http://www.tiro.nu/Articles/Cambria/Cambria_Math_Basic_Spec_V1.pdf>,
> and near the bottom of Page 2 are what seem to be the large prime
> characters.
>
> I have no idea how to get at these glyphs—they do not seem to be in
> Unicode or in the font’s PUA—but if they can be used they might make a
> more natural match to TeX’s primes behavior.
I sat back down to work on my thesis again and promptly got distracted
by this issue. So I wrote to Ross Mills of Tiro Typeworks, describing
how TeX treats $x'$ (approximately) as $x^\prime$ and how that requires
a full-height \prime glyph.
Then I wrote:
> Adapting this to Cambria Math is a problem, since the U+2032 Prime
> glyph is already at the correct size and position and TeX's algorithm
> moves it out of place.
>
> The Cambria Math specimen sheet on your website has a set of -- what
> look to be -- full-height prime glyphs (page 2, just above the
> braces). But how can I access these glyphs? Do they have PUA codes?
> Are they forms of the Unicode glyphs accessible via OpenType features?
> Failing that, XeTeX can access glyphs by name; what is the glyph name
> within the font?
Ross responded (somewhat edited):
> It will be a bit of an issue if implementations of TeX don't interpret
> the MATH Table, or in this case the SSTY table (an OpenType table
> separate from the [math] table).
>
> The irony is, that in this case, the intended behaviour mimics that of
> TeX. The base Unicode characters are mapped via the [ssty] table to
> script alternates; this is the case with super/sub scripts as well as
> the primes, which are treated as superscripts.
>
> In this implementation (of a math font) there are 2 levels of [ssty]
> variants mapped for scripts, one for script level 1 at 77% and the
> secondary (script-script) at 60%.
>
> [ssty] variants are designed as effective optically-scaled versions,
> roughly equating to the scaling factor, which is one of the global
> constants defined in the [math] table. This scaling is a bit different
> from that of TeX defaults--but if you could access the [ssty] variants
> (there are two each of single prime, double, triple and quadruple) the
> scaling probably wouldn't be so different.
Well, this explains the anomalous results that I'd previously gotten.
(I defined \prime as U+2032. Noting that TeX interprets the command
$x'$ as $x^\prime$, I ran the command
$x'\prime$, $x\prime'$, $x\prime{}'$
with the result in the attached image "x prime.png".)
Seems a "raw" \prime uses the "plain" U+2032 glyph, which is positioned
and sized so that it looks good in, e.g, Notepad. The SSTY tables map
this to full-height versions suitable for scaling and positioning by the
superscript algorithm -- but the final position is slightly different
from the "raw" position, either by design or by mis-application of the
scaling factors.
To confirm that this is what is happening, try this test file:
--=-=-=
Content-Type: text/x-tex; charset=utf-8
Content-Disposition: inline; filename=primes.tex
Content-Transfer-Encoding: 8bit
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\documentclass{minimal}
\usepackage{fontspec, xunicode, xltxtra, unicode-math}
\setmainfont[Mapping=tex-text]{Cambria}
\setmathfont{Cambria Math}
\makeatletter
\let\UnicodeMathSymbol\um at mathsymbol@noparse
\UnicodeMathSymbol{"02032}{\prime}{\mathord}{prime}%
\let\prime ′
\makeatother
\begin{document}
$x'\prime$, $x\prime'$, $x\prime{}'$.\\
$x'''$, $x''\prime$, $x'\prime'$, $x'\prime\prime$;\\
$x\prime''$, $x\prime'\prime$, $x\prime\prime'$, $x\prime\prime\prime$.
\end{document}
--=-=-=
I believe we have the problem solved. Thanks for all the help.
—Joel Salomon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x prime.png
Type: image/png
Size: 5286 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20090911/47f5e7b3/attachment.png>
More information about the XeTeX
mailing list