Reputation: 1
This is a graph with definition of a few terms for the horizontal glyph metrics for fonts.
Let's say I have a sentence,
Foo bar baz.
How do I get the spacing size, in pixels, between the words "Foo" and "bar"? I suppose I sum,
advance
the bearingX
+ width
advance
of the space character.bearingX
.Is this correct? What table has the bearingX?
Upvotes: 4
Views: 2931
Reputation: 195
How do I get the spacing size, in pixels, between the words "Foo" and "bar"?
You need to know the horizontal advance of the space character and kerning between "o" and " ", and between " " and b". I don't think you need bearingX to get the spacing. The result will be in font "units", defined by unitsPerEm of HEAD tag. So convert this result * font size / unitsPerEm, and you will get the spacing in "points". Then you will need to known, how many pixels there are in one point: depends on the application, could be your monitor DPI or Postscript's 72 dpi.
What table has the bearingX?
bearingX is in also in HMTX, under "lsb" (left-side bearing) of longHorMetric (and also leftSideBearing, obviously).
Upvotes: 4