9

I have been trying to fake small caps which are not available in Myriad Pro. So I used the Scale and FakeBold options. Scaling is allright, but as you all know the glyphs slim out. To work against that I tried to "fatten" them somewhat.

The code below does not "fatten" the scaled characters when using lualatex (latest TeX-Live). Using xelatex (also latest TeX-Live) works fine.

I think its a bug.

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Heros}
\begin{document}
ABC {\fontspec[FakeBold=5,Scale=0.72]{TeX Gyre Heros} ABC} ABC
\end{document}

For demonstration the code above uses another fontwich actually supports small caps.

  • 1
    I can only confirm the behavior. – egreg Nov 9 '11 at 23:41
15

LuaTeX does not support emboldening, so FakeBold will not work. fontspec should issue a warning here.

It might be possible to implement emboldening in lua, say in luaotfload package, but I didn't investigate closely.

Here is a work around using pdf literals (which is essentially what XeTeX does behind the scenes).

\def\embolden#1#2{%
    \pdfliteral direct {2 Tr #1 w}%
     #2%
    \pdfliteral direct {0 Tr 0 w}%
}
ABC \embolden{0.5}{ABC} ABC
\bye

This even works with pdftex.

(Note, when you use Scale=0.72, the FakeBold will be 5*0.72, so you might want to use 0.36 instead of 0.5)


With the advent of LuaTeX 0.95.0 the \pdf... primitives have been moved to the unified \pdfextension interface. The above code does not work anymore and has to be modified to reflect these changes.

\def\embolden#1#2{%
    \pdfextension literal direct {2 Tr #1 w}%
     #2%
    \pdfextension literal direct {0 Tr 0 w}%
}
ABC \embolden{0.5}{ABC} ABC
\bye

Alternatively one could define \pdfliteral as devised in the LuaTeX manual:

\protected\def\pdfliteral{\pdfextension literal}
  • Works fine, twiddling with Scale and "enbolden" I get an fake "small caps" thats close enough to the real thing. – Michael Ewe Nov 10 '11 at 21:50
  • Hm when trying this I can easily twiddle up the "enbolden" factor up to very thick but I can not get it low enough. Even when I set it to 0.0 it comes out too black for me. Both in print and on screen it still looks like ink blobs to me. I suppose the technique used is not very compatible with my font... – jonalv Jul 25 '13 at 15:12
  • This is 4 yars old question..Lualatex supports fakeslant..does it support fakebold now? i tryied and with no succes..maybe my lualatex engine is too old? – Levan Shoshiashvili Dec 25 '15 at 23:00
  • 1
    @LevanShoshiashvili: Per Henri Menke’s comment here: tex.stackexchange.com/q/397480/75284 the fakebold in LuaTeX will come eventually, but not soon. – lblb Apr 20 '18 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.