[XeTeX] fontspec example

William F. Adams wadams at atlis.com
Mon Nov 1 20:32:45 CET 2004


On Nov 1, 2004, at 2:01 PM, Michael Erlewine wrote:

> I'm trying to get a document to work with fontspec, but I'm afraid I  
> might have gotten the syntax wrong... some sample documents would be  
> helpful with your package, btw. But if you could check what I have  
> here really quick, it would be greatly appreciated.
>
> %&program=xelatex
> %&encoding=UTF-8 Unicode
>
> \documentclass[12pt]{report}
> \usepackage{fontspec}
>
> \setromanfont{Lucida Grande}
>
> \begin{document}
>
> \fontspec{Lucida Grande}
>
> blah blah blah
>
> \end{document}
>
> When I try to run this through, I get the following error:
>
> ! Font \testfont=Lucida Grande/B at 10.0pt not loadable: ATSUI font  
> not found.
> \zf at make@aat at feature@string ... at macname " at 10pt
> \edef \zf at this@featurename...
> l.10 \setromanfont{Lucida Grande}
>
> ?
>
> Is there a problem with the way I'm referencing the font?

That works perfectly for me here (10.3.5) xetex 0.88, fontspec 1.3 I  
think are the version #s here at work.

Here's a longer example (I'm probably going to switch the font to  
Hoefler Text --- see the original version in the TeX Showcase at  
http://www.tug.org/texshowcase or in my portfolio at  
http://members.aol.com/willadmas ). To make the graphics set the  
various ornaments and the alternate ampersand in TextEdit.app at  
500pts. and print them to .pdf files:

%&program=xelatex
%&encoding=UTF-8 Unicode

\documentclass[9pt,oneside,article]{memoir}

\usepackage{fontspec}

%% Memoir customize
%First, set up margins, text block and page size:
\setstocksize{306bp}{198bp}%{*}
\settrimmedsize{306bp}{198bp}{*}
%
%set up text block
\settypeblocksize{3in}{2in}{*}
%
%set up margins to match
\setlrmargins{*}{*}{1.5}
\setulmargins{*}{*}{2}
\checkandfixthelayout

%%% HEADERS & FOOTERS
\pagestyle{plain} % try also: empty , plain , headings , ruled , Ruled  
, companion

