newbie: How to find glyph stroke starts and stroke ends from TTX XML output

Bryan Rasmussen's picture

As per the subject, if I extract a font's info using ttx and I want to find where each glyph stroke begins and ends? Since I don't know much about the tables in fonts, I am not sure what values represent the lines used to draw a glyph.

gargoyle's picture

For TrueType fonts, look in the <glyf> table, each <TTGlyph> element contains the point coordinates for that glyph's contours.

<glyf>
  <TTGlyph ... >
    <contour>
      <pt ... />
      <pt ... />

In CFF OpenType fonts, the outline data is represented as PostScript code contained within <CharString> elements, which can be found in the <CFF> table. Unfortunately, determining point coordinates from the charstrings is not so straightforward unless you're fluent in PostScript.

Syndicate content Syndicate content