CoreText(三) CTFrameRef CTFramesetterRef CTLineRef

来源:互联网 发布:淘宝店铺首页无法打开 编辑:程序博客网 时间:2024/05/19 14:40

1 CTFrameRef

The CTFrame opaque type represents a frame containing multiple lines of text. The frame object is the output resulting from the text-framing process performed by a framesetter object.

You can draw the entire text frame directly into the current graphic context. The frame object contains an array of line objects that can be retrieved for individual rendering or to get glyph information.

Functions by Task

Getting Frame Data

  • CTFrameGetStringRange
  • CTFrameGetVisibleStringRange
  • CTFrameGetPath
  • CTFrameGetFrameAttributes

Getting Lines

  • CTFrameGetLines
  • CTFrameGetLineOrigins

Drawing the Frame

  • CTFrameDraw

Getting the Type Identifier

  • CTFrameGetTypeID


2 CTFramesetterRef

The CTFramesetter opaque type is used to generate text frames. That is, CTFramesetter is an object factory for CTFrame objects.

The framesetter takes an attributed string object and a shape descriptor object and calls into the typesetter to create line objects that fill that shape. The output is a frame object containing an array of lines. The frame can then draw itself directly into the current graphic context.

Functions by Task

Creating a Framesetter

  • CTFramesetterCreateWithAttributedString

Creating Frames

  • CTFramesetterCreateFrame
  • CTFramesetterGetTypesetter

Frame Sizing

  • CTFramesetterSuggestFrameSizeWithConstraints

Getting the Type Identifier

  • CTFramesetterGetTypeID


3 CTLineRef

The CTLine opaque type represents a line of text.

A CTLine object contains an array of glyph runs. Line objects are created by the typesetter during a framesetting operation and can draw themselves directly into a graphics context.

Functions by Task

Creating Lines

  • CTLineCreateWithAttributedString
  • CTLineCreateTruncatedLine
  • CTLineCreateJustifiedLine

Drawing the Line

  • CTLineDraw

Getting Line Data

  • CTLineGetGlyphCount
  • CTLineGetGlyphRuns
  • CTLineGetStringRange
  • CTLineGetPenOffsetForFlush

Measuring Lines

  • CTLineGetImageBounds
  • CTLineGetTypographicBounds
  • CTLineGetTrailingWhitespaceWidth

Getting Line Positioning

  • CTLineGetStringIndexForPosition
  • CTLineGetOffsetForStringIndex

Getting the Type Identifier

  • CTLineGetTypeID


原创粉丝点击