Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
addString(text:font:fontSize:language:meta:)
Adds text span and font to draw it.
TextParagraph.swift:529final func addString(text: String, font: Font?, fontSize: Int32, language: String = "", meta: Variant) -> Bool
Other members in extension
Type members
Instance members
var alignment: HorizontalAlignment
Paragraph horizontal alignment.
var breakFlags: TextServer.LineBreakFlag
Line breaking rules. For more info see
TextServer
.var customPunctuation: String
Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
var direction: TextServer.Direction
Text writing direction.
var justificationFlags: TextServer.JustificationFlag
Line fill alignment rules. For more info see
TextServer.JustificationFlag
.var maxLinesVisible: Int32
Limits the lines of text shown.
var orientation: TextServer.Orientation
Text orientation.
var preserveControl: Bool
If set to
true
text will display control characters.var preserveInvalid: Bool
If set to
true
text will display invalid characters.var textOverrunBehavior: TextServer.OverrunBehavior
Sets the clipping behavior when the text exceeds the paragraph’s set width. See
TextServer.OverrunBehavior
for a description of all modes.var width: Double
Paragraph width.
func addObject(key: Variant, size: Vector2, inlineAlign: InlineAlignment, length: Int32, baseline: Double
) -> Bool Adds inline object to the text buffer,
key
must be unique. In the text, object is represented aslength
object replacement characters.func clear(
) Clears text paragraph (removes text and inline objects).
func clearDropcap(
) Removes dropcap.
func draw(canvas: RID, pos: Vector2, color: Color, dcColor: Color
) Draw all lines of the text and drop cap into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func drawDropcap(canvas: RID, pos: Vector2, color: Color
) Draw drop cap into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func drawDropcapOutline(canvas: RID, pos: Vector2, outlineSize: Int32, color: Color
) Draw drop cap outline into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func drawLine(canvas: RID, pos: Vector2, line: Int32, color: Color
) Draw single line of text into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func drawLineOutline(canvas: RID, pos: Vector2, line: Int32, outlineSize: Int32, color: Color
) Draw outline of the single line of text into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func drawOutline(canvas: RID, pos: Vector2, outlineSize: Int32, color: Color, dcColor: Color
) Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with
color
.pos
specifies the top left corner of the bounding box.func getDropcapLines(
) -> Int32 Returns number of lines used by dropcap.
func getDropcapRid(
) -> RID Returns drop cap text buffer RID.
func getDropcapSize(
) -> Vector2 Returns drop cap bounding box size.
func getLineAscent(line: Int32
) -> Double Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
func getLineCount(
) -> Int32 Returns number of lines in the paragraph.
func getLineDescent(line: Int32
) -> Double Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
func getLineObjectRect(line: Int32, key: Variant
) -> Rect2 Returns bounding rectangle of the inline object.
func getLineObjects(line: Int32
) -> GArray Returns array of inline objects in the line.
func getLineRange(line: Int32
) -> Vector2i Returns character range of the line.
func getLineRid(line: Int32
) -> RID Returns TextServer line buffer RID.
func getLineSize(line: Int32
) -> Vector2 Returns size of the bounding box of the line of text.
func getLineUnderlinePosition(line: Int32
) -> Double Returns pixel offset of the underline below the baseline.
func getLineUnderlineThickness(line: Int32
) -> Double Returns thickness of the underline.
func getLineWidth(line: Int32
) -> Double Returns width (for horizontal layout) or height (for vertical) of the line of text.
func getNonWrappedSize(
) -> Vector2 Returns the size of the bounding box of the paragraph, without line breaks.
func getRid(
) -> RID Returns TextServer full string buffer RID.
func getSize(
) -> Vector2 Returns the size of the bounding box of the paragraph.
func hitTest(coords: Vector2
) -> Int32 Returns caret character offset at the specified coordinates. This function always returns a valid position.
func resizeObject(key: Variant, size: Vector2, inlineAlign: InlineAlignment, baseline: Double
) -> Bool Sets new size and alignment of embedded object.
func setBidiOverride(GArray
) Overrides BiDi for the structured text.
func setDropcap(text: String, font: Font?, fontSize: Int32, dropcapMargins: Rect2, language: String
) -> Bool Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
func tabAlign(tabStops: PackedFloat32Array
) Aligns paragraph to the given tab-stops.