首页 > 其他 > 详细

Quartz2D Text

时间:2014-02-27 21:04:11      阅读:457      评论:0      收藏:0      [点我收藏+]

Quartz2D Text

  Quartz 2D provides a limited, low-level interface for drawing text encoded in the MacRoman text encoding and for drawing glyphs.

  Quartz 2D uses fonts, which are sets of shapes that are associated with characters, to draw text. A character abstractly represents the concept of, for example, a lowercase “b”, the number “2”, or the arithmetic operator “+”. You do not ever see a character on a display device. What you see on a display device is a glyph, the path that serves as the visual representation of the character.

  Font是把character与shape绑定起来的东西,character代表字符,glyph代表形状(path组成)。

  One glyph can represent one character, such as a lowercase “b”; more than one character, such as the “?” ligature, which is a single glyph representing two characters; or a nonprinting character, such as the space character. Quartz renders glyphs using font data provided by the Apple Type Services (ATS) framework.

How Quartz 2D Draws Text

  You specify the location of text in user space coordinates. The text matrix specifies the transform from text space to user space. The text position is stored in the tx and ty variables of the text matrix. When you first create a graphics context, it initializes the text matrix to the identity matrix; thus text space coordinates are initially the same as user space coordinates.

  Quartz conceptually concatenates the text matrix with the current transformation matrix and other parameters from the graphics state to produce the final text rendering matrix, the matrix actually used to draw the text on the page. The text matrix does not include the font size, which is always expressed in text space.

  When Quartz draws the text, it retrieves the relevant glyphs from the ATS font server and paints them using the current parameters in the graphics state, such as fill color (if the text is filled) and stroke color. After a drawing operation, the text position remains at the last point used to image the text.

  通过Text Matrix来控制字体,Graphics Context中存储了一些字体状态。

Controlling How Text Looks

  Some of the settings in the graphics state that apply to painting paths also apply to text drawing. Stroke color and fill color are two such attributes.

  bubuko.com,布布扣

Drawing Text

  

Quartz2D Text,布布扣,bubuko.com

Quartz2D Text

原文:http://www.cnblogs.com/tekkaman/p/3570405.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!