SDL::Font - Parrot class representing fonts in Parrot SDL
# load this library load_bytecode 'SDL/Font.pir' # create a new SDL::Font object .local pmc font font = new ['SDL'; 'Font'] font.'init'( 'font_file' => 'myfont.ttf', 'point_size' => 48 ) # draw text to the screen # presuming you have an SDL::Surface, SDL::Color, and SDL::Rect here... font.'draw'( 'some text', font_color, destination_surface, dest_rect ) # or render it to a surface to use later font.'render_text'( 'some text', font_color )
A SDL::Font object represents a TrueType font in SDL. You can use this to draw fonts to any SDL::Surface.
All SDL::Font objects have the following methods:
Given a list of key-value pairs containing arguments, set the attributes of this font. The valid keys are
point_size, two strings containing the path to a TrueType font to load and the size of the font when drawn, in pixels.
Given a string of text to draw, an
SDL::Color object representing the color of the text to draw, a
SDL::Surface to which to draw, and a
SDL::Rect representing the placement of the text within the surface, draws some text.
Renders a string of text of the given
SDL::Color. This returns a new
SDL::Surface containing the rendered font.
Returns the underlying
SDL_Font structure this object wraps. You should never need to call this directly unless you're calling SDL functions directly, in which case why not send me a patch?
Gets or sets the point size associated with this font object. The single argument is an integer and is optional.
Written and maintained by chromatic, <chromatic at wgz dot org>. Please send patches, feedback, and suggestions to the Perl 6 Internals mailing list.
Copyright (C) 2004-2008, Parrot Foundation.