# Smallcaps don't work if fontspec's microtype is used in luaLatex

This could be a duplicate question of this one - but I'd say the problem there is still not solved.

Consider the following example:

\documentclass[a4paper,12pt]{article}

\usepackage{fontspec}
\usepackage{blindtext}
\pdfprotrudechars=2
\newfontfeature{Microtype}{protrusion=default;expansion=default}%
\directlua{fonts.protrusions.setups.default.factor=.5}

%\setmainfont[Microtype]{Latin Modern Roman}

\begin{document}

\textsc{Hello World!}
\Blindtext

\end{document}


Hello World! is in smallcaps as desired, but microtype is clearly not working properly. For comparison, if one includes \setmainfont[Microtype]{Latin Modern Roman}:

microtype is working like a charm, but the smallcaps are not. Loading the microtype package doesn't seem to be a good option?

# What to do to make both, microtype and smallcaps working?

• Why is loading microtype not a choice? – egreg Apr 6 '15 at 21:13
• @egreg I read in various questions/answers that it is a massive package which slows down lualatex quite bit (e.g. mentioned in the comments to this question). And it is actually obsolete, as fontspec offers all features. If I have to decide between not using smallcaps or the microtype package, I may rather forgo the smallcaps. I thought that I maybe just made a mistake loading the font correctly? – thewaywewalk Apr 6 '15 at 21:37
• I also don't get small caps with \setmainfont{Latin Modern Roman} alone, so it doesn't have anything to do with microtypography. But all is fine when I explicitly specify the small caps font: \setmainfont[SmallCapsFont={Latin Modern Roman Caps}]{Latin Modern Roman}. As for microtype vs. fontspec/luaotfload, see this answer. – Robert Apr 7 '15 at 3:45
• @Robert Sounds promising, unfortunately I can't try it out right now. Maybe you want to write it as an answer? Is there also a command to activate fontspec's microtype and keep the font completely at default? something like \setmainfont[microtype]? \setdefaultfontfeature{microtype} does not work. – thewaywewalk Apr 7 '15 at 7:59
• @Robert And regarding your link: Do you think \usepackage{microtype} will still look better than fontspec's Microtype even though I included these additional settings provided by the other answer? (I can barely see a difference, but will have a look at again) And would you agree that the \usepackage{microtype} will slow down lualatex? (I experience that.) – thewaywewalk Apr 7 '15 at 8:12

As pointed out by Robert in the comments, the problem has nothing to do with Microtype.

But by activating Microtype or any other font feature by

\setmainfont[Microtype]{Latin Modern Roman}


the default font settings get overwritten. Fonts which have a special subfont for smallcaps may not work afterwards.

By reinitializing the smallcaps subfont it will work again:

\setmainfont[Microtype,
SmallCapsFont = {Latin Modern Roman Caps},
]{Latin Modern Roman}

• Then, with LuaTeX is it better to use microtype or just rely on fontspec? – skan Nov 20 '16 at 19:58
• I guess that depends on the font itself. I can't tell for sure, please ask a new question. – thewaywewalk Nov 20 '16 at 21:36