INFO: Font Metrics and the Use of Negative lfHeight

 Print
 
Article translations 
This article was previously published under Q32667
Expand all | Collapse all

On This Page

SUMMARY

The following illustrations show the most commonly used font metrics, including Character Height, which is selected with negative values of each illustration is followed by notes describing the metrics.

 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

                     O    O
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /\
/ \
/ \
_ _ _ _ _ _ _ _ _ /______\ _ _ _ ___ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \|
/ \ | |
_ _ _ _ _ _ _ _ /_ _ _ _ _ _ \ _ \___/| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\___/_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|- External Leading
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _
|
O O |- Internal Leading
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _
| /\
| / \
| / \
| /______\ _ _ _ ___ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Char Height -| / \ / \|
| / \ | |
| /_ _ _ _ _ _ \ _ \___/| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| |
| |
_ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _\___/_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| O O |
| |
| /\ |
| / \ |
| / \ |- Ascent
Cell Height -| /______\ ___ |
| / \ / \| |
| / \ | | |
| /_ _ _ _ _ _ \ _ \___/| _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _
| | |
| | |- Descent
_ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _\___/_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _

Cell Height

This is the height selected on positive lfHeight in the LOGFONT. It is the height of the font bitmap for raster fonts. It is returned as tmHeight in the TEXTMETRIC structure from GetTextMetrics().

Character Height (Also Known as Em)

This is the height selected on negative lfHeight in the LOGFONT. (That is, the mapper will try to match a font whose character height matches the absolute value of the requested height.)

NOTE: By definition, the Em is equal to Cell Height minus Internal Leading. The Em defines the point size of a font. In MM_TEXT mapping mode, the Em is related to the point size as follows:

   Em=dpiY*point_size/72;  // where dpiY is dots per inch in Y direction
				

The dpiY of a font is equal to tmDigitizedAspectY in the TEXTMETRICS structure.

Internal Leading

This is returned as tmInternalLeading in the TEXTMETRIC structure from GetTextMetrics() and often, but not necessarily, describes how much space has been left inside the font bitmap for diacritical marks (accents).

External Leading

This is returned as tmExternalLeading in the TEXTMETRIC structure from GetTextMetrics() and describes how much extra space the font designer expects the application to leave between rows of the font. It is not included in the bitmap and is not modified by TextOut()/ExtTextOut(), even in OPAQUE mode. When outputting multiple lines of text, the lines should be separated by (tmHeight + tmExternalLeading).

 Character Width                       Character Width
| |
|-------------| |-------------|
| | / / |
| | / / |
| | / / |
| | / / |
|----------| /----------/ |
| | / / |
| | / / |
| | / / |
| | / / |
|________|
|_____________| |_____________| |
| | Overhang
Character width Character width
(including white space) (including white space)
Overhang = 0 Overhang > 0

Overhang

tmOverhang specifies the per string extra width that may be added to some synthesized fonts. When synthesizing some attributes such as bold or italic, GDI or a device may have to add width to a string on both a per character and per string basis. For example, GDI synthesizes embolding by expanding the intercharacter spacing and overstriking with an offset and italicizes a font by skewing the string.

In either case, there is an overhang past the basic string. For bold strings, it is the distance by which the overstrike is offset. For italic strings, it is the amount the top of the font is skewed past the bottom of the font. tmOverhang allows the application to determine how much of the character width returned by a GetTextExtent() call on a single character is the actual character width and how much is the per string extra width. The actual width is the extent less the overhang. In other words, tmOverhang is the difference between the width of a character when it is output singly versus its width when it is in the interior of a string.

For more information, look up the following topics in the Windows Software Development Kit reference:

  • CreateFont() (in Volume 1 of the version 3.0 reference)
  • TEXTMETRIC (in Volume 2 of the version 3.0 reference)

Properties

Article ID: 32667 - Last Review: March 21, 2005 - Revision: 1.1
APPLIES TO
  • Microsoft Windows Software Development Kit 3.1
Keywords:
kbinfo KB32667
Retired KB Content Disclaimer

This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

