Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TrueType or PCL Font Widths

Status
Not open for further replies.

webrabbit

MIS
Jan 31, 2003
1,059
US
How do I extract the character widths from a TrueType or PCL font?
 
Answer: with some difficulty!

Visit for information about the OpenType specification (a superset of TrueType) and you'll begin to see that extracting character metrics from a TrueType font is not a trivial task.

The same is true of PCL fonts, which come in a number of variants, within 3 'groups':

(a) PCL bitmap fonts.

(b) PCL Encapsulated Intellifont Outline (PCLEO) fonts.
Downloadable files usually have .sfs or .sfd extensions.
Not used much these days; Intellifont specification is difficult, if not impossible, to get hold of.

(c) PCL Encapsulated TrueType Outline (PCLETTO) fonts.
Downloadable files usually have .sft extension.

The above typography site may have links to tools which may provide font metrics.

Otherwise, consider commercial tools such as FontLab, or the (much cheaper but almost as good?) FontCreator package from High-Logic.
 
I understand that there are Windows API functions (and presumably equivalent *n*x ones) to return the width of a specified string of characters using a given installed font at a specified point size; so you could get the widths that way, by making repeated calls, each with single-character strings.

On the assumption that the widths are linearly scaled, you could then extrapolate the width values to any other point size; but this may not be valid for small point sizes, where 'hinting' may change the width (I don't know if this is the case or not).

Note that the width returned for a string with multiple characters will probably take kerning pairs into account, so could be less than the sum of the individual character widths.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top