# What possibilities are there of using OpenType fonts and margin kerning?

I really like the protrusion and margin kerning features of pdfTeX and LuaTeX. I also like to use other fonts than those available for TeX. What choices do I have when I want to use both? Also, what problems with typography should I expect?

-
Regarding 'expansion', IMO it's way too easy to confuse that with macro expansion. –  Giel Aug 9 '10 at 12:51
tags added, using font-expansion –  Taco Hoekwater Aug 9 '10 at 13:06

This is for lualatex:

\documentclass{article}

\usepackage{fontspec}
\setmainfont[RawFeature={protrusion=default}]{TeX Gyre Pagella}

\pdfprotrudechars2 % 1 if you don't want to change line breaking

\begin{document}
\input{knuth}
\end{document}

-

XeTeX has recently been enhanced with microtypography extensions as well, but it's still in a beta phase.

-
The version of XeTeX in TeXlive 2010 testing supports this, right? Do you need to load the microtype package? –  frabjous Aug 9 '10 at 16:27

I’ve recently converted a few OTF fonts using otdtotfm (LY1 encoding) and written a corresponding .fd file; then a few more imports to get the font selection done and the thing worked very well together with pdftex and microtype. Some protrusion is applied (though I don’t know if it’s ‘perfect’ – whatever that would mean) – in fact there are much, much less overfull boxes than without microtype.

So if one cannot rely on the very latest additions to lua- or xetex and a small subset of characters is all right (though one can of course create as many fonts as to cover the whole character range of the original OTF file) this seems to be a valid option.

-

LuaTeX supports both. I'm not sure about the state of Lua in LaTeX, but you can already do it in ConTeXt.

This is how I did it:

\usemodule[simplefonts]
\setupsimplefonts[expansion=quality,protrusion=quality]
\setmainfont[Fontin Sans]
\setsansfont[Fontin Sans]
\setmathfont[iwona]
\setupalign[hanging,hz]
\switchtobodyfont[11pt]

-
Not related to the question, but for document wide setup, it is better to use \setupbodyfont rather that \switchtobodyfont. –  Aditya Aug 10 '10 at 15:43