|Subject:||[ft] Vertical metrics and BearingX|
|Date:||Fri, 16 Mar 2007 16:57:37 -0700|
Hi all,I have been banging my head against a wall for a few hours trying to understand something about the font metrics I get back for a particular Japanese font, when drawing vertical text. I hope this hasn't been asked and answered - I searched the archives, but didn't find the answer, though there were some similar questions.
I have a font (a few actually) with vertical metrics, including replaced glyphs for certain entries (using 'vert' tables). For the most part, I am able to grab the fonts and calculate where to draw them by querying the vertBearingX for the glyph. For example a normal, full-width character may have a vertBearingX of -12 and a width of 23. That's about right - my baseline is centered, so starting to draw at originX -= 12 is correct. The problem is with a couple of characters (comma and period, perhaps others). Given the same font size, my comma comes out at vertBearingX = -6 and width = 9. I can believe the width, but the distance from the (vertically centered) baseline to the left edge of the glyph should be positive, not negative (the comma should draw in the upper-right quadrant). I've looked at the font in FontForge, and the left bearing for the comma is 1235, with 2048 units per em. That clearly puts it to the right of the baseline.
So, any idea why I get -6 instead of, say, +2 (or maybe +1.8)? Am I misunderstanding vertBearingX? If I load the bitmap, I see bitmap_left is 14, which makes sense. I suppose I could just do bitmap_left - (em_width/2) to get the offset from the centered baseline, but that feels kind of hacky.
|[Prev in Thread]||Current Thread||[Next in Thread]|