Back to index

Index


TrueTypeFont
Class Methods
TrueTypeFont.new( filename, size )
Instance Methods
TrueTypeFont#render(text, antialias, fore_RGBA)
TrueTypeFont#render(text, antialias, fore_RGBA, back_RGBA)
TrueTypeFont#ascent
TrueTypeFont#bold?
TrueTypeFont#bold=( onOrOff )
TrueTypeFont#italic?
TrueTypeFont#italic=( onOrOff )
TrueTypeFont#descent
TrueTypeFont#h
TrueTypeFont#linesize
TrueTypeFont#underline?
TrueTypeFont#underline=( onOrOff )
TrueTypeFont#size( text )

TrueTypeFont

Class Methods

TrueTypeFont.new( 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.

TrueTypeFont#ascent

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?
TrueTypeFont#bold=( onOrOff )

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

TrueTypeFont#italic?
TrueTypeFont#italic=( onOrOff )

Controls the italics attribute of the font.

TrueTypeFont#descent

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

TrueTypeFont#h

Returns the average size of each glyph in the font.

TrueTypeFont#linesize

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?
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