r8657 jmb - in /trunk/netsurf: amiga/font.c beos/beos_font.cpp
desktop/plot_style.h desktop/save_pdf/font_haru.c
framebuffer/font_freetype.c gtk/font_pango.c render/font.c
riscos/font.c
John-Mark Bell
jmb at netsurf-browser.org
Tue Jul 21 19:13:30 BST 2009
On Tue, 2009-07-21 at 18:43 +0100, Chris Young wrote:
> On Tue, 21 Jul 2009 16:55:35 -0000, wrote:
>
> > - OT_PointHeight,(ysize<<16),
> > + OT_PointHeight,(ysize<<16)/FONT_SIZE_SCALE,
>
> Should this not be (ysize/FONT_SIZE_SCALE)<<16?
> I'm trying to work out whether doing the division before or after the
> shift makes a difference, but I'm struggling.
Doing it before the shift loses precision.
By performing the division first, you've effectively got:
floor(ysize/FONT_SIZE_SCALE)<<16
As written, it does:
floor((ysize<<16)/FONT_SIZE_SCALE)
That said, as it's currently written, font sizes larger than 64pt will
overflow. Therefore, it may well be better to express it as:
ysize * ((1<<16) / FONT_SIZE_SCALE)
which, assuming my maths are correct, will produce the same result
without the potential for overflow (unless font sizes are huge, of
course).
J.
More information about the netsurf-dev
mailing list