Platforms to show: All Mac Windows Linux Cross-Platform

CTFrameMBS class

Super class: CFObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
class CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
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
#If XojoVersion >= 2019.02 Then
Dim CGContextHandle As ptr = g.Handle(Graphics.HandleTypes.CGContextRef)
Dim CGContext As CGContextMBS = CGContextMBS.contextWithCGContext(CGContextHandle)
#Else
Dim CGContextHandle As Integer = g.Handle(g.HandleTypeCGContextRef)
Dim CGContext As CGContextMBS = CGContextMBS.contextWithCGContext(CGContextHandle)
#EndIf

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

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.

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. more
kCTFrameProgressionRightToLeft 1 Lines are stacked right to left for vertical text. more
kCTFrameProgressionTopToBottom 0 Lines are stacked top to bottom for horizontal text. more

Super class CFObjectMBS

This class has no sub classes.

Some methods using this class:

Some examples using this class:

Blog Entries


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


CTFontMBS   -   CTFramesetterMBS


The biggest plugin in space...