Hi,
I am attempting to write a routine to calculate the width of a string to
be rendered (via postscript) with an opentype font. I am using Perl and
via the Font::TTF family of modules have access to the various tables
contained in the font file.
I am assuming the logic to calculate the string width goes something like
this :
set stringwidth to 0
for each character in the string
obtain the glyph index from the cmap table
obtain the glyph width from the hmtx->advance structure->glyph_index
add the glyph width to stringwidth
next
If this is OK so far, then I'm on the right track. However from what I
can see, the glyph widths in the hmtx->advance structure are in "font
design units". How do I convert from these to (say) points (e.g. as
would be returned from the postscript stringwidth operator?
Thanks for your help,
Steve