[luatex] Strange behavior with fonts.

Paul Isambert zappathustra at free.fr
Wed Apr 20 15:14:22 CEST 2011

Hello there,

I think I've found a bug, but since I'm still a bit uncomfortable with 
fonts and I can't reproduce the problem with luaotfload (haven't tried 
very hard, though), I think it wise to ask knowledgeable people before 
polluting the bug tracker.

The problem is entirely contained in the attached files.

The Lua code is an extremely blunt font loader, as minimal as possible 
while still displaying the problem; it is also extremely stupid: on 
first use, it sets the glyph to their Unicode slots; the second time, it 
puts small caps in the slot of the lowercase letters (it is meant to 
spot Minion's small caps). In other words, after:

\font\fontone=MinionPro-Regular.otf at 10pt
\font\fonttwo=MinionPro-Regular.otf at 10pt

\fontone writes normally, while \fonttwo writes in small caps. That's 
the way I use a font with small caps (I suppose that's the only way, 
unless you change glyphs in callbacks). I've used Minion because it is 
distributed freely with Adobe Reader.

Now, if you look at the PDF or compile the source, you can see that it's 
all wrong; sizes are at random and the paragraph is like raggedright. If 
\fonttwo isn't loaded, everything is fine; otherwise, disaster, even 
though \fonttwo is loaded /after/ the paragraph has been built, which 
seems to indicate something has gone wrong when outputting to PDF (of 
course the problem also shows up when \fonttwo is loaded before the 
paragraph). Judging from what I can read in the uncompressed PDF file 
when comparing to an unproblematic file, spaces between characters are 
all wrong (I don't know where those spaces come from, by the way; there 
are no font kerns with this fontloader).

A few remarks about the behavior:

- It depends on font expansion; without \pdfadjustspacing, everything is 
- It also depends on the value given to the glyphs' "expansion_factor" 
field; if 484 or higher, it goes wrong; if 483 or lower, everything is 
fine. The value of that threshold depends on the font (e.g. it is 909 
for Chaparral).
- If there is a one-line paragraph before the first paragraph, 
everything is fine.
- If there is a page break before the second font is loaded, again 
everything is fine.
- The fonts should be loaded at the same size; if e.g. \fonttwo is 
10.1pt, the problem vanishes.

Did I do anything wrong or is that a patented bug? (Actually, I think 
that even if I did anything wrong the behavior is so strange that it's 
very probably a bug anyway.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20110420/da36d627/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 16220 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20110420/da36d627/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tex
Type: text/x-tex
Size: 3497 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20110420/da36d627/attachment-0001.bin>

More information about the luatex mailing list