How do I compare the widths of two different fonts?

51 Views Asked by At

I would like to see numerical values of how different the character widths of strings taken from two different fonts MS Gothic and Liberation Mono are.

So I used FontForge's metrics, which worked differently than I expected.

Since the "あ" in MS Gothic is larger than the "=" in Liberation Mono, I expected the "幅" column value for character width to be larger in MS Gothic. However, this was not the case, and in fact the "=" was 1229 and the "あ" was 256. However, as you can see from the screenshot, "あ" is definitely larger than "=". How can I get a character width that will give me the result I expect?

Image of FontForge unexpected results
Image of FontForge unexpected results

1

There are 1 best solutions below

0
On

Fonts can have different UPM (unit-per-em) ratios

Truetype/.ttf fonts (designed for desktop usage) usually use 2048 UPM. This also applies to Liberation Mono.

MS Gothic has a rather unusual unit-per-em value of 256 - probably to reduce the overall file size caused by its large number of glyphs.

Other common UPMs

  • webfonts (woff2, woff) often use 1024
  • CFF Opentype fonts (.otf): 1000

Therefore, you need to calculate with relative width when comparing glyph widths from different fonts.

Inspect the font info for both files gives to get the values.

Liberation Mono's glyph width = 60% of EM square
MS Gothic = 100%