class Crame::Text

Overview

A Text is a Drawable element that represents a string of text.

Any methods in this class is meant to modify the actual content of the text in any way.

Included Modules

Defined in:

crame/text.cr

Constructors

Instance Method Summary

Instance methods inherited from module Crame::Drawable

draw(position : Vector2, angle : Float = 0.0, origin : Vector2 = Vector2.new(0, 0), scale : Vector2 = Vector2.new(1, 1), color : Color = Color.new(1, 1, 1, 1)) draw, finalize finalize, size : Vector2 size

Constructor Detail

def self.new(string : String, font : Font) #

Creates a new Text given its content and font.


Instance Method Detail

def <<(text : String) #

Appends a text at the end of self.


def delete(offset : Int, length : Int) : String #

Delete a substring on self given its offset and length, and returns it.


def finalize #

def font=(font : Font) #

Sets a new font on self.


def insert(offset : Int, string : String) #

Inserts a string of text on self at offset.


def text=(text : String) #

Sets a new text on self.