[XeTeX] An OTF feature problem...
Stephen Moye
stephenmoye at mac.com
Sat May 28 13:24:56 CEST 2005
I am writing a series of macros that specialize in the creation of type specimens. I have begun on some using XeTeX, but have come up against a problem. When I specify a feature such as +onum the width of the string and the size of the font are incorrectly calculated. Am I doing something wrong? Thanks for any help.
Here is the plain TeX code showing the problem:
--------------------------------------------
%!TEX TS-program = xetex
%% These macros produce samples of text
%% using OTF fonts that have optical variations
%% Part of the ongoing TypeSpec project
\newdimen\dspsize
\newcount\divisor
\newcount\scratch
\newcount\finsize
\nopagenumbers
%\raggedbottom
\parindent0pt
\def\ABC{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
\def\abc{abcdefghijklmnopqrstuvwxyz}%
\def\fhabc{abcdefghijklm}
\def\lhabc{nopqrstuvwxyz}
\def\bigsamp{AGHeg12?!\&¶89pyQMT}
\def\subheadsamp{ABCDEFGHIJKLMeg12345\&67890pyNOPQRSTUVWXYZ}
\def\textsamp{\fhabc12345?!\ABC67890\&\lhabc}
\def\captsamp{Quick wafting zephyrs vex bold Jim.
Sphinx of black quartz, judge my vow.
The five boxing wizards jump quickly.
Pack my box with five dozen liquor jugs.}
%% Given the font and the width to be filled
%% find the scaling necessary to sale the
%% font to fit the text to the width
\def\findit{%
\setbox0=\hbox{\dsp\fittext}%
\dspsize=\hsize
\finsize=\dspsize
\divisor=\wd0
\divide\finsize by \divisor
\dspsize=\finsize pt
\divide\dspsize10
\divide\finsize10}%
\def\makeline#1#2{%
\def\fittext{#1}%
\def\testfont{#2}%
\font\dsp="\testfont/S=14" at .1pt%
\findit
\font\dsp="\testfont/S=\number\finsize" at .1pt%
\findit
\font\dsp="\testfont/S=\number\finsize" at .1pt%
\findit
\message{***\the\finsize:\the\dspsize***}%
\font\fitit="\testfont/S=\number\finsize" at \dspsize
%% The following five lines are optional
%% and can be commented out.
%% This conforms to Adobe's classification
%% of size variants.
\noindent\rm\testfont,
\ifnum\finsize>23 Display%
\else\ifnum\finsize>15 Subhead%
\else\ifnum\finsize>9 Text%
\else Caption\fi\fi\fi,\ \the\dspsize\smallskip
\line{\hss\fitit\fittext\hss}}%
\def\makesample#1{\vbox{%
\makeline{\bigsamp}{#1}%
\medskip
\makeline{\subheadsamp}{#1}%
\medskip
\makeline{\textsamp}{#1}%
\medskip
\makeline{\captsamp}{#1}}}%
%%%%%%%%%%%%%%%%
\makesample{Brioso Pro}
\vskip.5in
\makesample{Brioso Pro:+onum}
\bye
More information about the XeTeX
mailing list