在CSS中设置字体大小时,字母的真实高度是多少? [英] When setting a font-size in CSS, what is the real height of the letters?

查看:697
本文介绍了在CSS中设置字体大小时,字母的真实高度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有一个类似的问题字体,em大小应设置为1000个单位。在 TrueType 字体中,em大小通常为1024或2048。



定义字体样式的最准确方法是使用EM,当您定义要使用的字体大小时,该维度不会引用像素高度



对于记录1 PT 约为0.35136mm。和PX是1点在你的屏幕上,这是由每平方英寸的点数或屏幕的分辨率,因此不同的屏幕到屏幕,是定义字体大小的最糟糕的方式。



单位换算



这是一个很好的阅读,如果你喜欢文学,使你的眼睛流血像我一样。 typopgrahic测量的国际统一

  1分(Truchet)| 0.188 mm 
1分(Didot)| 0.376毫米或1/72法国皇家英寸
1分(ATA)| 0.3514598 mm或0.013837英寸
1点(TeX)| 0.3514598035 mm或1 / 72.27 inch
1分(后记)| 0.3527777778毫米或1/72英寸
1点(国际版) 0.4 mm
1 pica(ATA)| 4.2175176 mm = 12点(ATA)
1 pica(TeX)| 4.217517642 mm = 12点(TeX)
1 pica(Postscript)| 4.233333333 mm = 12分(后记)
1 cicero | 4.531 mm = 12点(Didot)



分辨率

 code>μm:10.0 20.0 21.2 40.0 42.3 80.0 84.7 100.0 250.0 254.0 
dpi:2540 1270 1200 635 600 317 300 254 102 100



标准只是值得这么多..



一个字体glyphs与另一个字体的实际大小总是变化依赖on:


  1. 开发人员在创建字体时如何设计字体字形,

  2. 浏览器呈现这些字符。没有两个浏览器完全相同。

  3. 解析度和


  4. 示例



    作为一个例子,为字体开发人员操作几何是多么常见。当苹果创建Zapfino脚本字体时,他们的大小相对于字体中的最大资本的预期,但然后他们决定小写字母看起来太小,所以几年后,他们修改它,以使任何给定的点大小是其他字体大约4倍。



    如果你没有头痛,阅读更多..



    维基百科有一些关于现代排版和起源的好信息;和其他相关主题。





    和一些第一手的体验



    如果你想获得更多第一手的理解您可以下载免费的字体开发工具 FontForge ,该工具类似于非自由的 FontLab Studio (这两个是我的经验中的字体开发者的流行选择)。两者都有活跃的社区,因此您在学习如何使用它们时可以获得大量的支持。




    There is a similar question here whose answer in essence says:

    The height - specifically from the top of the ascenders (e.g., 'h' or 'l' (el)) to the bottom of the descenders (e.g., 'g' or 'y')

    This has also been my experiance. I.e. in 14px Arial the height of the letter K (the baseline height) is about 10px.

    The specs say nothing about the calculated font-size so I'm guessing this is bowser-specific, but I could not find any reference to it.

    (Other questions here and here ask roughly the same thing but sadly no answer gives a satisfying explanation..)

    Is there any documentation on why the font-size seems to be the size "from ascenders to descendes"?

    解决方案

    Some background on the subject

    Back when letters were created on metal, the em referred to the size of each block that the letter would be engraved on, and that size was determined by the capital M because it usually takes up the most space.

    Now a days, font developers create their fonts on a computer without the limitations of a physical piece of metal so while the em still exists, its nothing more than an imaginary boundary in the software; thus prone to being manipulated or disregarded altogether.

    Standards

    In an OpenType font, the em size is supposed to be set to 1000 units. And in TrueType fonts, the em size is usually either 1024 or 2048.

    The most accurate way to define a font style is to use EM that way when you define a font-size for use, the dimension does not refer to the pixel height of the font, but to the fonts x height which is determined by the distance between the baseline and the mean line of the font.

    For the record 1 PT is about 0.35136mm. And PX is 1 "dot" on your screen which is defined by the dots per square inch or resolution of your screen and thus different from screen to screen and is the worst way to define a font size.

    Unit conversion

    This is a pretty good read if you enjoy literature that makes your eyes bleed like me.. International unification of typopgrahic measurements

    1 point (Truchet)                    |  0.188 mm
    1 point (Didot)                      |  0.376 mm or 1/72 of a French royal inch
    1 point (ATA)                        |  0.3514598 mm or 0.013837 inch
    1 point (TeX)                        |  0.3514598035 mm or 1/72.27 inch
    1 point (Postscript)                 |  0.3527777778 mm or 1/72 inch
    1 point (l’Imprimerie nationale, IN) |  0.4 mm
    1 pica (ATA)                         |  4.2175176 mm = 12 points (ATA)
    1 pica (TeX)                         |  4.217517642 mm = 12 points (TeX)
    1 pica (Postscript)                  |  4.233333333 mm = 12 points (Postscript)
    1 cicero                             |  4.531 mm = 12 points (Didot)
    

    Resolutions

    µm  :  10.0    20.0    21.2    40.0    42.3    80.0    84.7    100.0    250.0    254.0
    dpi :  2540    1270    1200    635     600     317     300     254      102      100
    

    Standards are only worth so much..

    The actual size of one fonts glyphs vs another font are always going vary dependent on:

    1. how the developer designed the font glyphs when creating the font,
    2. and how the browser renders those characters. No two browsers are going to be exactly the same.
    3. the resolution and ppi of the screen viewing the font.

    Example

    As an example of how common it is for font developers to manipulate the geometry.. Back when Apple created the Zapfino script font, they sized it relative to the largest capitals in the font as would be expected but then they decided that the lowercase letters looked too small so a few years later they revised it so that any given point size was about 4x larger than other fonts.

    If you don't have a headache, read some more..

    There's some good information on Wikipedia about modern typography and origins; and other relevant subjects.

    And some first-hand experience

    If you want to get more first-hand understanding you can download the free font development tool FontForge which is comparable to the non-free FontLab Studio (either of these two being the popular choice among font developers in my experience). Both also have active communities so you can find plenty of support when learning how to use them.

    这篇关于在CSS中设置字体大小时,字母的真实高度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