# [texhax] Throughput

Peter Davis pfd at pfdstudio.com
Fri Mar 4 19:20:30 CET 2011

On Fri, Mar 4, 2011 at 9:18 AM, William Adams <will.adams at frycomm.com>wrote:

> On Mar 3, 2011, at 4:07 PM, Peter Davis wrote:
>
> > Also, William Adams mentioned that calling \fontspec can be very
> expensive, and I'm definitely doing that over and over again.  I guess
> there's a way to cache the font settings to eliminate a lot of that overhead
> when using the same font repeatedly.  (Unfortunately, when processing the
> XML, I have no way of knowing which is the 'normal' font for the document.)
>
> All of this is documented in the Fontspec documentation --- you want to
> make one font instance for each font used (say in the pre-amble) then make
> use of said font instances in the body of the document. It would probably be
> okay in terms of processing time to have a single package file which
> instantiated instances for _all_ fonts you are planning on using, then load
> that package file.
>

I think you're talking about the \newfontfamily and \newfontface commands,
right?  Does these *have* to appear in the preamble, or can I define a font
family anywhere in the document?  I've just tried the code below, and I get

! Undefined control sequence.

Sample tex:

\documentclass[letterpaper]{article}
\usepackage[landscape]{geometry}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{grffile}
\usepackage[absolute]{textpos}
\usepackage{soul}
\setlength{\TPHorizModule}{1bp}
\setlength{\TPVertModule}{\TPHorizModule}
\setlength{\parindent}{0pt}
\setlength{\unitlength}{1bp}
\pagestyle{empty}
\setlength{\topmargin}{18.000000bp}
\setlength{\oddsidemargin}{18.000000bp}
\setlength{\textwidth}{9.000000bp}
\setlength{\textheight}{4.500000bp}
\begin{document}

\setlength{\topmargin}{18.000000bp}
\setlength{\oddsidemargin}{18.000000bp}
\setlength{\textwidth}{9.000000bp}
\setlength{\textheight}{4.500000bp}

\raggedright

\begin{textblock}{67.500000}(144.000000,76.978080)

{\par
\fontsize{7.000000}{9.000000}\selectfont{}\color[cmyk]{1.000000,0.850000,0.000000,0.130000}{248.358.4420}{123.456.7891}{direct}{123.456.7892}{cell}{248.358.1969}{fax}\null\par}

\end{textblock}

\raggedright

\begin{textblock}{103.124880}(144.000000,114.978240)

{\par
\fontsize{7.000000}{11.000000}\selectfont{}\color[cmyk]{1.000000,0.850000,0.000000,
0.130000}{one at one.com}\null\par}

\end{textblock}

\end{document}

--
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110304/ac6895d6/attachment.html>