[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] Getting accurate advances
From: |
David Bevan |
Subject: |
[Devel] Getting accurate advances |
Date: |
Fri, 14 Nov 2003 14:47:15 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 |
Hi!
In our product (Emtex VIP) we keep all character advances to the nearest
1/14400".
I was using advance.x but this is rounded to the nearest pixel - though
the first problem I noticed was that a character could end up with a
smaller advance in a larger point size :( - something to do with the 2%
correction in the FT_CONFIG_CHESTER_BLUE_SCALE code apparently.
So I tried linearHoriAdvance which was better but, despite what the
tutorial says, still not accurate enough - because it is calculated
using x_ppem (ftobjs.c line 554) which has been rounded to the nearest
pixel (x_scale is similarly rounded). The cumulative error can be
several mm with a text string of 15cm or so.
In the end I added my own fudge factor to correct the advance:
UINT uiVIPSPerPel = VIP_BASE_UNITS / usResolutionDPI;
DOUBLE flAdvanceAdjust = ((flSizeX * usResolutionDPI) / 72) /
pftFace->size->metrics.x_ppem;
lInlineIncr = ToLONG(flAdvanceAdjust *
FromFT16Dot16(pftGlyph->linearHoriAdvance) * uiVIPSPerPel);
Perhaps the tutorial could be changed so that it doesn't claim that
linearHoriAdvance is accurate to 1/65536th of a pixel - or, better,
linearHoriAdvance could be calculated accurately (I can't see how to do
this without storing an additional unrounded value in a new field).
Thanks.
David Bevan
--
________________________________________________________
David Bevan, Emtex Ltd.
Emtex House, Station Road, Kings Langley, Herts. WD4 8LH England
Tel: +44 (0)1923 270882
E-mail: address@hidden
Web: www.emtex.com
- [Devel] Getting accurate advances,
David Bevan <=
- Re: [Devel] Getting accurate advances, Werner LEMBERG, 2003/11/15
- Re: [Devel] Getting accurate advances, David Bevan, 2003/11/17
- Re: [Devel] Getting accurate advances, Werner LEMBERG, 2003/11/17
- Re: [Devel] Getting accurate advances, David Bevan, 2003/11/17
- Re: [Devel] Getting accurate advances, Werner LEMBERG, 2003/11/17
- Re: [Devel] Getting accurate advances, David Bevan, 2003/11/17
- Re: [Devel] Getting accurate advances, Werner LEMBERG, 2003/11/18
- Re: [Devel] Getting accurate advances, David Bevan, 2003/11/18
- Re: [Devel] Getting accurate advances, Werner LEMBERG, 2003/11/21