\frenchspacing
%
%set up fonts
\setromanfont[Ligatures={Common, Rare}, Numbers={OldStyle}]{Adobe  
Garamond Pro}
\newcommand{\definition}[2]{\selectfont\textsc{#1}—{#2}}
\newcommand{\alt}[1]{\fontspec[Swashes={WordInitial, WordFinal,  
LineFinal, Contextual}, Ligatures={Common, Rare}]{Adobe Garamond  
Pro}#1}
\newcommand{\altfinial}[1]{\fontspec[Alternate =0,  
Swashes={WordInitial, WordFinal, LineFinal, Contextual},  
Ligatures={Common, Rare}]{Adobe Garamond Pro}#1}
\newcommand{\tc}[1]{\fontspec[StyleOptions={TitlingCaps}]{Adobe  
Garamond Pro}\fontsize{29pt}{30pt}\selectfont #1}%
\newcommand{\lf}[1]{\fontspec[Numbers={Lining}]{Adobe Garamond Pro} #1}
\newcommand{\osf}[1]{\fontspec[Numbers={OldStyle}]{Adobe Garamond Pro}  
#1}

\newcommand{\xetexsort}[1]{\vbox to 12pt{\hbox{\lower17pt\hbox to  
12pt{\XeTeXpdffile "#1" width 12pt}}}}

\begin{document}
%Cover
\thispagestyle{empty}

\vspace*{4\baselineskip}

\begin{flushright}
\fontsize{10.5pt}{13pt}\selectfont%
\emph{One Typeface,}

\textsc{many fonts\thinspace}

\fontsize{9pt}{11pt}\selectfont%
\vspace*{2\baselineskip}

A Guide to Roman\thinspace

\emph{\& Italic Designs\thinspace}

\vspace*{6\baselineskip plus 1fill}


\fontsize{8pt}{10pt}\selectfont%
{\fontspec[Swashes={Contextual}]{Adobe Garamond Pro Italic}William  
Adams}
\end{flushright}

\clearpage

\parindent=0pt
\fontsize{8pt}{10.5pt}\selectfont%
First, a few corrections and additions:

\definition{colophon}{(1) The trade emblem or device
of a printer or publisher. (2) A page sometimes found at the
end of a book, listing details pertaining
to production of the book and/or the
printer’s imprint.}

\definition{cross stroke}{horizontal stroke.}

\definition{etaoin shrdlu}{A typographer’s sign to
indicate a mistake. Originally the first
line of a Linotype keyboard (which was
arranged by letter frequency) these keys
would be struck in the event of an error
in setting the line to fill it out so that it
might be cast and discarded.}

\definition{gutter}{in binding, the blank space where
two pages meet. Also, the blank space
between columns of type.}
\vfill

{©} 1997 William F. Adams\hfill

\break
\definition{margin}{the unprinted area around the
edges of a page. The margins as
designated in book specifications refer
to the remaining margins after the book
has been trimmed.}

\definition{small capitals}{capitals redrawn and sized
to match the proportions of lower-case
letters.  Usually the same height as
the x-height, or only slightly taller. A full-size
capital shrunk to this size is too thin
and light. Used for abbreviations within
text, sub-titles \textsc{\&}\,c.}

\definition{typography}{the art or craft of setting type
to improve understanding of the text.}

\quad ref. Rauri McLean,

\quad\quad\emph{Thames \& Hudson Manual of Typography},

\quad Robert Bringhurst,

\quad\quad\emph{The Elements of Typographic Style}.

\vfill

{Corrections courtesy Mac McGrew}

\quad \& Dr.~Richard McClintock

\break
\parskip=0pt
Originally, a typeface design was a thing
unto itself, with texts being set in
roman, or italic (or Fraktur, Rotunda
or Schwabacher), but never mixing either.
Italics originally used upright capitals however,
which provided a useful contrast at
need. In the 16{\fontspec[VerticalPosition={Superior}]{Adobe Garamond  
Pro}th} century, typographers
began using italics in roman texts for
emphasis, or to pick out foreign words, a
practice which continues to this day,
despite certain efforts to the contrary.

\parindent=1em

Other languages, naturally, have other
conventions, German being notable for
having two separate fonts as well, Fraktur,
literally \emph{broken script}, and Schwabacher,
\emph{rounded script}, which were used to good effect in older
texts to differentiate language usage.
A single typeface family (as opposed to
superfamily, such as Lucida or Stone)
may contain the following:

\break

{\leftskip = 6pt
\centerline {\tc TITLING}
\centerline {\tc \kern3pt CAPITALS}
{\fontsize{8pt}{12pt}\selectfont\obeylines
ROMAN CAPITALS
\quad \& LINING FIGURES {\lf 0123456789}
\textsc{roman small capitals}
roman lowercase letters
\quad \textsc{\&} old-style figures {\osf 0123456789}
{alternat{\altfinial e} roma{\altfinial n} characters}
\emph{SLOPED/ITALIC CAPITALS}
\quad  \smash{\vbox to 8.5pt{\hbox{\lower18pt\hbox to  
13pt{\XeTeXpdffile "AdobeGaramondAlternateAmpersand.pdf" width  
14pt}}}}\emph{Lining Figures} \emph{\lf 0123456789}
\emph{\alt Alternate Swash Characters}
\emph{italic lowercase letters}\enlargethispage{36pt}
\quad \emph{\&} \emph{italic old-style figures {\osf 0123456789}}
\quad \quad \textsc{\&} ornaments \vbox to  
9pt{\hbox{\xetexsort{AdobeGaramondOrnament1.pdf}\xetexsort{AdobeGaramond 
Ornament2.pdf}\xetexsort{AdobeGaramondOrnament3.pdf}}}
\vskip 
-12pt\hbox{\hspace*{13pt}\xetexsort{AdobeGaramondOrnament2.pdf}\xetexsor 
t{AdobeGaramondOrnament2.pdf}\xetexsort{AdobeGaramondOrnament2.pdf}\xete 
xsort{AdobeGaramondOrnament2.pdf}\xetexsort{AdobeGaramondOrnament2.pdf}\ 
xetexsort{AdobeGaramondOrnament2.pdf}\xetexsort{AdobeGaramondOrnament2.p 
df}\xetexsort{AdobeGaramondOrnament2.pdf}\xetexsort{AdobeGaramondOrnamen 
t2.pdf}\xetexsort{AdobeGaramondOrnament2.pdf}}}}

\break

Some typefaces will also have italic
small capitals, and in certain instances, an
obliqued or slanted roman as well as a true italic.
This latter convention is most
appropriate to fonts intended for setting
mathematics, but is all-too often
done in ignorance of the true nature of italic.
It bears noting that
an italic is not such simply because of its
slant, but because of its structure, which is
derived from handwriting.

Shown above, but not specifically
referenced, were ligatures. Most roman type
designs have \emph{f}~s which kern, or hang over
into the boundaries of the following character.
Normally, this is not a difficulty, but
some collisions do occur, hence, the
ligatures ff , fi , fl , ffi and ffl. Non-kerning
\emph{f}~s do exist, with Linotype being noted (or
notorious) for making them, their rationale
being that it facilitates letterspacing
lowercase text.

%\clearpage

Other ligatures include the ampersand, {\alt \&}
a ligature of the Latin word for and, \emph{et}), the
German double-s, \emph{eszett}, or sharp-s, ß,
which grew out of the long-s which was
used in the middle of words, and the purely
decorative ct and \emph{st} ligatures,
hold\-overs from Chancery calligraphy.

A typeface will also include a number of
characters which are not intuitively available
from a typewriter keyboard. As any good
style manual will indicate
%(e. g. \emph{The Chicago Manual of Style} prior to the 13{\alt th}  
edition)
these must be used. Two
hyphens do not make an em-dash—nor is
a single hyphen suitable to stand in for an
en-dash. Most applications will automatically
place apostrophes and quotation
marks (but be certain to use an apostrophe
to indicate omission \emph{’struth}) but few will
correctly use prime marks (i.e. ´\,˝\/)
to indicate
units of measure.

Similarly, the
sign,
×%
, not an
\emph{x} should be used,
when indicating dimensions, or
multiplication. Typically, fractions in text should be set using the  
appropriate Unicode character or built
using a solidus and superscript and subscript
numbers from an expert font
(e.g.
¼, ½ and ¾),
the use of lining figures
separated by a slash (“shilling” fractions) is better reserved for use  
in mathematics, or special text settings where legibility is more  
needed than \mbox{readability.}

\begin{sloppypar}%
Two recent font technologies have attempted to address the issues of a  
more appropriate, less-limited font format:
Apple’s QuickDraw/\textsc{gx} and Adobe/Micro\-soft’s
OpenType. Apple’s effort is to be revived
in their nascent Mac~OS~X as \textsc{aat} (Apple Advanced Typography)  
in its Latin-alphabet oriented incarnation (\textsc{atsui} (Apple  
Typographic System for
Unicode Information) in the more global version), while Microsoft’s  
attempt
seems typical of work produced by committee. OpenType is notable
however, for having enlisted the aid of
Prof.~Hermann Zapf in creating a new
version of Palatino to be distributed as the
first OpenType font.
\end{sloppypar}


\end{document}


-- 
William Adams, publishing specialist
voice - 717-731-6707 | Fax - 717-731-6708
www.atlis.com



More information about the XeTeX mailing list