Class | Rubygame::TTF |
In: |
ext/rubygame/rubygame_screen.c
|
Parent: | Object |
TTF provides an interface to SDL_ttf, allowing TrueType Font files to be loaded and used to render text to Surfaces.
The TTF class must be initialized with the setup method before any TTF objects can be created or used.
This class is only usable if Rubygame was compiled with the SDL_ttf library. You may test if this feature is available with the usable? method. If you need more flexibility, you can check the library version that Rubygame was compiled against with the version method.
Create a new TTF object, which can render text to a Surface with a particular font style and size.
This function takes these arguments:
file: | filename of the TrueType font to use. Should be a TTF or FON file. |
size: | point size (based on 72DPI). (That means the height in pixels from the bottom of the descent to the top of the ascent.) |
Return the biggest descent (baseline to bottom; in pixels) of all glyphs in the font.
Return the recommended distance (in pixels) from a point on a line of text to the same point on the line of text below it.
Renders a string to a Surface with the font‘s style and the given color(s).
This method takes these arguments:
string: | the text string to render |
aa: | Use anti-aliasing if true. Enabling this makes the text look much nicer (smooth curves), but is much slower. |
fg: | the color to render the text, in the form [r,g,b] |
bg: | the color to use as a background for the text. This option can be omitted to have a transparent background. |
Renders a string to a Surface with the font‘s style and the given color(s).
This method takes these arguments:
string: | the text string to render |
aa: | Use anti-aliasing if true. Enabling this makes the text look much nicer (smooth curves), but is much slower. |
fg: | the color to render the text, in the form [r,g,b] |
bg: | the color to use as a background for the text. This option can be omitted to have a transparent background. |
Renders a string to a Surface with the font‘s style and the given color(s).
This method takes these arguments:
string: | the text string to render |
aa: | Use anti-aliasing if true. Enabling this makes the text look much nicer (smooth curves), but is much slower. |
fg: | the color to render the text, in the form [r,g,b] |
bg: | the color to use as a background for the text. This option can be omitted to have a transparent background. |
The width and height the text would be if it were rendered, without the overhead of actually rendering it.
The width and height the UNICODE encoded text would be if it were rendered, without the overhead of actually rendering it.
The width and height the UTF-8 encoded text would be if it were rendered, without the overhead of actually rendering it.