Quartz2D Text
【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 “fi” 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.

【最后】
The low-level support provided by Quartz has been deprecated and superceded by Core Text, an advanced low-level technology for laying out text and handing fonts. Core Text is designed for high performance and ease of use and allows you to draw Unicode text directly to a graphics context.
此文中的技术已经被CoreText替代, CoreText是一个高效易用,直接绘制Unicode文本到Graphics Context上的框架. CoreText通过生成CTFrameRef传递给CTFrameDraw来绘制,或通过生成CTLineRef通过CTLineDraw来绘制。
Quartz2D Text的更多相关文章
- Quartz2D复习(一)--- 基础知识 / 绘制线段圆弧 / 图片水印 / 截图
1.Quartz 2D是一个二维绘图引擎,同时支持ios和Mac系统: Quart2D的API是纯C语言的,API来自于Core Graphics框架: 2.Quartz 2D可以绘制图形(线段/三 ...
- iOS开发UI篇—Quartz2D使用(信纸条纹)
iOS开发UI篇—Quartz2D使用(信纸条纹) 一.前导程序 新建一个项目,在主控制器文件中实现以下几行代码,就能轻松的完成图片在视图中的平铺. #import "YYViewContr ...
- Sublime Text 3中文乱码解决方法以及安装包管理器方法
一般出现乱码是因为文本采用了GBK编码格式,Sublime Text默认不支持GBK编码. 安装包管理器 简单安装 使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令 ...
- requests的content与text导致lxml的解析问题
title: requests的content与text导致lxml的解析问题 date: 2015-04-29 22:49:31 categories: 经验 tags: [Python,lxml, ...
- xpath提取多个标签下的text
title: xpath提取多个标签下的text author: 青南 date: 2015-01-17 16:01:07 categories: [Python] tags: [xpath,Pyth ...
- 在Sublime Text 3上安装代码格式化插件CodeFormatter
1.了解CodeFormatter插件 在Sublime Text 3中编写代码,为了能让我们的代码格式变得漂亮整洁,需要一个能自动格式代码的插件.这里发现CodeFormatter插件不错,它能支持 ...
- React Native 之 Text的使用
前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...
- Quartz2D总结
天了噜,脑子完全懵了,最起码说出来个上下文啊,连这个都给忘了,特此总结一下,并以此缅怀这次面试 Quartz2D的API来自于Core Graphics(这就是为什么CGContextRef是以CG开 ...
- UGUI Text(Label)
环境 Unity 5.3.6f1 关于Best Fit 如果勾选了 Best Fit ,当有大量的文本填充在Text上时,那么文字是不会自动换行的. 打字机效果 在github上已有现成的:https ...
随机推荐
- TypeScript学习笔记(五) - 泛型
本篇将介绍在TypeScript如何使用泛型. 一.泛型方法 在TypeScript里,声明泛型方法有以下两种方式: function generics_func1<T>(arg: T): ...
- C#模板引擎 DotLiquid
DotLiquid 是一个简单.快速和安全的模板引擎,移植自 Ruby 的 Liquid 标签. 示例模板: <p>{{ user.name }} has to do:</p> ...
- FTP非交互式远程上传文件
由于项目需要,每月定时上传一份备份文件到远程备份机器. 机器拓扑结构如下: backup机器上启动ftp server,server1和server2分别安装ftp客户端 定时执行脚本如下: uplo ...
- nginix.conf 中的gzip模块设置
gizp模块配置 gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; g ...
- 收藏的一些github开源项目,在这里记录一下
1.在windows系统上在命令行中执行rm -fr */*.file 会报错, rimraf这个项目提供了跨平台支持rm命令,github地址: https://github.com/isaacs/ ...
- 使用JS获取当前地理位置方法汇总(如用谷歌接口,会出再以上报错,必须申请密钥并设置接受服务器IP!!!)
RefererNotAllowedMapError 错误 加载 Google Maps JavaScript API 的当前 URL 尚未添加到允许的引用站点列表中.请在 Google API Con ...
- 0122(本来是想ak的但是因为智障只拿了200。)
今天考了一场小测试,额,非常非常水,但是智障的我才A掉两道题. T1: 1.暑假作业 (mtime.pas/c/cpp) [问题描述] 暑假作业是必须要写的,越到假期结束前,写作业的效率就越高,小 ...
- ZOJ-3230-Solving the Problems
/*ZOJ Problem Set - 3230Solving the Problems ------------------------------------------------------- ...
- python爬虫 发送定时气象预报
python爬取天气情况 下面为示例代码: from urllib.request import urlopen from bs4 import BeautifulSoup from urllib.e ...
- 【好文转帖】控制反转(IOC)和依赖注入(DI)的区别
IOC inversion of control 控制反转 DI Dependency Injection 依赖注入 要理解这两个概念,首先要搞清楚以下几个问题: 参与者都有谁? 依赖:谁 ...