博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
TEXTMETRIC 结构详解
阅读量:5328 次
发布时间:2019-06-14

本文共 4605 字,大约阅读时间需要 15 分钟。

函数GetTextMetrics可以获取一个字体文本度量并将它放入一个类型为TEXTMETRIC的数据结构中,该结构如下所示:

 

 

typedef struct ta

 

TEXTMETRIC

The TEXTMETRIC structure contains basic information about a physical font. All sizes are specified in logical units; that is, they depend on the current mapping mode of the display context.

typedef struct tagTEXTMETRIC { 

  LONG tmHeight; 
  LONG tmAscent; 
  LONG tmDescent; 
  LONG tmInternalLeading; 
  LONG tmExternalLeading; 
  LONG tmAveCharWidth; 
  LONG tmMaxCharWidth; 
  LONG tmWeight; 
  LONG tmOverhang; 
  LONG tmDigitizedAspectX; 
  LONG tmDigitizedAspectY; 
  TCHAR tmFirstChar; 
  TCHAR tmLastChar; 
  TCHAR tmDefaultChar; 
  TCHAR tmBreakChar; 
  BYTE tmItalic; 
  BYTE tmUnderlined; 
  BYTE tmStruckOut; 
  BYTE tmPitchAndFamily; 
  BYTE tmCharSet; 
} TEXTMETRIC, *PTEXTMETRIC; Members
tmHeight 
Specifies the height (ascent + descent) of characters. 
tmAscent 
Specifies the ascent (units above the base line) of characters. 
tmDescent 
Specifies the descent (units below the base line) of characters. 
tmInternalLeading 
Specifies the amount of leading (space) inside the bounds set by the tmHeight member. Accent marks and other diacritical characters may occur in this area. The designer may set this member to zero. 
tmExternalLeading 
Specifies the amount of extra leading (space) that the application adds between rows. Since this area is outside the font, it contains no marks and is not altered by text output calls in either OPAQUE or TRANSPARENT mode. The designer may set this member to zero. 
tmAveCharWidth 
Specifies the average width of characters in the font (generally defined as the width of the letter x). This value does not include the overhang required for bold or italic characters. 
tmMaxCharWidth 
Specifies the width of the widest character in the font. 
tmWeight 
Specifies the weight of the font. 
tmOverhang 
Specifies the extra width per string that may be added to some synthesized fonts. When synthesizing some attributes, such as bold or italic, graphics device interface (GDI) or a device may have to add width to a string on both a per-character and per-string basis. For example, GDI makes a string bold by expanding the spacing of each character and overstriking by an offset value; it italicizes a font by shearing the string. In either case, there is an overhang past the basic string. For bold strings, the overhang is the distance by which the overstrike is offset. For italic strings, the overhang is the amount the top of the font is sheared past the bottom of the font. 
The tmOverhang member enables the application to determine how much of the character width returned by a GetTextExtentPoint32 function 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 minus the overhang.

tmDigitizedAspectX 

Specifies the horizontal aspect of the device for which the font was designed. 
tmDigitizedAspectY 
Specifies the vertical aspect of the device for which the font was designed. The ratio of the tmDigitizedAspectX and tmDigitizedAspectY members is the aspect ratio of the device for which the font was designed. 
tmFirstChar 
Specifies the value of the first character defined in the font. 
tmLastChar 
Specifies the value of the last character defined in the font. 
tmDefaultChar 
Specifies the value of the character to be substituted for characters not in the font. 
tmBreakChar 
Specifies the value of the character that will be used to define word breaks for text justification. 
tmItalic 
Specifies an italic font if it is nonzero. 
tmUnderlined 
Specifies an underlined font if it is nonzero. 
tmStruckOut 
Specifies a strikeout font if it is nonzero. 
tmPitchAndFamily 
Specifies information about the pitch, the technology, and the family of a physical font. 
The four low-order bits of this member specify information about the pitch and the technology of the font. A constant is defined for each of the four bits.

gTEXTMETRIC { // tm 

    LONG tmHeight;                  //字符高度
    LONG tmAscent;                  //字符上部高度(基线以上)
    LONG tmDescent;                 //字符下部高度(基线以下)
    LONG tmInternalLeading;         //由tmHeight定义的字符高度的顶部空间数目
    LONG tmExternalLeading;         //加在两行之间的空间数目
    LONG tmAveCharWidth;            //平均字符宽度
    LONG tmMaxCharWidth;            //最宽字符的宽度
    LONG tmWeight;                  //字体的粗细轻重程度
    LONG tmOverhang;                //加入某些拼接字体上的附加高度
    LONG tmDigitizedAspectX;        //字体设计所针对的设备水平方向
    LONG tmDigitizedAspectY;        //字体设计所针对的设备垂直方向
    BCHAR tmFirstChar;              //为字体定义的第一个字符
    BCHAR tmLastChar;               //为字体定义的最后一个字符
    BCHAR tmDefaultChar;            //字体中所没有字符的替代字符
    BCHAR tmBreakChar;              //用于拆字的字符
    BYTE tmItalic;                  //字体为斜体时非零
    BYTE tmUnderlined;              //字体为下划线时非零
    BYTE tmStruckOut;               //字体被删去时非零
    BYTE tmPitchAndFamily;          //字体间距(低4位)和族(高4位)
    BYTE tmCharSet;                 //字体的字符集
} TEXTMETRIC;

 

 

转载于:https://www.cnblogs.com/songtzu/p/3539782.html

你可能感兴趣的文章
管道,数据共享,进程池
查看>>
SDUTOJ3754_黑白棋(纯模拟)
查看>>
php中的isset和empty的用法区别
查看>>
把word文档中的所有图片导出
查看>>
ubuntu 18.04取消自动锁屏以及设置键盘快捷锁屏
查看>>
正则表达式
查看>>
arcgis api 4.x for js 结合 Echarts4 实现散点图效果(附源码下载)
查看>>
YTU 2625: B 构造函数和析构函数
查看>>
apache自带压力测试工具ab的使用及解析
查看>>
加固linux
查看>>
WPF中Image显示本地图片
查看>>
Hyper-V虚拟机上安装一个图形界面的Linux系统
查看>>
js千分位处理
查看>>
字符串类型的相互转换
查看>>
基础学习:C#中float的取值范围和精度
查看>>
Vim配置Node.js开发工具
查看>>
web前端面试题2017
查看>>
ELMAH——可插拔错误日志工具
查看>>
MySQL学习笔记(四)
查看>>
【Crash Course Psychology】2. Research & Experimentation笔记
查看>>