X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-TTF.html-inc;h=91fdfbfddc7d3ea5ebb17f6639de1a6941c70aaa;hb=master;hp=3722787fd63fa4b140f3a63afbc4bd754346d263;hpb=25fbbc5b1925a2d0566e3c63b941bae6fe4751d3;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-TTF.html-inc b/pages/SDL-TTF.html-inc index 3722787..91fdfbf 100644 --- a/pages/SDL-TTF.html-inc +++ b/pages/SDL-TTF.html-inc @@ -93,7 +93,7 @@ -
The constants are not exported by default. You can export them into your namespace by doing:
-use SDL::TTF qw(:hinting :style); +The constants are exported by default. You can avoid this by doing:
+use SDL::TTF ();-or access them directly:
+and access them directly:
SDL::TTF::TTF_HINTING_NORMAL;@@ -189,8 +189,8 @@ SDL does not have to be initialized before this call.
Query the initilization status of the truetype font API. -You may, of course, use this before SDL::TTF::init to avoid initializing twice in a row. Or use this to determine if you need to call -SDL::TTF::quit.
+You may, of course, use this before SDL::TTF::init to avoid initializing twice in a row. Or use this to determine if you need to +call SDL::TTF::quit.Shutdown and cleanup the truetype font API. -After calling this the SDL::TTF functions should not be used, excepting SDL::TTF::was_init. You may, of course, use SDL::TTF::init to -use the functionality again
+After calling this the SDL::TTF functions should not be used, excepting SDL::TTF::was_init. You may, of course, use +SDL::TTF::init to use the functionality againmy $font = SDL::TTF::open_font($font_file, $point_size);-
Load file for use as a font, at the given size. This is actually SDL::TTF::open_font_index(..., ..., $index = 0)
. This can load TTF and FON files.
Load file for use as a font, at the given size. This is actually SDL::TTF::open_font_index(..., ..., $index = 0)
. This can load TTF, OTF and FON files.
Returns: a SDL::TTF::Font object. undef
is returned on errors.
Example:
use SDL::TTF; @@ -624,22 +624,22 @@ is done to get the actual width. The height returned in h is the same as you canNote: See space-character bug. You have to upgrade libfreetype2 to at least version 2.3.5
Example:
-use SDL; - use SDL::Rect; - use SDL::Video; - use SDL::Color; - use SDL::TTF; - use SDL::TTF::Font; +use SDL; + use SDL::Rect; + use SDL::Video; + use SDL::Color; + use SDL::TTF; + use SDL::TTF::Font; - SDL::init(SDL_INIT_VIDEO); - SDL::TTF::init(); - my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); - my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24'); - die 'Coudnt make font '. SDL::get_error if !$font; - my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF)); - SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480)); - SDL::Video::update_rect($display, 0, 0, 0, 0); - SDL::delay(5000); + SDL::init(SDL_INIT_VIDEO); + SDL::TTF::init(); + my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); + my $font = SDL::TTF::open_font('somefont.ttf', '24'); + die 'Coudnt make font '. SDL::get_error if !$font; + my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF)); + SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480)); + SDL::Video::update_rect($display, 0, 0, 0, 0); + SDL::delay(5000);@@ -695,8 +695,10 @@ your display-surface. SDL::init(SDL_INIT_VIDEO); + SDL::TTF::init(); + my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); - my $font = SDL::TTF::open_font('arial.ttf', '24); + my $font = SDL::TTF::open_font('arial.ttf', '24'); my $white = SDL::Color->new(0xFF, 0xFF, 0xFF); my $black = SDL::Color->new(0x00, 0x00, 0x00); my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', $white, $black); @@ -756,8 +758,10 @@ your display-surface. SDL::init(SDL_INIT_VIDEO); + SDL::TTF::init(); + my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); - my $font = SDL::TTF::open_font('arial.ttf', '24); + my $font = SDL::TTF::open_font('arial.ttf', '24'); my $surface = SDL::TTF::render_text_blended($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF)); SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480)); @@ -785,9 +789,9 @@ your display-surface.Note: The unicode char has to be passed exactly like for SDL::TTF::size_unicode.
-AUTHOR
-