|parrotcode: Parrot class representing fonts in Parrot SDL|
|Contents | Libraries|
SDL::Font - Parrot class representing fonts in Parrot SDL
# load this library load_bytecode 'library/SDL/Font.pir' # set the font's arguments .local pmc font_args font_args = new PerlHash font_args[ 'font_file' ] = 'myfont.ttf' font_args[ 'point_size' ] = 48 # create a new SDL::Font object .local pmc font .local int font_type find_type font_type, 'SDL::Font' font = new font_type, font_args # 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:
point_size, two strings containing the path to a TrueType font to load and the size of the font when drawn, in pixels.
SDL::Colorobject representing the color of the text to draw, a
SDL::Surfaceto which to draw, and a
SDL::Rectrepresenting the placement of the text within the surface, draws some text.
SDL::Color. This returns a new
SDL::Surfacecontaining the rendered font.
SDL_Fontstructure 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?
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, The Perl Foundation.