# [Dev-luatex] bug with \ifcsname, ttf font spacing problems, and catcode initialisation for utf8 beyond ascii

Taco Hoekwater taco at elvenkind.com
Fri Sep 14 09:03:23 CEST 2007

Arthur Reutenauer wrote:
>> Probably the "mag" multiplier. It should be around 50.000, I guess.
>> I'll have a closer look tomorrow.
>
>   That was is; it's fixed on the wiki.  Olivier can enjoy his line of
> little skulls with the correct metrics ...
>
>   By the way, I thought the test on size was wrong too [if (size < 0)
> then size = (- 655.36) * size end] because, from reading the LuaTeX
> reference, I assumed that a size of -1 meant an actual size of
> design_size, thus defaulting to 10pt == 655360sp.  But after testing, it
> seems that it's actually not the case and that that number has to be
> divided by 1000.  Am I mystified or should the paragraph at the end of
> page 50 of the manual be corrected?  I do remember having read something
> about a factor 1000 in the past ... (like Metafont's mag parameter).

In TeX, there are two different primitive ways to load a font

\font\f=cmr10 at 10pt
\font\f=cmr10 scaled 1000

The default case of

\font\f=cmr10

is equivalent to "scaled 1000", meaning thousand permille of the
font's intended (design) size. That is what makes sure that TeX

Now ,the first possibility is converted to lua as ("cmr10",655360),
the second as  ("cmr10", -1000). In the latter case, you have to adjust
your magnifaction value according to the font's design_size (as well
as for units_per_em).

Because opentype font design sizes are expressed in decipoints,
your calculation of 'size' should end up as

if ttffont then
-- otf design_size is not always set
ttfont.design_size = ttfont.design_size or 100
f.designsize = 65536 * ttfont.design_size/10
if size < 0 then
size = f.designsize * (-size/1000)
end
f.size = size

I hope that this is clearer now.

Best wishes,
Taco