X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-TTF.html-inc;h=3722787fd63fa4b140f3a63afbc4bd754346d263;hb=25fbbc5b1925a2d0566e3c63b941bae6fe4751d3;hp=07f91140d178542e7d10f42e929c0f7aaf5290c3;hpb=148a0b32588c107b723f439e6682e3af3126cec9;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-TTF.html-inc b/pages/SDL-TTF.html-inc index 07f9114..3722787 100644 --- a/pages/SDL-TTF.html-inc +++ b/pages/SDL-TTF.html-inc @@ -4,6 +4,7 @@
TTF
+The constants are not exported by default. You can export them into your namespace by doing:
+use SDL::TTF qw(:hinting :style); + ++
or access them directly:
+SDL::TTF::TTF_HINTING_NORMAL; + ++
Available constants for "hinting":
+Available constants for "style":
+use SDL::TTF; use SDL::TTF::Font; - my $font = SDL::TTF::open_font('arial.ttf', '24); + my $font = SDL::TTF::open_font('arial.ttf', 24);@@ -594,22 +624,22 @@ is done to get the actual width. The height returned in h is the same as you can
Note: See space-character bug. You have to upgrade libfreetype2 to at least version 2.3.5
Example:
-use SDL; - use SDL::Video; - use SDL::Color; - use SDL::TTF; - use SDL::TTF::Font; - - SDL::init(SDL_INIT_VIDEO); - - my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); - my $font = SDL::TTF::open_font('arial.ttf', '24); - 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); +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);