INFO: Font Metrics and the Use of Negative lfHeight的更多相关文章

  1. Getting Text Metrics in Firemonkey(delphiscience的博客)

    Firemonkey’s abstract TCanvas class has been providing the dimensions of the bounding rectangle of s ...

  2. [EMSE'17] A Correlation Study between Automated Program Repair and Test-Suite Metrics

    Basic Information Authors: Jooyong Yi, Shin Hwei Tan, Sergey Mechtaev, Marcel Böhme, Abhik Roychoudh ...

  3. Font and PDF

    1. 独立存在的Font文件 有三类: Type 1 Font TrueType Font OpenType Font Type 1 是由Adobe开发的,它是基于PostScript的Font,它通 ...

  4. css 常用单位

    em: 相对于应用在当前元素的字体尺寸,1em 等于当前的字体尺寸,2em 等于当前字体尺寸的两倍,一般浏览器字体大小默认为16px,则2em == 32px: W3原文:font size of t ...

  5. 你可能不知道的7个CSS单位

    如果你是一名前端开发工程师,一般px和em使用频率比较高.但是今天本文的重点是介绍一些我们使用很少.甚至么有听说的单位. 一.重温em <style type="text/css&qu ...

  6. Using Headless Mode in the Java SE Platform--转

    原文地址: By Artem Ananiev and Alla Redko, June 2006     Articles Index This article explains how to use ...

  7. 关于imagic拼接透明背景图片的问题

    目标: 为了做图片水印,需要水平拼接多个logo和文字... 之前用过imagick,所以继续使用. 第一个版本:实现了图片和文字的拼接,代码如下: package main import ( &qu ...

  8. IOS CoreText.framework --- 行 CTLineRef

    http://blog.csdn.net/fengsh998/article/details/8701738 前面两篇文章介绍了文字的样式,段落样式.本文章主要介绍行模式.CTLineRef 知识了解 ...

  9. iOS之富文本

    之前做项目时遇到一个问题: 使用UITextView显示一段电影的简介,由于字数比较多,所以字体设置的很小,行间距和段间距也很小,一大段文字挤在一起看起来很别扭,想要把行间距调大,结果在XCode中查 ...

随机推荐

  1. Yum Proxy

    $ cat /etc/yum.conf[main]cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0debuglevel=2logfile ...

  2. addEventListener和attachEvent的区别 分类: JavaScript 2015-05-12 19:03 702人阅读 评论(0) 收藏

    addEventListener共有3个参数,如下所示:element.addEventListener(type,listener,useCapture); 参数 参数说明 element 要绑定事 ...

  3. Android之从TCP/IP、HTTP看Socket通信

    1.概念 TCP/IP:属于传输层/网络层协议.手机能够使用联网功能是因为手机底层实现了TCP/IP协议,可以使手机终端通过无线网络建立TCP连接.TCP协议可以对上层网络提供接口,使上层网络数据的传 ...

  4. Nginx 为 Golang 配置 web 服务

    server { charset utf-; client_max_body_size 128M; #listen ; ## 监听 ipv4 上的 端口 #listen [::]: default_s ...

  5. Java多态的一些陷阱

    Java多态是如何实现的? Java的多态和C++一样,是通过延时绑定(late binding)或者说运行时绑定(runtime binding)来实现的.当调用某一个对象引用的方法时,因为编译器并 ...

  6. MBIST:用于嵌入式存储器的可测试设计技术

    MBist技术可以自动实现存储器单元或阵列的RTL级内建自测试电路,MBIST的EDA工具支持多种测试算法的自动实现,可针对一个或多个内嵌存储器自动创建BIST逻辑,并完成BIST逻辑与存储器的连接, ...

  7. spark、hadoop集群添加节点

    1.首先添加hdfs的节点,将安装包上传到服务器,设置好环境变量.配置文件按之前spark集群搭建的那里进行修改. 设置完成后,要对新节点新型格式化: # hdfs  dfs  namenode  - ...

  8. 将AJAX Post的Data转为对应的Class

    在使用DataTables从服务端获取数据时,在非MVC的情况下没有MVC的自动绑定功能,所以需要自己写一个绑定,将Post过来的InputStream转为对应的类. HTML: <form i ...

  9. Java生成指定范围内的工具类

    /** * 生成[min, max]之间的随机整数 * * @param min 最小整数 * @param max 最大整数 * @return * @author jqlin */ private ...

  10. lucene源码分析(4)Similarity相似度算法

    lucene 7.5.0默认的评分Similarity是BM25Similarity (IndexSearcher.java) // the default Similarity private st ...