.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "pods::SDL::TTF 3pm" .TH pods::SDL::TTF 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SDL::TTF \- True Type Font functions (libfreetype) .SH CATEGORY .IX Header "CATEGORY" TTF .SH CONSTANTS .IX Header "CONSTANTS" The constants are exported by default. You can avoid this by doing: .PP .Vb 1 \& use SDL::TTF (); .Ve .PP and access them directly: .PP .Vb 1 \& SDL::TTF::TTF_HINTING_NORMAL; .Ve .PP Available constants for "hinting": .IP \(bu 4 TTF_HINTING_NORMAL .IP \(bu 4 TTF_HINTING_LIGHT .IP \(bu 4 TTF_HINTING_MONO .IP \(bu 4 TTF_HINTING_NONE .PP Available constants for "style": .IP \(bu 4 TTF_STYLE_NORMAL .IP \(bu 4 TTF_STYLE_BOLD .IP \(bu 4 TTF_STYLE_ITALIC .IP \(bu 4 TTF_STYLE_UNDERLINE .IP \(bu 4 TTF_STYLE_STRIKETHROUGH .SH METHODS .IX Header "METHODS" .SS "General methods" .IX Subsection "General methods" \fIlinked_version\fR .IX Subsection "linked_version" .PP .Vb 1 \& my $version = SDL::TTF::linked_version(); .Ve .PP This gives you the SDL::Version object which SDL_ttf lib is used on the system. No prior initialization needs to be done before these function is called. .PP Example: .PP .Vb 2 \& use SDL::TTF; \& use SDL::Version; \& \& my $version = SDL::TTF::linked_version(); \& \& printf("got version: %d.%d.%d\en", $version\->major, $version\->minor, $version\->patch); .Ve .PP \fIcompile_time_version\fR .IX Subsection "compile_time_version" .PP .Vb 1 \& my $version = SDL::TTF::compile_time_version(); .Ve .PP This gives you the SDL::Version object which SDL_ttf was present at compile time. .PP \fIinit\fR .IX Subsection "init" .PP .Vb 1 \& my $success = SDL::TTF::init(); .Ve .PP Initialize the truetype font API. This must be called before using other functions in this library, except SDL::TTF::was_init and SDL::TTF::linked_version. SDL does not have to be initialized before this call. .PP Returns: \f(CW0\fR on success, \f(CW\-1\fR on any error. .PP \fIwas_init\fR .IX Subsection "was_init" .PP .Vb 1 \& my $was_init = SDL::TTF::was_init(); .Ve .PP Query the initialization 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. .PP \fIquit\fR .IX Subsection "quit" .PP .Vb 1 \& SDL::TTF::quit(); .Ve .PP 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 .SS "Management functions" .IX Subsection "Management functions" \fIopen_font\fR .IX Subsection "open_font" .PP .Vb 1 \& my $font = SDL::TTF::open_font($font_file, $point_size); .Ve .PP Load file for use as a font, at the given size. This is actually \f(CW\*(C`SDL::TTF::open_font_index(..., ..., $index = 0)\*(C'\fR. This can load TTF, OTF and FON files. .PP Returns: a SDL::TTF::Font object. \f(CW\*(C`undef\*(C'\fR is returned on errors. .PP Example: .PP .Vb 2 \& use SDL::TTF; \& use SDL::TTF::Font; \& \& my $font = SDL::TTF::open_font(\*(Aqarial.ttf\*(Aq, 24); .Ve .PP \fIopen_font_index\fR .IX Subsection "open_font_index" .PP .Vb 1 \& my $font = SDL::TTF::open_font($font_file, $point_size, $face_index); .Ve .PP This is the same as SDL::TTF::open_font, except you can specify the face index of a font file containing multiple faces. This can load TTF and FON files. .PP \fIopen_font_RW\fR .IX Subsection "open_font_RW" .PP .Vb 1 \& my $font = SDL::TTF::open_font_RW($rwops_object, $free, $point_size); .Ve .PP This is the same as SDL::TTF::open_font, except you can pass an SDL::RWOps\-object. If you pass true as \f(CW$free\fR, the SDL::RWOps\-object will be freed by SDL_ttf library. Don't do this, perl will free this object for you. .PP Example: .PP .Vb 1 \& my $font = SDL::TTF::open_font_RW(SDL::RWOps\->new_file($font_file, \*(Aqr\*(Aq), 0, 24); .Ve .PP \fIopen_font_index_RW\fR .IX Subsection "open_font_index_RW" .PP .Vb 1 \& my $font = SDL::TTF::open_font_index_RW($rwops_object, $free, $point_size, $face_index); .Ve .PP This is the same as SDL::TTF::open_font_index, except you can pass an SDL::RWOps\-object. If you pass true as \f(CW$free\fR, the SDL::RWOps\-object will be freed by SDL_ttf library. Don't do this, perl will free this object for you. .SS Attributes .IX Subsection "Attributes" \fIGlobal attributes\fR .IX Subsection "Global attributes" .PP byte_swapped_unicode .IX Subsection "byte_swapped_unicode" .PP .Vb 1 \& SDL::TTF::byte_swapped_unicode( $bool ); .Ve .PP This function tells SDL_ttf whether UNICODE (2 bytes per character) text is generally byteswapped. A \f(CW\*(C`UNICODE_BOM_NATIVE\*(C'\fR or \&\f(CW\*(C`UNICODE_BOM_SWAPPED\*(C'\fR character in a string will temporarily override this setting for the remainder of that string, however this setting will be restored for the next one. The default mode is non-swapped, native endianness of the CPU. .PP \fIFont style\fR .IX Subsection "Font style" .PP get_font_style .IX Subsection "get_font_style" .PP .Vb 1 \& SDL::TTF::get_font_style($font); .Ve .PP Returns: The style as a bitmask composed of the following masks: .IP \(bu 4 TTF_STYLE_NORMAL .IP \(bu 4 TTF_STYLE_BOLD .IP \(bu 4 TTF_STYLE_ITALIC .IP \(bu 4 TTF_STYLE_UNDERLINE .IP \(bu 4 TTF_STYLE_STRIKETHROUGH (since SDL_ttf 2.0.10) .PP Example: .PP .Vb 1 \& my $style = SDL::TTF::get_font_style($font); \& \& print("normal\en") if $style == TTF_STYLE_NORMAL; \& print("bold\en") if $style & TTF_STYLE_BOLD; \& print("italic\en") if $style & TTF_STYLE_ITALIC; \& print("underline\en") if $style & TTF_STYLE_UNDERLINE; \& print("strikethrough\en") if $style & TTF_STYLE_STRIKETHROUGH; .Ve .PP set_font_style .IX Subsection "set_font_style" .PP .Vb 1 \& SDL::TTF::set_font_style($font, $style); .Ve .PP Set the rendering style of the loaded font. .PP \&\fBNote\fR: \f(CW\*(C`TTF_STYLE_UNDERLINE\*(C'\fR may cause surfaces created by \f(CW\*(C`SDL::TTF::render_glyph_*\*(C'\fR functions to be extended vertically, downward only, to encompass the underline if the original glyph metrics didn't allow for the underline to be drawn below. This does not change the math used to place a glyph using glyph metrics. On the other hand \f(CW\*(C`TTF_STYLE_STRIKETHROUGH\*(C'\fR doesn't extend the glyph, since this would invalidate the metrics used to position the glyph when blitting, because they would likely be extended vertically upward. There is perhaps a workaround, but it would require programs to be smarter about glyph blitting math than they are currently designed for. Still, sometimes the underline or strikethrough may be outside of the generated surface, and thus not visible when blitted to the screen. In this case, you should probably turn off these styles and draw your own strikethroughs and underlines. .PP get_font_outline .IX Subsection "get_font_outline" .PP .Vb 1 \& my $outline = SDL::TTF::get_font_outline($font); .Ve .PP Get the current outline width of the font, in pixels. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP set_font_outline .IX Subsection "set_font_outline" .PP .Vb 1 \& SDL::TTF::set_font_outline($font, $outline); .Ve .PP Set the outline pixel width of the loaded font. Use \f(CW0\fR(zero) to turn off outlining. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP \fIFont settings\fR .IX Subsection "Font settings" .PP get_font_hinting .IX Subsection "get_font_hinting" .PP .Vb 1 \& my $hinting = SDL::TTF::get_font_hinting($font); .Ve .PP Get the current hinting setting of the loaded font. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP Returns the hinting type matching one of the following defined values: .IP \(bu 4 TTF_HINTING_NORMAL .IP \(bu 4 TTF_HINTING_LIGHT .IP \(bu 4 TTF_HINTING_MONO .IP \(bu 4 TTF_HINTING_NONE .PP set_font_hinting .IX Subsection "set_font_hinting" .PP .Vb 1 \& SDL::TTF::set_font_hinting($font, $hinting); .Ve .PP Set the hinting of the loaded font. You should experiment with this setting if you know which font you are using beforehand, especially when using smaller sized fonts. If the user is selecting a font, you may wish to let them select the hinting mode for that font as well. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP Example: .PP .Vb 1 \& SDL::TTF::set_font_hinting($font, TTF_HINTING_LIGHT); .Ve .PP get_font_kerning .IX Subsection "get_font_kerning" .PP .Vb 1 \& my $kerning_enabled = SDL::TTF::get_font_kerning($font); .Ve .PP Get the current kerning setting of the loaded font. .PP Returns: \f(CW0\fR(zero) if kerning is disabled. A non-zero value is returned when enabled. The default for a newly loaded font is enabled(\f(CW1\fR). .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP \&\fBNote\fR: This function returns wrong values: See .PP set_font_kerning .IX Subsection "set_font_kerning" .PP .Vb 1 \& SDL::TTF::set_font_kerning($font, $kerning_enabled); .Ve .PP Set whether to use kerning when rendering the loaded font. This has no effect on individual glyphs, but rather when rendering whole strings of characters, at least a word at a time. Perhaps the only time to disable this is when kerning is not working for a specific font, resulting in overlapping glyphs or abnormal spacing within words. .PP Pass \f(CW0\fR to disable kerning, 1 to enable. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP \fIFont metrics\fR .IX Subsection "Font metrics" .PP font_height .IX Subsection "font_height" .PP .Vb 1 \& my $font_height = SDL::TTF::font_height($font); .Ve .PP Get the maximum pixel height of all glyphs of the loaded font. You may use this height for rendering text as close together vertically as possible, though adding at least one pixel height to it will space it so they can't touch. Remember that SDL_ttf doesn't handle multiline printing, so you are responsible for line spacing, see the SDL::TTF::font_line_skip as well. .PP font_ascent .IX Subsection "font_ascent" .PP .Vb 1 \& my $font_ascent = SDL::TTF::font_ascent($font); .Ve .PP Get the maximum pixel ascent of all glyphs of the loaded font. This can also be interpreted as the distance from the top of the font to the baseline. It could be used when drawing an individual glyph relative to a top point, by combining it with the glyph's \f(CW\*(C`maxy\*(C'\fR metric to resolve the top of the rectangle used when blitting the glyph on the screen. .PP Example: .PP .Vb 1 \& my ($minx, $maxx, $miny, $maxy, $advance) = @{ SDL::TTF::glyph_metrics($font, "\e0M") }; \& \& $rect\->y( $top + SDL::TTF::font_ascent($font) \- $maxy ); .Ve .PP font_descent .IX Subsection "font_descent" .PP .Vb 1 \& my $font_descent = SDL::TTF::font_descent($font); .Ve .PP Get the maximum pixel descent of all glyphs of the loaded font. This can also be interpreted as the distance from the baseline to the bottom of the font. It could be used when drawing an individual glyph relative to a bottom point, by combining it with the glyph's \f(CW\*(C`maxy\*(C'\fR metric to resolve the top of the rectangle used when blitting the glyph on the screen. .PP Example: .PP .Vb 1 \& my ($minx, $maxx, $miny, $maxy, $advance) = @{ SDL::TTF::glyph_metrics($font, "\e0M") }; \& \& $rect\->y( $bottom \- SDL::TTF::font_descent($font) \- $maxy ); .Ve .PP font_line_skip .IX Subsection "font_line_skip" .PP .Vb 1 \& my $font_line_skip = SDL::TTF::font_line_skip($font); .Ve .PP Get the recommended pixel height of a rendered line of text of the loaded font. This is usually larger than the SDL::TTF::font_height of the font. .PP \fIFace attributes\fR .IX Subsection "Face attributes" .PP font_faces .IX Subsection "font_faces" .PP .Vb 1 \& my $font_faces = SDL::TTF::font_faces($font); .Ve .PP Get the number of faces ("sub-fonts") available in the loaded font. This is a count of the number of specific fonts (based on size and style and other typographical features perhaps) contained in the font itself. .PP font_face_is_fixed_width .IX Subsection "font_face_is_fixed_width" .PP .Vb 1 \& my $font_face_is_fixed_width = SDL::TTF::font_face_is_fixed_width($font); .Ve .PP Test if the current font face of the loaded font is a fixed width font. Fixed width fonts are monospace, meaning every character that exists in the font is the same width, thus you can assume that a rendered string's width is going to be the result of \f(CW\*(C`glyph_width * string_length\*(C'\fR. .PP Returns: \f(CW\*(C`>0\*(C'\fR if font is a fixed width font. \f(CW0\fR if not a fixed width font. .PP font_face_family_name .IX Subsection "font_face_family_name" .PP .Vb 1 \& my $font_face_family_name = SDL::TTF::font_face_family_name($font); .Ve .PP Get the current font face family name from the loaded font. This information is not for every font available. .PP Example: .PP .Vb 1 \& my $font = SDL::TTF::open_font(\*(Aqarialuni.ttf\*(Aq, 8); \& \& printf("%s\en", SDL::TTF::font_face_family_name($font)); # will print "Arial Unicode MS" .Ve .PP font_face_style_name .IX Subsection "font_face_style_name" .PP .Vb 1 \& my $font_face_style_name = SDL::TTF::font_face_style_name($font); .Ve .PP Get the current font face style name from the loaded font. This information is not for every font available. .PP Example: .PP .Vb 1 \& my $font = SDL::TTF::open_font(\*(Aqarialuni.ttf\*(Aq, 8); \& \& printf("%s\en", SDL::TTF::font_face_style_name($font)); # will print "Regular" .Ve .PP \fIGlyphs\fR .IX Subsection "Glyphs" .PP glyph_is_provided .IX Subsection "glyph_is_provided" .PP .Vb 1 \& my $glyph_is_provided = SDL::TTF::glyph_is_provided($font, $unicode_char); .Ve .PP Get the status of the availability of the glyph from the loaded font. .PP Returns: the index of the glyph in font, or 0 for an undefined character code. .PP \&\fBNote\fR: You have to pass this unicode character either as UTF16/UCS\-2 big endian without BOM, or with BOM as UTF16/UCS\-2 big/little endian. .PP \&\fBNote\fR: at least SDL_ttf 2.0.10 needed .PP Example: .PP .Vb 1 \& print("We have this char!\en") if SDL::TTF::glyph_is_provided($font, "\e0M"); .Ve .PP glyph_metrics .IX Subsection "glyph_metrics" .PP .Vb 1 \& my @glyph_metrics = @{ SDL::TTF::glyph_metrics($font, $unicode_char) }; .Ve .PP Get desired glyph metrics of the UNICODE char from the loaded font. .PP See also: The FreeType2 Documentation Tutorial .PP \&\fBNote\fR: You have to pass this unicode character either as UTF16/UCS\-2 big endian without BOM, or with BOM as UTF16/UCS\-2 big/little endian. .PP Example: .PP .Vb 1 \& my ($minx, $maxx, $miny, $maxy, $advance) = @{ SDL::TTF::glyph_metrics($font, "\e0M") }; .Ve .PP \fIText metrics\fR .IX Subsection "Text metrics" .PP size_text .IX Subsection "size_text" .PP .Vb 1 \& my ($width, $height) = @{ SDL::TTF::size_text($font, $text) }; .Ve .PP Calculate the resulting surface size of the LATIN1 encoded text rendered using \f(CW$font\fR. No actual rendering is done, however correct kerning is done to get the actual width. The height returned is the same as you can get using SDL::TTF::font_height. .PP size_utf8 .IX Subsection "size_utf8" .PP .Vb 1 \& my ($width, $height) = @{ SDL::TTF::size_utf8($font, $text) }; .Ve .PP Calculate the resulting surface size of the UTF8 encoded text rendered using \f(CW$font\fR. No actual rendering is done, however correct kerning is done to get the actual width. The height returned in h is the same as you can get using SDL::TTF::font_height. .PP Note that the first example uses the same text as in the LATIN1 example, that is because plain ASCII is UTF8 compatible. .PP Examples: .PP .Vb 1 \& ($width, $height) = @{ SDL::TTF::size_utf8($font, \*(AqHello World!\*(Aq) }; # plain text, if your script is in utf8 or ansi\-format \& \& # or \& \& ($width, $height) = @{ SDL::TTF::size_utf8($font, "\exE4\exBB\ex8A\exE6\ex97\exA5\exE3\ex81\exAF") }; # utf8 hex\-data \& \& # or \& \& use Unicode::String; \& my $unicode = utf8($data_from_somewhere); \& ($width, $height) = @{ SDL::TTF::size_utf8($font, $unicode\->utf8) }; # utf8 via Unicode::String .Ve .PP size_unicode .IX Subsection "size_unicode" .PP .Vb 1 \& my ($width, $height) = @{ SDL::TTF::size_unicode($font, $text) }; .Ve .PP Calculate the resulting surface size of the UNICODE encoded text rendered using \f(CW$font\fR. No actual rendering is done, however correct kerning is done to get the actual width. The height returned in h is the same as you can get using SDL::TTF::font_height. .PP \&\f(CW$text\fR has to be: .IP "UTF16BE without BOM" 4 .IX Item "UTF16BE without BOM" "hello" will look like "\e0h\e0e\e0l\e0l\e0o" .IP "UTF16BE with BOM" 4 .IX Item "UTF16BE with BOM" "hello" will look like "\exFE\exFF\e0h\e0e\e0l\e0l\e0o" .IP "UTF16LE with BOM" 4 .IX Item "UTF16LE with BOM" "hello" will look like "\exFF\exFEh\e0e\e0l\e0l\e0o\e0" .PP You may use Unicode::String for this. .SS "Font Rendering" .IX Subsection "Font Rendering" \fISolid\fR .IX Subsection "Solid" .PP render_glyph_solid .IX Subsection "render_glyph_solid" .PP .Vb 1 \& my $surface = SDL::TTF::render_glyph_solid($font, $char, $color); .Ve .PP Render the unicode encoded char onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode char has to be passed exactly like for SDL::TTF::size_unicode. .PP \&\fBNote\fR: See space-character bug . You have to upgrade libfreetype2 to at least version 2.3.5 .PP render_text_solid .IX Subsection "render_text_solid" .PP .Vb 1 \& my $surface = SDL::TTF::render_text_solid($font, $text, $color); .Ve .PP Render the LATIN1 encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: See space-character bug . You have to upgrade libfreetype2 to at least version 2.3.5 .PP Example: .PP .Vb 6 \& 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(\*(Aqsomefont.ttf\*(Aq, \*(Aq24\*(Aq); \& die \*(AqCoudnt make font \*(Aq. SDL::get_error if !$font; \& my $surface = SDL::TTF::render_text_solid($font, \*(AqHello!\*(Aq, 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); .Ve .PP render_utf8_solid .IX Subsection "render_utf8_solid" .PP .Vb 1 \& my $surface = SDL::TTF::render_utf8_solid($font, $text, $color); .Ve .PP Render the UTF8 encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: See space-character bug . You have to upgrade libfreetype2 to at least version 2.3.5 .PP render_unicode_solid .IX Subsection "render_unicode_solid" .PP .Vb 1 \& my $surface = SDL::TTF::render_unicode_solid($font, $text, $color); .Ve .PP Render the unicode encoded text onto a new surface, using the Solid mode. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode test has to be passed exactly like for SDL::TTF::size_unicode. .PP \&\fBNote\fR: See space-character bug . You have to upgrade libfreetype2 to at least version 2.3.5 .PP \fIShaded\fR .IX Subsection "Shaded" .PP render_glyph_shaded .IX Subsection "render_glyph_shaded" .PP .Vb 1 \& my $surface = SDL::TTF::render_glyph_shaded($font, $char, $color, $background_color); .Ve .PP Render the unicode encoded char onto a new surface. The surface is filled with \f(CW$background_color\fR. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode char has to be passed exactly like for SDL::TTF::size_unicode. .PP render_text_shaded .IX Subsection "render_text_shaded" .PP .Vb 1 \& my $surface = SDL::TTF::render_text_shaded($font, $text, $color, $background_color); .Ve .PP Render the LATIN1 encoded text onto a new surface. The surface is filled with \f(CW$background_color\fR. After that you can blit this surface to your display-surface. .PP Example: .PP .Vb 5 \& 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(\*(Aqarial.ttf\*(Aq, \*(Aq24\*(Aq); \& my $white = SDL::Color\->new(0xFF, 0xFF, 0xFF); \& my $black = SDL::Color\->new(0x00, 0x00, 0x00); \& my $surface = SDL::TTF::render_text_solid($font, \*(AqHello!\*(Aq, $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); .Ve .PP render_utf8_shaded .IX Subsection "render_utf8_shaded" .PP .Vb 1 \& my $surface = SDL::TTF::render_utf8_shaded($font, $text, $color, $background_color); .Ve .PP Render the UTF8 encoded text onto a new surface. The surface is filled with \f(CW$background_color\fR. After that you can blit this surface to your display-surface. .PP render_unicode_shaded .IX Subsection "render_unicode_shaded" .PP .Vb 1 \& my $surface = SDL::TTF::render_unicode_shaded($font, $text, $color, $background_color); .Ve .PP Render the unicode encoded text onto a new surface. The surface is filled with \f(CW$background_color\fR. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode text has to be passed exactly like for SDL::TTF::size_unicode. .PP \fIBlended\fR .IX Subsection "Blended" .PP render_glyph_blended .IX Subsection "render_glyph_blended" .PP .Vb 1 \& my $surface = SDL::TTF::render_glyph_blended($font, $char, $color); .Ve .PP Render the unicode encoded char onto a new surface. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode char has to be passed exactly like for SDL::TTF::size_unicode. .PP render_text_blended .IX Subsection "render_text_blended" .PP .Vb 1 \& my $surface = SDL::TTF::render_text_blended($font, $text, $color); .Ve .PP Render the LATIN1 encoded text onto a new surface. After that you can blit this surface to your display-surface. .PP Example: .PP .Vb 5 \& 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(\*(Aqarial.ttf\*(Aq, \*(Aq24\*(Aq); \& my $surface = SDL::TTF::render_text_blended($font, \*(AqHello!\*(Aq, 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); .Ve .PP render_utf8_blended .IX Subsection "render_utf8_blended" .PP .Vb 1 \& my $surface = SDL::TTF::render_utf8_blended($font, $text, $color); .Ve .PP Render the UTF8 encoded text onto a new surface. After that you can blit this surface to your display-surface. .PP render_unicode_blended .IX Subsection "render_unicode_blended" .PP .Vb 1 \& my $surface = SDL::TTF::render_unicode_blended($font, $text, $color); .Ve .PP Render the unicode encoded text onto a new surface. After that you can blit this surface to your display-surface. .PP \&\fBNote\fR: The unicode char has to be passed exactly like for SDL::TTF::size_unicode. .SH AUTHORS .IX Header "AUTHORS" See "AUTHORS" in SDL. .SH "SEE ALSO" .IX Header "SEE ALSO" SDL::TTF::Font, Unicode::String, SDL::Video, SDL::Surface