[Dev-luatex] dimension helper

Hans Hagen pragma at wxs.nl
Sat Feb 20 15:31:23 CET 2010


On 20-2-2010 14:02, Paweł Jackowski wrote:
> Dear Team,
>
> it is a common convention in luatex that dimensions are specified either
> as a number (in scaled points) or a string with unit included. But
> unless I'm blind, there is no helper function that converts string
> dimension to a number. Seems that there is a standard dimen_to_number()
> function for that purpose. Would be convenient to have such on aboard.
> If I make such a helper, will you consider adding it to a repo? I'm
> thinking of
>
> tex.sp'1in' -> 4736286
> tex.sp() -> error argument must be a string
>
> or more general
>
> tex.unit('1in', 'cm') -> 2.54
>
> wdyt?

luatex is consistently scaled points and a helper can be written in luq 
quite easily

also, keep in mind that performance wise it's best to do it in lua 
anyway; it's actually just a matter of multiplication (which saves a 
function call too)

such helper functions (if they make sense at all) cna be considered as 
part of adding some kind of float support (which we occasionally consider)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list