zoukankan      html  css  js  c++  java
  • 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来绘制

      

  • 相关阅读:
    Winform中实现ZedGraph曲线图缩放后复原功能
    MySQL Workbench 安装失败 Mysql workbench requires the visual C++ 2019 redistributable package
    MySQL Workbench 8.0提示SSL connection error: SSL is required but the server doesn‘t support it
    域名证书有效,但是访问提示不安全连接
    图片Base64编码
    centos系统设置防火墙
    《中有成就秘笈》之中央密严刹土
    Arweave
    去中心化身份聚合器
    区块链跨链技术
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3570405.html
Copyright © 2011-2022 走看看