IOS开发之——Core Text对象模型(2)
Like a frame object, a line object is ready to draw. You simply set the text position in a Core Graphics context and have the line draw itself. Core Text uses the same placement strategy as Quartz, setting the origin of the text on the text baseline.
In Quartz, 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, that is, the matrix actually used to draw the text on the page.
举例来说,Core Text将创建一个CTRun来绘制一些红色文字,然后创建一个CTRun来绘制纯文本,然后再创建一个CTRun来绘制加粗文字等等。要注意,你不需要自己创建CTRun,Core Text将根据NSAttributedString的属性来自动创建CTRun。每个CTRun对象对应不同的属性,正因此,你可以自由的控制字体、颜色、字间距等等信息。
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- iPhone开发 对字符串进行url编码转换
- IOS开发学习一 :Cocoa环境熟悉和Xcode使用
- iphone的非arc形式的内存管理原理
- iPhone开发学习笔记005——使用XIB自定义一个UIVi
- ios 类文件中 ARC与非ARC的设置
- UIButton上使用UIEdgeInsetsMaketitle跟图片对齐
- Iphone数组一些基础操作NSArray/NSMutableArray
- Code Sign error: The identity 'iPhone Developer' doesn't mat
- ios中的银联支付
- ios5 编程关于@synthesize window = _window的理解






![[iPhone中级]iPhone团购信息客户端的开发 (二)](/uploads/allimg/131022/200H11235-0-lp.png)



