Inconsistent Font Metrics

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 41
Joined: 2011-11-12T22:20:18-07:00
Authentication code: 8675308

Inconsistent Font Metrics

Post by djd »

The convert -debug option offers various font metrics:
convert -debug annotate xc: -font Arial -pointsize "30" \
-annotate 0 'A' null: 2>&1 | \
grep Metrics:

Using this to extract ascent, descent, height, produces:
pointsize=20 ascent=19 descent=-5 height=23
pointsize=24 ascent=22 descent=-6 height=28
pointsize=30 ascent=28 descent=-7 height=35
pointsize=32 ascent=29 descent=-7 height=37
pointsize=36 ascent=33 descent=-8 height=41
pointsize=40 ascent=37 descent=-9 height=46
pointsize=48 ascent=44 descent=-11 height=55
pointsize=56 ascent=51 descent=-12 height=64

But beside being somewhat internally inconsistent, the values are not what is measured when displaying the font.

Measured values of the metrics:
pointsize=20 ascent=15 descent=-4 height=19
pointsize=24 ascent=17 descent=-6 height=23
pointsize=30 ascent=22 descent=-6 height=28
pointsize=32 ascent=23 descent=-7 height=30
pointsize=36 ascent=26 descent=-8 height=34
pointsize=40 ascent=29 descent=-9 height=38
pointsize=48 ascent=35 descent=-10 height=45
pointsize=56 ascent=40 descent=-13 height=53

It would seem the convert -debug option is an unreliable source of font metrics.
Post Reply