Version 2.4 of Luaotfload
(CTAN link) officially supports
letterspacing similar to Xetex.
You can enable it at font definition time
(see the manual
for details):
\font \mainfont = "file:Iwona-Regular.otf:letterspace=15" at 42pt
where the value is a percentage of the requested font size, i.e. 6.3 pt
in above example.
(Alternatively, you can specify the value directly as a factor using
the option kernfactor
.
In order to achieve the same effect as in the example you would add
kernfactor=0.15
.
The kern factor, though equivalent to letterspace
in functionality,
makes more sense internally and is to a large extent consistent with
the behavior of Context’s \setcharacterkerning
family of macros
that the letterspacing code is derived from.)
This width is inserted as additional kern between glyphs, with
special handling for already existing kerns, ligatures, and other
denizens of TeX’s node list.
In Fontspec terms, the feature should be directly accessible via the
LetterSpace
key of \fontspec
, \set.*font
etc.
Beware, since this feature is quite new and only tested so much, there may
still be some issues with it.
Currently (January 2014) there are
two
bug
reports on the tracker that have patches in version 2.4 but require
further testing.
Also, the output is not guaranteed to be identical with Xetex or the
\letterspacefont
primitive (or Pdftex, for that matter).
For comparison, a short test file:
\def \testfont {Iwona-Regular.otf}
%\def \testfont {lmroman10-regular.otf}
%\def \testfont {MinionPro_Regular.otf}
\def \testsize {20pt}
\ifdefined \directlua
\input luaotfload.sty
\font \mainfont = "file:\testfont" at \testsize
\font \mainfontlskern = "file:\testfont:letterspace=15" at \testsize
\letterspacefont \mainfontlsfont = \mainfont 150
\else
\font \mainfont = "[\testfont]" at \testsize
\font \mainfontlskern = "[\testfont]:letterspace=15" at \testsize
\def \mainfontlsfont {<unsupported!>}
\fi
\newdimen \scratchwd
\newbox \scratchbox
\def \test #1{%
foo
\begingroup
#1%
\setbox \scratchbox \hbox {bar baz}%
\global \scratchwd = \wd \scratchbox%
\box \scratchbox
\endgroup\
bar
(\the \scratchwd)
\endgraf
}
\mainfont
\test \mainfontlskern %% font kerning
\test \mainfontlsfont %% increased sidebearings
\bye
The values for \letterspacefont
and the letterspace
option may
differ in subtle ways.
According to the Pdftex manual,
This primitive creates an instance of \Something{font} with the widths
of all glyphs increased by \Something{integer} thousandths of an em (as
set in \Something{font}). The effect is letter spacing, but the glyphs
are actually larger (sidebearings are increased), so a single glyph will
take more space.
Afaics the same holds for the Luatex implementation of
\letterspacefont
.
Since the font size and the em (quad) dimension are identical for
most fonts, the output should not differ by much.
There is, however, another more visible difference:
the \letterspacefont
method also affects surrounding spaces whereas
letterspace
only works between glyphs.
This behavior may change in future versions, or the microtype package
may add support for adapting the spacing.
In summation, there are three approaches to letterspacing in modern
TeX:
- extending sidebearings of glyphs -- this is the strategy used in Pdftex as
well as Luatex’s
\letterspacefont
.
The value is specified in thousandths of an em.
- adding spaces between glyphs -- according to the
fontspec manual,
this is the Xetex approach.
The value is specified in hundredths (percent) of the font size.
- inserting kerns between glyphs -- this is what Context and
Luaotfload do.
In Context and Luatofload with the
kernfactor
option, the value
is a factor applied to the font size.
Luaotfload’s letterspace
option (which is again used by the
fontspec package) emulates Xetex in that it interprets the value as
hundredths (percent) of the font size.
Post scriptum regarding the original question:
fontspec’s Renderer
option, when used with Luaotfload, selects
one of the two available processing modes.
base
mode, which is the default in Context, should be “good
enough” for most Latin-based scripts.
Usually, though apparently not in OP’s case, it results in faster
typesetting.
The drawback is that base
mode omits most Opentype features, so
it is not an option for many scripts.
The implementation is in
font-otb.lua
.
node
mode, which is the default in Luaotfload, applies Opentype
font features during typesetting, at the cost of a minor performance
loss.
The features ccmp, locl, rlig, liga, clig, kern, mark,
and mkmk are active by default for the DFLT script
(in Luaotfload, not Context).
You can look up their definition in the
Opentype spec.
The implementation can be found in
font-otn.lua
.
{\fontspec[LetterSpace=.125]{Iwona}foo}
without having to requestbase
mode. The implementation is experimental, though.LetterSpace=.125
just always and everywhere add.125
-space between letters? I wanted to usetracking=true
, because it just increases the look without any further options, especially it optimises spacing of small caps. In other words isLetterSpace=.125
equivalent totracking=true
?\letterspacefont
) that microtype was written for increases the sidebearings of letters. Also, microtype’stracking
option includes extra functionality like handling of boundaries (outer spacing, outer kerning, etc.) that are outside the scope of font-based letterspacing.