2

On Linux, I can easily extract the height / width / ascent / descent dimensions of Xorg fonts via xlsfonts, e.g.

$ xlsfonts -ll -fn 9x15 | egrep 'bounds|max'
  bounds:               width left  right  asc  desc   attr   keysym
        max                9     4     9    12     3  0x0000

How can I extract the same information from a TrueType font I have installed?

2

The ttf2afm utility, now available in TeXlive, extracts AFM from a TrueType font (as the name suggests). AFM stands for Adobe Font Metrics, and is a text format which is simple to parse. Here's a sample:

StartCharMetrics 10538
C -1 ; WX 600 ; N .notdef ; B 34 -71 566 750 ;
C -1 ; WX 0 ; N .null ; B 130 -9 237 676 ;
C -1 ; WX 333 ; N CR ; B 130 -9 237 676 ;
C -1 ; WX 600 ; N CR ; B 130 -9 237 676 ;
C -1 ; WX 250 ; N space ; B 130 -9 237 676 ;
C -1 ; WX 333 ; N exclam ; B 130 -9 237 676 ;
C -1 ; WX 400 ; N quotedbl ; B 73 431 327 676 ;
C -1 ; WX 500 ; N numbersign ; B 5 0 496 662 ;
C -1 ; WX 500 ; N dollar ; B 44 -87 457 727 ;

Each line in this section is a list of values about one character, separated by semicolons. WX is the character width. N is the character name; use ttf2afm -u to print Unicode code points like uni0020. B is the bounding box (x_left, y_bottom, x_right, y_top).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.