[dev-context] format() without formatting

Hans Hagen pragma at wxs.nl
Tue Jun 17 10:01:10 CEST 2008


Peter Rolf wrote:
> Hi,
> 
> can one of the experienced lua programmers here think about a special
> version of format()? This function in general is of great help (short, 
> good readable code), but in combination with direct written pdf code 
> (like in mlib-pdf.lua) is has a major drawback.
> All numbers are written with fixed size (as normally intended in
> formatted output). As a result you get '0.000000' instead of a short '0'.
> Look in an uncompressed pdf and you will see how much space is wasted
> there in total.

it's a trade off; %g is not usable because we then get e notation

and postprocessing is no option either because it's a waste of cpu cycles

> With enabled compression things don't look that bad (regarding to file 
> size), but it's still a unnecessary waste.

indeed, such sequences compress well

adding special formatter function has a low priority .. maybe some day

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-context mailing list