freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] Getting accurate advances


From: Turner David
Subject: RE: [Devel] Getting accurate advances
Date: Thu, 20 Nov 2003 14:04:15 +0100

Hello David,

> 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.
>
Well, this is not surprising and completely normal when hinting is used.
This is not directly related to David Chester's patch. It's simply that
hinting does distort the outline, and thus the glyph metrics,
significantly in unpredictable ways, and this is *by* design.
 
> 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.
> 

Why didn't you use the FT_LOAD_LINEAR_DESIGN loading flag ? This
would give you the original, untouched, advance in font units.
This would let you compute exact advances with the help of
face->units_per_EM ?

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


> 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 mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel
> 

--
This message and any attachments (the "message") is intended solely for the
addressees and is confidential. If you receive this message in error, please
delete it and immediately notify the sender.
Any use not in accordance with its purpose, any dissemination or disclosure,
either whole or partial, is prohibited except formal approval.
The E-Mail transmission can not guarantee the integrity of this message.
CANAL+TECHNOLOGIES will not therefore be liable for the message if modified.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]