Back to index



Class Methods


Instance Methods

 render  ascent  bold?  bold=  italic?  italic=  descent  h  linesize  underline?  underline=  size


Class Methods filename, size )

This will create a new font object. The given file must be a filename of a TTF file. The size represents the height of the font in pixels.

Instance Methods

TrueTypeFont#render(text, antialias, fore_RGBA)
TrueTypeFont#render(text, antialias, fore_RGBA, back_RGBA)

Render the given text onto a new image surface. Antialiasing will smooth the edges of the font for a much cleaner look. The foreground and background color are both RGBA, the alpha component is ignored if given. If the background color is omitted, the text will have a transparent background.


Returns the ascent for the font. The ascent is the number of pixels from the font baseline to the top of the font.

TrueTypeFont#bold=( onOrOff )

Controls the bold attribute for the font. Making the font bold does not work as well as you expect.

TrueTypeFont#italic=( onOrOff )

Controls the italics attribute of the font.


Returns the descent for the font. The descent is the number of pixels from the font baseline to the bottom of the font.


Returns the average size of each glyph in the font.


Returns the linesize for the font. Each font comes with it's own recommendation for the spacing number of pixels between each line of the font.

TrueTypeFont#underline=( onOrOff )

Controls the underline attribute of the font.

TrueTypeFont#size( text )

Returns the size in pixels that this text would need. [w,h]

Back to index