[Tex/LaTex] fontspec & microtype: fine tune OpenType fonts

fontspecmicrotypeopentype

I just began to try LuaTeX in order to make use of OpenType fonts. After loading fontspec I select such a font the usual way:

\setmainfont{Adobe Garamond Pro}

Now I wonder how I can fine tune the typesetting by the means of microtype, i.e. how I can set up protrusion rules for the selected font. The microtype manual only mentions fonts which adhere to Karl Berry's naming scheme:

\SetProtrusion
   { encoding = T1,
     family   = cmr }
   { A              = {50,50},
     \textquoteleft = {700, } }

My Question is: How does the way of using OT fonts with fontspec relate to these settings?

For starters I want to use the predefined settings for the Type1 version pad by the means of \DeclareMicrotypeAlias{<font name>}{<alias font>} but mt-pad.cfg won't get loaded with the following file:

\documentclass{scrartcl}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX,Numbers={OldStyle,Proportional}}
\setmainfont{Adobe Garamond Pro}
\usepackage{microtype}
\DeclareMicrotypeAlias{Adobe Garamond Pro}{pad}
\begin{document}
  Some Text.
\end{document}

EDIT: I just realized that LuaTeX uses EU2 as internal font enconding which renders the deaults in mt-pad.cfg useless. Nevertheless the question remains: What is the name of the font family I have to use in the microtype directives?

Best Answer

For OpenType fonts, you simply take the name you use when loading the font, in your case Adobe Garamond Pro. You could then use the file mt-pad.cfg as your template, by copying it to mt-AdobeGaramondPro.cfg (note, no spaces), and changing/adding the protrusion values:

\SetProtrusion
   [ name     = AdobeGaramondPro ]
   { encoding = {EU1,EU2}, % EU1 = xetex, EU2 = luatex
     family   = {Adobe Garamond Pro} }
   { ... }

The glyphs may either be specified as Unicode letters, or via the respective latex commands. The file test-microtype.tex (included in the package) may be of some help to check the protrusion values. Though it was originally meant for Type1 fonts (with their 256 glyphs), it can easily be extended.

To really get complete settings, it would also be advisable to define the set of character inheritance, as there are usually many more diacritical characters in an OpenType font that are not covered by the default inheritance rules. You could have a look at the provided configuration files for OpenType fonts, eg., mt-CharisSIL.cfg.

As a final remark, be warned that creating complete settings is quite a time-consuming task, and requires some patience. It goes without saying that I would gratefully include your settings in the package, once you're finished!