X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=sdlgit%2FSDL-Site.git;a=blobdiff_plain;f=pages%2FSDL-TTF.html-inc;h=cff5ad17d91af95d15a476b3bad566ba7763d6f2;hp=709d1d3805b462b2728b31cdd0e9d164681d695d;hb=d5943b684b1240307fbf0a103abbf18dd93998f4;hpb=499f373103474546518b56aebfe2773c46c0e283 diff --git a/pages/SDL-TTF.html-inc b/pages/SDL-TTF.html-inc index 709d1d3..cff5ad1 100644 --- a/pages/SDL-TTF.html-inc +++ b/pages/SDL-TTF.html-inc @@ -4,6 +4,7 @@
TODO, TTF
+TTF
+ +The constants are exported by default. You can avoid this by doing:
+use SDL::TTF (); + + + + ++
and 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);@@ -340,6 +382,7 @@ using smaller sized fonts. If the user is selecting a font, you may wish to let
Get the current kerning setting of the loaded font.
Returns: 0
(zero) if kerning is disabled. A non-zero value is returned when enabled. The default for a newly loaded font is enabled(1
).
Note: at least SDL_ttf 2.0.10 needed
+Note: This function returns wrong values: See http://bugzilla.libsdl.org/show_bug.cgi?id=973
my $surface = SDL::TTF::render_glyph_solid($font, $char, $color); + ++
Render the unicode encoded char onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface.
+Note: The unicode char has to be passed exactly like for SDL::TTF::size_unicode.
+Note: See space-character bug. You have to upgrade libfreetype2 to at least version 2.3.5
my $surface = SDL::TTF::render_text_solid($font, $text, $color); + ++
Render the LATIN1 encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface.
+Note: 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; + + 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); + +
my $surface = SDL::TTF::render_utf8_solid($font, $text, $color); + ++
Render the UTF8 encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface.
+Note: See space-character bug. You have to upgrade libfreetype2 to at least +version 2.3.5
Note: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374062
+my $surface = SDL::TTF::render_unicode_solid($font, $text, $color); + ++
Render the unicode encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface.
+Note: The unicode test has to be passed exactly like for SDL::TTF::size_unicode.
+Note: See space-character bug. You have to upgrade libfreetype2 to at least +version 2.3.5
my $surface = SDL::TTF::render_glyph_shaded($font, $char, $color, $background_color); + ++
Render the unicode encoded char onto a new surface. The surface is filled with $background_color
. After that you can blit this surface to
+your display-surface.
Note: The unicode char has to be passed exactly like for SDL::TTF::size_unicode.
my $surface = SDL::TTF::render_text_shaded($font, $text, $color, $background_color); + ++
Render the LATIN1 encoded text onto a new surface. The surface is filled with $background_color
. After that you can blit this surface to
+your display-surface.
Example:
+use SDL; + 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('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); + + 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); + +
my $surface = SDL::TTF::render_utf8_shaded($font, $text, $color, $background_color); + ++
Render the UTF8 encoded text onto a new surface. The surface is filled with $background_color
. After that you can blit this surface to
+your display-surface.
my $surface = SDL::TTF::render_unicode_shaded($font, $text, $color, $background_color); + ++
Render the unicode encoded text onto a new surface. The surface is filled with $background_color
. After that you can blit this surface to
+your display-surface.
Note: The unicode text has to be passed exactly like for SDL::TTF::size_unicode.
my $surface = SDL::TTF::render_glyph_blended($font, $char, $color); + ++
Render the unicode encoded char onto a new surface. After that you can blit this surface to your display-surface.
+Note: The unicode char has to be passed exactly like for SDL::TTF::size_unicode.
+ +my $surface = SDL::TTF::render_text_blended($font, $text, $color); + ++
Render the LATIN1 encoded text onto a new surface. After that you can blit this surface to your display-surface.
+Example:
+use SDL; + 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('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)); + SDL::Video::update_rect($display, 0, 0, 0, 0); + + SDL::delay(5000); + +
my $surface = SDL::TTF::render_utf8_blended($font, $text, $color); + ++
Render the UTF8 encoded text onto a new surface. After that you can blit this surface to your display-surface.
+ +my $surface = SDL::TTF::render_unicode_blended($font, $text, $color); + ++
Render the unicode encoded text onto a new surface. After that you can blit this surface to your display-surface.
+Note: The unicode char has to be passed exactly like for SDL::TTF::size_unicode.