Instance Method

showTextAtPoint(x:y:string:length:)

Displays a character string at a position you specify.

Declaration

func showTextAtPoint(x: CGFloat, y: CGFloat, string: UnsafePointer<Int8>, length: Int)

Parameters

x

A value for the x-coordinate (in user space) at which to display the text.

y

A value for the y-coordinate (in user space) at which to display the text.

string

An array of characters to draw.

length

The length of the array specified in the string parameter.

Discussion

Core Graphics uses font data provided by the system to map each byte of the array through the encoding vector of the current font to obtain the glyph to display. Note that the font must have been set using selectFont(name:size:textEncoding:). Don’t use CGContextShowTextAtPoint in conjunction with setFont(_:).

See Also

Drawing Text

var textMatrix: CGAffineTransform

Returns the current text matrix.

var textPosition: CGPoint

Returns the location at which text is drawn.

func selectFont(name: UnsafePointer<Int8>, size: CGFloat, textEncoding: CGTextEncoding)

Sets the font and font size in a graphics context.

Deprecated
func setCharacterSpacing(CGFloat)

Sets the current character spacing.

func setFont(CGFont)

Sets the platform font in a graphics context.

func setFontSize(CGFloat)

Sets the current font size.

func setTextDrawingMode(CGTextDrawingMode)

Sets the current text drawing mode.

enum CGTextDrawingMode

Modes for rendering text.

func setAllowsFontSmoothing(Bool)

Sets whether or not to allow font smoothing for a graphics context.

func setAllowsFontSubpixelPositioning(Bool)

Sets whether or not to allow subpixel positioning for a graphics context

func setAllowsFontSubpixelQuantization(Bool)

Sets whether or not to allow subpixel quantization for a graphics context

func setShouldSmoothFonts(Bool)

Enables or disables font smoothing in a graphics context.

func setShouldSubpixelPositionFonts(Bool)

Enables or disables subpixel positioning in a graphics context.

func setShouldSubpixelQuantizeFonts(Bool)

Enables or disables subpixel quantization in a graphics context.

func showGlyphs(g: UnsafePointer<CGGlyph>?, count: Int)

Displays an array of glyphs at the current text position.

Deprecated
func showGlyphs([CGGlyph], at: [CGPoint])

Draws a set of glyphs at a set of corresponding positions.

func showGlyphsAtPoint(x: CGFloat, y: CGFloat, glyphs: UnsafePointer<CGGlyph>?, count: Int)

Displays an array of glyphs at a position you specify.

Deprecated
func showText(string: UnsafePointer<Int8>, length: Int)

Displays a character array at the current text position, a point specified by the current text matrix.

Deprecated