关于FreeType中units_per_EM的含义
Posted 柳鲲鹏
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于FreeType中units_per_EM的含义相关的知识,希望对你有一定的参考价值。
具体什么用处目前没有研究清楚,从网上搜索了一些说法:
- 说法1
units-per-em - SVG:可缩放矢量图形 | MDN
The units-per-em
attribute specifies the number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. This is the size of the design grid on which glyphs (en-US) are laid out.
This value indicates the the number of coordinate units on the em square.
- 说法2
DWRITE_FONT_METRICS (dwrite.h) - Win32 apps | Microsoft Learn
designUnitsPerEm
Type: UINT16
The number of font design units per em unit. Font files use their own coordinate system of font design units. A font design unit is the smallest measurable unit in the em square, an imaginary square that is used to size and align glyphs. The concept of em square is used as a reference scale factor when defining font size and device transformation semantics. The size of one em square is also commonly used to compute the paragraph indentation value.
- 说法3
TrueType fundamentals (OpenType 1.9) - Typography | Microsoft Learn
这里是正经的说明。
Converting FUnits to pixels
Values in the em square are converted to values in the pixel coordinate system by multiplying them by a scale. This scale is:
pointSize * resolution / ( 72 points per inch * units_per_em )
where pointSize is the size at which the glyph is to be displayed, and resolution is the resolution (dots or pixels per inch) of the output device. The 72 in the denominator reflects the number of points per inch.
For example, assume that a glyph feature is 550 FUnits in length on a 72 dpi screen at 18 point. Also assume that there are 2048 units per em. The following calculation reveals that the feature is 4.83 pixels long.
550 * 18 * 72 / ( 72 * 2048 ) = 4.83
- 说明3
- FreeType和OpenType差异
The Difference between TrueType and OpenType Fonts
以上是关于关于FreeType中units_per_EM的含义的主要内容,如果未能解决你的问题,请参考以下文章
FreeType中FT_Face.units_per_EM的值怎么来的