<br><div class="gmail_quote">On Fri, Mar 4, 2011 at 9:18 AM, William Adams <span dir="ltr"><<a href="mailto:will.adams@frycomm.com">will.adams@frycomm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mar 3, 2011, at 4:07 PM, Peter Davis wrote:<br><br></div><div class="im">
> 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.)<br>

<br>
</div>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.<br>
</blockquote><div><br></div><div>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</div>
<div><br></div><div><div>! Undefined control sequence.</div><div>l.40 \MyriadZPro</div></div><div><br></div><div>Sample tex:</div><div><br></div><div><div>\documentclass[letterpaper]{article}</div><div>\usepackage[landscape]{geometry}</div>
<div>\usepackage{fontspec}</div><div>\usepackage{graphicx}</div><div>\usepackage{xcolor}</div><div>\usepackage{setspace}</div><div>\usepackage{grffile}</div><div>\usepackage[absolute]{textpos}</div><div>\usepackage{soul}</div>
<div>\setlength{\TPHorizModule}{1bp}</div><div>\setlength{\TPVertModule}{\TPHorizModule}</div><div>\setlength{\parindent}{0pt}</div><div>\setlength{\unitlength}{1bp}</div><div>\pagestyle{empty}</div><div>\setlength{\topmargin}{18.000000bp}</div>
<div>\setlength{\oddsidemargin}{18.000000bp}</div><div>\setlength{\textwidth}{9.000000bp}</div><div>\setlength{\textheight}{4.500000bp}</div><div>\begin{document}</div><div><br></div><div>\setlength{\topmargin}{18.000000bp}</div>
<div>\setlength{\oddsidemargin}{18.000000bp}</div><div>\setlength{\textwidth}{9.000000bp}</div><div>\setlength{\textheight}{4.500000bp}</div><div><br></div><div>\raggedright</div><div><br></div><div>\begin{textblock}{67.500000}(144.000000,76.978080)</div>
<div><br></div><div>\newfontfamily\MyriadZPro{Myriad Pro}\MyriadZPro </div><div><br></div><div>{\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}</div>
<div><br></div><div>\end{textblock}</div><div><br></div><div>\raggedright</div><div><br></div><div>\begin{textblock}{103.124880}(144.000000,114.978240)</div><div><br></div><div>\MyriadZPro </div><div><br></div><div>{\par \fontsize{7.000000}{11.000000}\selectfont{}\color[cmyk]{1.000000,0.850000,0.000000,<a href="mailto:0.130000%7D%7Bone@one.com">0.130000}{one@one.com</a>}\null\par}</div>
<div><br></div><div>\end{textblock}</div><div><br></div><div>\end{document}</div></div><div><br></div><div><br></div></div><br>-- <br><span style="font-family:arial, sans-serif;border-collapse:collapse">----<div>The Tech Curmudgeon</div>
<div><a href="http://www.techcurmudgeon.com/" style="color:rgb(17, 65, 112)" target="_blank">http://www.techcurmudgeon.com</a></div><div style="font-size:10.8333px"><br></div></span><br>