# [OS X TeX] Font cache problems with XeLaTeX under Snow Leopard

Jonathan Kew jonathan at jfkew.plus.com
Sat Sep 26 06:00:34 EDT 2009

On 25 Sep 2009, at 16:30, J. McKenzie Alexander wrote:

> Hello there,
>
> After upgrading to Snow Leopard, I'm encountering what appear to be
> problems with the Mac OS X font cache. At least I think that's what
> the problem is, since I've never seen this behaviour before.
>
> Consider the following minimal sample file, which must be run
> through XeLaTeX:
>
> 	\documentclass[11pt,a4paper]{article}
> 	\usepackage[]{fontspec}
> 	\defaultfontfeatures{Mapping=tex-text}
> 	\setmainfont{Book Antiqua}
>
> 	\begin{document}
> 	This should appear in normal size.
>
> 	{\fontspec[SizeFeatures={Size={32}}]{Book Antiqua}{This should be
> big.}}
> 	\end{document}
>
> When I run that through XeLaTeX, the line which says "This should be
> big." appears at the same size as the previous line.  However, if I
> edit the \fontspec command so that it says
>
> 	{\fontspec[SizeFeatures={Size={32}}]{Garamond}{This should be big.}}
>
> instead, the second line appears big, as it should.
>
> I think this has to do with a corrupted font cache because I *was*
> actually getting the right output earlier today, but then all of a
> sudden it stopped working. In addition, aside from the size change
> not occurring, the \emph and \textbf commands stopped working for
> some fonts.
>
> Any suggestions on how to solve this problem would be most
> appreciated!

As Peter Dyballa pointed out, this is not the way to change font

> 	\begin{document}
> 	This should appear in normal size.
>
> 	{\fontsize{32pt}{40pt}\selectfont This should be big.}
> 	\end{document}

if all you want to do is change the size.

I think the fact that your \fontspec command happens to cause a size
change is an unexpected side-effect, perhaps even a bug. Re-read the
explanation of SizeFeatures in the fontspec documentation, and
consider what you'd expect to happen if you had given a more complex
example such as

\fontspec[SizeFeatures={{Size={-10},Font=Garamond},
{Size={10-19},Font=Times},{Size={20-},Font=Arial}}]{Book Antiqua}

What size would you expect this to select? The answer (I think) is
that it shouldn't change the current font size at all; it simply
selects Book Antiqua at the current size .... except that it overrides
this with alternative fonts at various sizes, so you won't really get
Book Antiqua at all! But it does not (or should not) itself change the
font size, it only reconfigures the font *properties* in a size-
dependent way.

Now, if you're seeing a change in behavior between Leopard and Snow
Leopard, with the exact same versions of xetex and fontspec, that is
still a little worrying. Do you have the recent xdvipdfmx update
(v0.7.8)? What format are the fonts you're using: .ttf, .ttc, .otf,....?

JK