Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CTFrameMBS class

Super class: CFObjectMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class CoreText MBS MacCG Plugin 14.2 Yes No No Yes, macOS only No
Function: The CTFrame opaque type represents a frame containing multiple lines of text.
Example:
dim longText as string = "Lorem ipsum dolor sit amet..."

dim ct as new CFStringMBS(longText)
dim s as new CFAttributedStringMBS(ct, nil)

// layout master
dim framesetter as CTFramesetterMBS = CTFramesetterMBS.CreateWithAttributedString(s)

// a column
dim ColumnPath as new CGMutablePathMBS
dim Rect as new CGRectMBS(0, 0, g.Width, g.Height)
ColumnPath.AddRect nil, Rect

// context
dim CGContextHandle as Integer = g.Handle(g.HandleTypeCGContextRef)
dim CGContext as CGContextMBS = CGContextMBS.contextWithCGContext(CGContextHandle)

CGContext.SaveGState
// reset text matrix
dim a as CGAffineTransformMBS = CGAffineTransformMBS.Identity
CGContext.TextMatrix = a

dim Frame as CTFrameMBS = framesetter.CreateFrame(0, 0, ColumnPath, nil)

// draw
Frame.Draw(CGContext)

// cleanup
CGContext.RestoreGState
CGContext.Flush
Notes:
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.
Subclass of the CFObjectMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Feedback, Comments & Corrections

Fill rules

Constant Value Description
kCTFramePathFillEvenOdd 0 Text is filled in the area that would be painted if the path were given to CGContextMBS.EOFillPath.
Available in OS X v10.7 and later.
kCTFramePathFillWindingNumber 1 Text is fill in the area that would be painted if the path were given to CGContextMBS.FillPath.
Available in OS X v10.7 and later.

Frame Progression Types

Constant Value Description
kCTFrameProgressionLeftToRight 2 Lines are stacked left to right for vertical text.
The lines of text within a frame may be stacked for either horizontal or vertical text. Values are enumerated for each stacking type supported by CTFrame. Frames created with a progression type specifying vertical text rotate lines 90 degrees counterclockwise when drawing.
kCTFrameProgressionRightToLeft 1 Lines are stacked right to left for vertical text.
The lines of text within a frame may be stacked for either horizontal or vertical text. Values are enumerated for each stacking type supported by CTFrame. Frames created with a progression type specifying vertical text rotate lines 90 degrees counterclockwise when drawing.
kCTFrameProgressionTopToBottom 0 Lines are stacked top to bottom for horizontal text.
The lines of text within a frame may be stacked for either horizontal or vertical text. Values are enumerated for each stacking type supported by CTFrame. Frames created with a progression type specifying vertical text rotate lines 90 degrees counterclockwise when drawing.

Super class CFObjectMBS

This class has no sub classes.

Some methods using this class:

Some examples which use this class:


The items on this page are in the following plugins: MBS MacCF Plugin, MBS MacCG Plugin.


CTFontMBS   -   CTFramesetterMBS





Links
MBS FileMaker blog