From: Tobias Leich
my $outline = SDL::TTF::get_font_outline($font); + ++
Get the current outline width of the font, in pixels.
+Note: at least SDL_ttf 2.0.10 needed
+ +SDL::TTF::get_font_outline($font, $outline); + ++
Set the outline pixel width of the loaded font. Use 0
(zero) to turn off outlining.
Note: at least SDL_ttf 2.0.10 needed
+ +my $font_height = SDL::TTF::font_height($font);+
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.
my $font_ascent = SDL::TTF::font_ascent($font); - like( $font_ascent, '/^[-]?\d+$/', "[font_ascent] offset from the baseline to the top of the font is $font_ascent" ); + ++
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 maxy
metric to resolve the top
+of the rectangle used when blitting the glyph on the screen.
Example:
+my ($minx, $maxx, $miny, $maxy, $advance) = @{ SDL::TTF::glyph_metrics($font, 'M') }; + + $rect->y( $top + SDL::TTF::font_ascent($font) - $maxy );@@ -356,7 +388,16 @@ overlapping glyphs or abnormal spacing within words.
my $font_descent = SDL::TTF::font_descent($font); - like( $font_descent, '/^[-]?\d+$/', "[font_descent] offset from the baseline to the bottom of the font is $font_descent" ); + ++
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 maxy
metric to resolve the top
+of the rectangle used when blitting the glyph on the screen.
Example:
+my ($minx, $maxx, $miny, $maxy, $advance) = @{ SDL::TTF::glyph_metrics($font, 'M') }; + + $rect->y( $bottom - SDL::TTF::font_descent($font) - $maxy );@@ -364,9 +405,10 @@ overlapping glyphs or abnormal spacing within words.
my $font_line_skip = SDL::TTF::font_line_skip($font); - like( $font_line_skip, '/^[-]?\d+$/', "[font_line_skip] recommended spacing between lines of text is $font_line_skip" );+
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.
Core | ||
![]() | SDL | - Simple DirectMedia Layer for Perl |
![]() | SDL::Time | - a SDL perl extension for managing timers. |
Audio | ||
![]() | SDL::Audio | - SDL Bindings for Audio |
Structure | ||
![]() | SDL::AudioCVT | - Audio Conversion Structure |
![]() | SDL::AudioSpec | - SDL Bindings for structure SDL::AudioSpec |
CDROM | ||
![]() | SDL::CDROM | - SDL Bindings for the CDROM device |
Structure | ||
![]() | SDL::CD | - SDL Bindings for structure SDL_CD |
![]() | SDL::CDTrack | - SDL Bindings for structure SDL_CDTrack |
Events | ||
![]() | SDL::Events | - Bindings to the Events Category in SDL API |
Structure | ||
![]() | SDL::Event | - General event structure |
Joystick | ||
![]() | SDL::Joystick | - SDL Bindings for the Joystick device |
Mouse | ||
![]() | SDL::Mouse | - SDL Bindings for the Mouse device |
Structure | ||
![]() | SDL::Cursor | - Mouse cursor structure |
Structure | ||
![]() | SDL::Version | - SDL Bindings for structure SDL_Version |
Video | ||
![]() | SDL::Video | - Bindings to the video category in SDL API |
Structure | ||
![]() | SDL::Color | - Format independent color description |
![]() | SDL::Overlay | - YUV Video overlay |
![]() | SDL::Palette | - Color palette for 8-bit pixel formats |
![]() | SDL::PixelFormat | - Stores surface format information |
![]() | SDL::Rect | - Defines a rectangular area |
![]() | SDL::Surface | - Graphic surface structure. |
![]() | SDL::VideoInfo | - Video Target Information |
Cookbook | ||
![]() | SDL::Cookbook | |
![]() | SDL::Cookbook::PDL |
Extension | ||
![]() | SDL::App | - a SDL perl extension |
GFX | ||
![]() | SDL::GFX::Framerate | - framerate calculating functions |
![]() | SDL::GFX::Primitives | - basic drawing functions |
Structure | ||
![]() | SDL::GFX::FPSManager | - data structure used by SDL::GFX::Framerate |
Image | ||
![]() | SDL::Image | - Bindings for the SDL_Image library |
Mixer | ||
![]() | SDL::Mixer | - Sound and music functions |
![]() | SDL::Mixer::Channels | - SDL::Mixer channel functions and bindings |
![]() | SDL::Mixer::Effects | - sound effect functions |
![]() | SDL::Mixer::Groups | - Audio channel group functions |
![]() | SDL::Mixer::Music | - functions for music |
![]() | SDL::Mixer::Samples | - functions for loading sound samples |
Structure | ||
![]() | SDL::Mixer::MixChunk | - SDL Bindings for structure SDL_MixChunk |
![]() | SDL::Mixer::MixMusic | - SDL Bindings for structure SDL_MixMusic |
TODO |
Core |
MultiThread | ||
![]() | SDL::MultiThread | - Bindings to the MultiThread category in SDL API |
Structure | ||
![]() | SDL::RWOps | - SDL Bindings to SDL_RWOPs |
GFX | ||
![]() | SDL::GFX::BlitFunc | - blitting functions |
![]() | SDL::GFX::ImageFilter | - image filtering functions |
![]() | SDL::GFX::Rotozoom | - rotation and zooming functions for surfaces |
TTF | ||
![]() | SDL::TTF | - True Type Font functions (libfreetype) |
Tutorials | ||
![]() | SDL::Tutorial | - introduction to Perl SDL |
![]() | SDL::Tutorial::Animation | |
![]() | SDL::Tutorial::Images | |
![]() | SDL::Tutorial::LunarLander | - a small tutorial on Perl SDL |
![]() | SDL::Tutorial::Pong | - Get started pong |
![]() | SDL::Tutorial::Tetris | - Let's Make Tetris |
UNCATEGORIZED | ||
![]() | SDL::Font | - a SDL perl extension |
![]() | SDL::Game::Palette | - a perl extension |
![]() | SDL::MPEG | - a SDL perl extension |
![]() | SDL::Music | - a perl extension |
![]() | SDL::OpenGL | - a perl extension |
![]() | SDL::SFont | - a perl extension |
![]() | SDL::SMPEG | - a SDL perl extension |
![]() | SDL::Sound | - a perl extension |
![]() | SDL::TTFont | - a SDL perl extension |
![]() | SDL::Tool::Font | - a perl extension |
![]() | SDL::Tool::Graphic |
Core | ||
![]() | SDL | - Simple DirectMedia Layer for Perl |
![]() | SDL::Time | - a SDL perl extension for managing timers. |
Audio | ||
![]() | SDL::Audio | - SDL Bindings for Audio |
Structure | ||
![]() | SDL::AudioCVT | - Audio Conversion Structure |
![]() | SDL::AudioSpec | - SDL Bindings for structure SDL::AudioSpec |
CDROM | ||
![]() | SDL::CDROM | - SDL Bindings for the CDROM device |
Structure | ||
![]() | SDL::CD | - SDL Bindings for structure SDL_CD |
![]() | SDL::CDTrack | - SDL Bindings for structure SDL_CDTrack |
Events | ||
![]() | SDL::Events | - Bindings to the Events Category in SDL API |
Structure | ||
![]() | SDL::Event | - General event structure |
Joystick | ||
![]() | SDL::Joystick | - SDL Bindings for the Joystick device |
Mouse | ||
![]() | SDL::Mouse | - SDL Bindings for the Mouse device |
Structure | ||
![]() | SDL::Cursor | - Mouse cursor structure |
Structure | ||
![]() | SDL::Version | - SDL Bindings for structure SDL_Version |
Video | ||
![]() | SDL::Video | - Bindings to the video category in SDL API |
Structure | ||
![]() | SDL::Color | - Format independent color description |
![]() | SDL::Overlay | - YUV Video overlay |
![]() | SDL::Palette | - Color palette for 8-bit pixel formats |
![]() | SDL::PixelFormat | - Stores surface format information |
![]() | SDL::Rect | - Defines a rectangular area |
![]() | SDL::Surface | - Graphic surface structure. |
![]() | SDL::VideoInfo | - Video Target Information |
Cookbook | ||
![]() | SDL::Cookbook | |
![]() | SDL::Cookbook::PDL |
Extension | ||
![]() | SDL::App | - a SDL perl extension |
GFX | ||
![]() | SDL::GFX::Framerate | - framerate calculating functions |
![]() | SDL::GFX::Primitives | - basic drawing functions |
Structure | ||
![]() | SDL::GFX::FPSManager | - data structure used by SDL::GFX::Framerate |
Image | ||
![]() | SDL::Image | - Bindings for the SDL_Image library |
Mixer | ||
![]() | SDL::Mixer | - Sound and music functions |
![]() | SDL::Mixer::Channels | - SDL::Mixer channel functions and bindings |
![]() | SDL::Mixer::Effects | - sound effect functions |
![]() | SDL::Mixer::Groups | - Audio channel group functions |
![]() | SDL::Mixer::Music | - functions for music |
![]() | SDL::Mixer::Samples | - functions for loading sound samples |
Structure | ||
![]() | SDL::Mixer::MixChunk | - SDL Bindings for structure SDL_MixChunk |
![]() | SDL::Mixer::MixMusic | - SDL Bindings for structure SDL_MixMusic |
TODO |
Core |
MultiThread | ||
![]() | SDL::MultiThread | - Bindings to the MultiThread category in SDL API |
Structure | ||
![]() | SDL::RWOps | - SDL Bindings to SDL_RWOPs |
GFX | ||
![]() | SDL::GFX::BlitFunc | - blitting functions |
![]() | SDL::GFX::ImageFilter | - image filtering functions |
![]() | SDL::GFX::Rotozoom | - rotation and zooming functions for surfaces |
TTF | ||
![]() | SDL::TTF | - True Type Font functions (libfreetype) |
Tutorials | ||
![]() | SDL::Tutorial | - introduction to Perl SDL |
![]() | SDL::Tutorial::Animation | |
![]() | SDL::Tutorial::Images | |
![]() | SDL::Tutorial::LunarLander | - a small tutorial on Perl SDL |
![]() | SDL::Tutorial::Pong | - Get started pong |
![]() | SDL::Tutorial::Tetris | - Let's Make Tetris |
UNCATEGORIZED | ||
![]() | SDL::Font | - a SDL perl extension |
![]() | SDL::Game::Palette | - a perl extension |
![]() | SDL::MPEG | - a SDL perl extension |
![]() | SDL::Music | - a perl extension |
![]() | SDL::OpenGL | - a perl extension |
![]() | SDL::SFont | - a perl extension |
![]() | SDL::SMPEG | - a SDL perl extension |
![]() | SDL::Sound | - a perl extension |
![]() | SDL::TTFont | - a SDL perl extension |
![]() | SDL::Tool::Font | - a perl extension |
![]() | SDL::Tool::Graphic |