Menu

#13 scale is calculated wrongly in paps.c

open
nobody
None
5
2009-02-06
2009-02-06
No

The --cpi option really didn't do what it was supposed to do, so I went digging in the code.

Apparently you had this:

scale = 1 / page_layout.cpi * 72.0 * PANGO_SCALE / max_width;

But you're mixing doubles with ints there. The result is that scale will be zero for any cpi, except when cpi is around 1.

To fix that, change that line to:

scale = 1.0 / page_layout.cpi * 72.0 * (double)PANGO_SCALE / (double)max_width;

The same error can be found some lines higher, where page_layout.scale_x is calculated.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB