css - 什么是字体的 "EM box/EM unit",它在哪里定义

标签 css fonts user-agent

CSS3 CSS Fonts Module Level 3 (candidate Oct 13) , 在第 2.3 节中有一个对“EM 盒”的引用和一个对“EM 单元”的引用。引用如下:

[The font-size] property indicates the desired height of glyphs from the font. For scalable fonts, the font-size is a scale factor applied to the EM unit of the font. (Note that certain glyphs may bleed outside their EM box.) For non-scalable fonts, the font-size is converted into absolute units and matched against the declared font-size of the font, using the same absolute coordinate space for both of the matched values.

什么是“EM 箱”或相关的“EM 单元”?

浏览器(和其他用户代理)应该从某个地方、从哪里获取它?

最佳答案

在传统排版中,大写字母 M 及其周围的强制空白所占用的空间始终是一个正方形。正方形的高度或宽度,即“em”,用作文本使用的空间单位。例如,根据该定义,一个 em 是包含上行和下行空格但没有任何额外的行间距的文本行的高度。

em 的实际大小(如果您谈论的是纸张)或像素(如果您谈论的是计算机)取决于您选择的字体和字体大小。

浏览器等从字体中获取此信息,字体有一个表格,提供此类常量,它们可用于指导文本呈现。

关于css - 什么是字体的 "EM box/EM unit",它在哪里定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20845711/

相关文章:

javascript/react 动态高度文本区域(停在最大值处)

JavaScript 不断改变 SVG 元素的颜色 - 闪烁

css - Internet Explorer 11 和支持的网络字体

python - 在 python View 中检测移动浏览器(不仅仅是 iPhone)

css - 与用户代理样式表 css 作斗争

asp.net - 是否可以禁用 ASP.NET 客户端感知渲染?

jQuery Highlight 假定背景为白色

html - 如何使div的背景模糊?

internet-explorer - Font Awesome无法在Firefox和IE中使用

css - 在 smartmenus 中使用很棒的字体