Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

TrueType or PCL Font Widths

TrueType or PCL Font Widths

TrueType or PCL Font Widths

How do I extract the character widths from a TrueType or PCL font?

RE: TrueType or PCL Font Widths

Answer: with some difficulty!

Visit http://www.microsoft.com/typography/default.mspx 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.

RE: TrueType or PCL Font Widths

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close