[Dev-luatex] dimension helper

Taco Hoekwater taco at elvenkind.com
Sun Feb 21 14:18:56 CET 2010


Hi,

Paweł Jackowski wrote:
> 
> Taco:
>> Although I do fear that dimen_to_number (in ltexlib.c) will need
>> un-fixing to be totally compatible with TeX82: I am using strtod()
>> and the documented conversion ratios there instead of the actual
>> code from Knuth. 
> 
> And when it will happen, the effects of
> 
>     tex.dimen[100] = '123mm'
>     image.bbox = {0,0,'100bp','200pt'}
> 
> may be slightly different. So be it, noone will cry, because tex.sp() 
> function would follow the new behaviour of dimen_to_number()...

I did this, the string dimension scanner now follows the same
rules as TeX82's dimension scanner for 'bare dimensions' (i.e.
no control sequences and no fill units).

So, the conversion from lua string to dimension now follows exactly
the same rules as TeX82 and pdftex.

It also means you can now use 'em', 'ex', 'mu' and 'px' units,
that the conversion takes the current magnification factor into
account (and you can use the 'true' keyword), and that hexadecimal
and octal integer values (prefix " or ') are allowed.

> Here is what works for me. Accept or deny, I won't insist any longer.

Applied, so there now is the new function tex.sp(<string>).
Both changes are in revision #3435.

Best wishes,
Taco



More information about the dev-luatex mailing list