freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Re: [ft] Vertical metrics and BearingX


From: Werner LEMBERG
Subject: [ft-devel] Re: [ft] Vertical metrics and BearingX
Date: Fri, 23 Mar 2007 09:05:27 +0100 (CET)

> Glyph index 1:
>     bearingX: -3 (0xffffff40)
>     width: 6 (0x180)
>     left: 9
>
> Let's take [...] vertical comma (should appear in the upper right).
> With a width of 6 and a bearingX of -3, the glyph is too far to the
> left.  In fact, no part of this glyph should be to the left of the
> centered vertical baseline.  Note that the value of bitmap_left is
> correct.  Using that value, we are several pixels to the right of
> center.  If I use the bitmap value, I would draw this from x = 9 to
> 15.  Using bearingX (assuming a baseline at 8), I would draw it at
> x = 5 to 11.
>
> According to FontForge, the left bearing of the comma is 1235, with
> a width of 2048.  I would expect those values to give me a bearingX
> of 1.55 or so.

[Note: I'm not an expert in vertical layout.  Please take my words
 with some care.]

In FreeType, for CFF, `bearingX' is always the negative half of the
bbox width in vertical layout mode (this is probably a bad idea...)
On the other hand, the rasterizers set `bitmap_left' to the
x coordinate of the left edge of the glyph bounding box (or rather,
the cbox).  The glyph width as given in the CFF is available as
`horiAdvance'.

With other words, ignore `bearingX' and use `horiAdvance' to center it
vertically.

Currently, vertical layout data in FreeType is inconsistent and not
well documented.  Our expert (WU Chia-Yi) has still to do his military
service, AFAIK, and thus no time to continue his efforts.


    Werner




reply via email to

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