# fontspec FakeBold affects text in graphics

In the minimal example below (compiled with XeLaTeX in MacTex), the FakeBold option in package fontspec works as intended for the main text, using Times to represent the non-default font I am using in my actual document. However, FakeBold also thickens the Helvetica font used in the included graphic plot.pdf (available from here) although the Helvetica font is not embedded in that PDF.

Furthermore, the Helvetica font is thickened to the same degree regardless of the FakeBold setting, i.e. FakeBold=0.5, FakeBold=1, FakeBold=3 all produce the same amount of thickening in the Helvetica font. However, if I embed the Helvetica into plot.pdf, then FakeBold works nicely within the graphic.

There are two issues here:

1. FakeBold was invoked only for Times but it affected the Helvetica in the graphic.

2. In the case where Helvetica hadn't been embedded in the graphic, fontspec apparently detected the presence of some kind of text in the graphic and applied a thickening that was insensitive to the setting of FakeBold for the main text.

I tried to prevent FakeBold from thickening the text in the graphic by setting FakeBold=0 just before the graphic but to no effect. I also tried \setsansfont[FakeBold=0]{Helvetica} but of course this had no effect because the text within the graphic wasn't being identified as Helvetica. I have tried other fonts for the main text and within the graphic and the same behaviour arises. There does not appear to be any mention of this in the fontspec documentation, and I am incapable of getting into its source code to look for the cause.

I would be very grateful if someone could hint at how I could overcome this problem. I apologise if it's something blindingly obvious.

\documentclass{minimal}

\usepackage{graphicx}

\usepackage{fontspec}
\setmainfont[FakeBold=1]{Times}

\begin{document}

Test test test

\includegraphics{plot.pdf}

\end{document}

-
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Werner Mar 8 '12 at 0:30
@Werner: thanks for the welcome and the correction! –  Yangchen Lin Mar 8 '12 at 11:15

I'm not quite sure but the last sentence of the second paragraph sounds as if problem goes away if you embed the font in the plot.pdf. Then imho this is the correct way to solve the problem. One should always embed all fonts in a pdf and not rely on external fonts on the system.

But if for some reason you can't embed the font. You can also avoid the problem by selecting and using a font without FakeBold before the graphic. A simple dot is enough:

\documentclass{minimal}

\usepackage{graphicx}

\usepackage{fontspec}
\setmainfont[FakeBold=1]{Times New Roman}

\begin{document}

Test test test

\begingroup
\fontspec{Times New Roman}{\color{white}.}
\includegraphics{plot.pdf}
\endgroup

\end{document}

-
Would a \vphantom{.} suffice? –  egreg Mar 8 '12 at 10:02
No. But you can move the text "outside view" e.g. with \raisebox{30cm}[0pt][0pt]{\makebox[0pt]{blub}}. Probably someone who knows the pdf-specification could also insert some pdf-specials to reset the embolden. –  Ulrike Fischer Mar 8 '12 at 10:09
@Ulrike: apologies, I realize that the problem remains when I embed the font and use my original code. I was fooled previously because, with embedding, FakeBold emboldens the graphic text to a constant but different degree than the unembedded case. Your code above does exactly what I want and, unlike the workarounds I tried, can be used within the figure environment and does not break other things. Thanks very much for solving the problem. –  Yangchen Lin Mar 8 '12 at 11:18