30

LuaLaTeX, through the luaotfload package, is able to dynamically add and modify features and properties of a font. This is performed by using the FeatureFile option in fontspec when loading a font; e.g.,

\setmainfont[FeatureFile=times-nr.fea]{Times New Roman}

where times-nr.fea is given as a listing in the fontspec manual (see §11). The syntax of these feature files is given by Adobe. Unfortunately, I haven't had the chance to look into this myself and I'm not sure what's possible nor how to do it.

I'd like to add some more examples to the fontspec manual, especially for adjusting the side-bearings around single glyphs and adjusting the kerning between adjacent glyphs and so on. The ability to define custom kerning for your fonts would truly make LuaLaTeX a world-class typesetting engine—no other TeX program is able to do this sort of thing so easily.

I'd like to perform an experiment: the source for fontspec is on GitHub. I'll offer a bounty on this question for the best patch to the fontspec manual adding more documentation for the FeatureFile option, specifically for sidebearing and/or kerning but hopefully for anything else that you also might happen to see that's fun.

So, can anyone help?


P.S. If you're stuck on the fact that to compile fontspec.pdf requires a whole bunch of pre-built PDFs for the examples, you can grab them from CTAN.

jonalv
  • 11,466
  • Of course, I can't start a bounty for a couple of days so hang tight until then :) – Will Robertson Sep 30 '10 at 08:02
  • 6
    I like the idea of bounties for improving documentation! – TH. Sep 30 '10 at 08:04
  • No, it will be a superclass typesetting system, because no other typesetting system allows you to change font kerning (or other layout features) globally, you can manually kern characters which TeX can already do. – خالد حسني Sep 30 '10 at 08:14
  • @Khaled: Well, you can always create virtual fonts with new kerning. I think the mathpazo fonts have "improved" metrics over the original Palatino clone they're based on. – Will Robertson Sep 30 '10 at 08:16
  • @TH: me too.... I will be following this question closely. – Taco Hoekwater Sep 30 '10 at 08:20
  • 3
    More documentation, and incentives for more documentation are a good thing (of course). However I don't think stackexchange is the right format for asking for this kind of thing. From the faq "this is a place for questions that can be answered", not for "the best patch to the fontspec manual". Therefore, I vote to close this non-question. – Lev Bishop Oct 01 '10 at 00:43
  • @lev: I guess I wasn't clear. I don't know how to do this myself (although I know where to look). All I'm asking for is the answer in a slightly different format :-) – Will Robertson Oct 01 '10 at 02:44
  • I kind of agree with Lev Bishop, but I like the idea of offering a bounty for some specific improvement to some LaTeX documentation should be encouraged. Time for a new sister site for these kinds of offers? – Seamus Oct 03 '10 at 12:31
  • 3
    The biggest problem is that bounties have a time limit and writing documentation can take longer than that...also, you don't want to risk having two people working on something big at the same time without collaborating. How about offering the bounty for someone who commits to writing the documentation and explains why they can do it best! (then the question changes to "who is willing to do it?") – Yossi Farjoun Oct 04 '10 at 14:43
  • 1
    This is only an experiment, so it might not work. But in counterpoint, this really isn't a big feature that I'm asking for documentation on. I'm not saying "write 10 pages of docs"; all I want is an example! If anyone was actually interested they wouldn't need the entire nine days to carefully craft their prose, and the chances of two people overlapping—well, clearly that's not a problem right now and it's also a risk when answering every question on this site. – Will Robertson Oct 04 '10 at 22:07
  • Does anybody know whether or how this issue can be solved? I face a similar problem in French, where the kerning is no longer corrected when using [french]babel. –  Jun 29 '12 at 15:15
  • @Jack — which issue? Babel shouldn't really be used in LuaLaTeX; it wasn't written with unicode-capable TeX in mind. (Although things might start changing soon.) I suggest asking a new question if you're having issues. – Will Robertson Jul 01 '12 at 13:50
  • I’ve linked to this question in my answer to Suppress certain ligatures generally; can this method in fact be used to tweak the ligature tables of a font being loaded? – J. C. Salomon Jul 09 '12 at 19:16

2 Answers2

11

I did not want to interfere with this experiment, but since nobody posted an answer so far, I just pushed an update to the feature file section of the documentation on github. It is not the most clear way to document it, but I tried my best (as far as my English permits :) )

  • BTW, the floats especially in that part are a bit ugly with the example 2 pages away from the actual section because of other floats, I hope someone knows how to really force LaTeX to keep the float in the current page ([h], [!h] and [H] with float package, all made no to very little difference). – خالد حسني Oct 08 '10 at 17:14
6

Adjusting the kerning of the glyph pair fh in TeX Gyre Bonum would require something like the this ...

bonum.fea

languagesystem DFLT dflt;
languagesystem latn dflt;
feature kern {
pos \f \h 125;
} kern;

test.tex

\documentclass{article}
\usepackage{fontspec}
\setmainfont[FeatureFile=bonum.fea]{TeX Gyre Bonum}
\begin{document}
fh
\end{document}

There is a problem with the babel package, though ...

test2.tex

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\setmainfont[FeatureFile=bonum.fea]{TeX Gyre Bonum}
\begin{document}
fh aufhalten
\end{document}

As you can see, the adjusted kerning only applies to the first instance of the glyph pair. When the glyph pair occurs inside a word, the adjusted kerning is not applied. When babel is not loaded, everything is fine.

  • I get the same result with and without babel (a lot of space between the fh). Also I really can't see how babel should be able to interfer. Are you sure that you always deleted the temp-texgyrebonum-regular-bonum.lua file when you change your fea-file? – Ulrike Fischer Feb 08 '11 at 10:44
  • BTW, is there some kind of a public repository for OTF feature files? I plan on adjusting the kerning of TeX Gyre Bonum (at least for the purposes of my own book project), so if anyone was interested they could profit from my custom feature file (provided my adjustments will be typographically accurate, of course). –  Feb 08 '11 at 10:58
  • 1
    The problem is not babel but the german hyphenation patterns. You get the same result (problem) if you load them simply with \makeatletter\bbl@patterns{ngerman}. And it disappear as soon as there is no longer a breakpoint between fh (e.g. try axfhlten). I suggest that you ask on the luatex list if this is a bug or unavoidable. – Ulrike Fischer Feb 08 '11 at 13:06