High-level wrapper for SDL2_ttf font rendering.  
 More...
#include <ttf_Font.hpp>
High-level wrapper for SDL2_ttf font rendering. 
 
◆ Font()
  
  
      
        
          | pu::ttf::Font::Font  | 
          ( | 
          u32 |           font_sz | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Creates a new Font instance with the specified font size. 
- Parameters
 - 
  
  
 
 
 
◆ ~Font()
◆ EmptyFontFaceDisposingFunction()
  
  
      
        
          | static void pu::ttf::Font::EmptyFontFaceDisposingFunction  | 
          ( | 
          void * |            | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Function to use when disposing a font face that does not need to be disposed. 
 
 
◆ FindValidFontFor()
      
        
          | sdl2::Font pu::ttf::Font::FindValidFontFor  | 
          ( | 
          Uint16 |           ch | ) | 
           | 
        
      
 
Finds the first available font face that can render the specified character. 
- Parameters
 - 
  
    | ch | Character to find a font face for.  | 
  
   
 
 
◆ GetFontSize()
  
  
      
        
          | u32 pu::ttf::Font::GetFontSize  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Sets the font size used by the Font instance. 
- Parameters
 - 
  
  
 
 
 
◆ GetTextDimensions()
      
        
          | std::pair< u32, u32 > pu::ttf::Font::GetTextDimensions  | 
          ( | 
          std::string & |           str | ) | 
           | 
        
      
 
Gets the dimensions of a text string rendered with the Font instance. 
- Parameters
 - 
  
    | str | Text string to get the dimensions of.  | 
  
   
- Returns
 - Dimension value pair with the width and height of the text string. 
 
 
 
◆ IsValidFontFaceIndex()
  
  
      
        
          | static constexpr bool pu::ttf::Font::IsValidFontFaceIndex  | 
          ( | 
          i32 |           index | ) | 
           | 
         
       
   | 
  
inlinestaticconstexpr   | 
  
 
Checks if a font face index is valid. 
- Parameters
 - 
  
  
 
- Returns
 - Whether the index is valid. 
 
 
 
◆ LoadFromFile()
      
        
          | i32 pu::ttf::Font::LoadFromFile  | 
          ( | 
          std::string & |           path | ) | 
           | 
        
      
 
Loads a font from a file. 
- Parameters
 - 
  
    | path | Path to the font file.  | 
  
   
- Returns
 - Index of the loaded font face. 
 
 
 
◆ LoadFromMemory()
      
        
          | i32 pu::ttf::Font::LoadFromMemory  | 
          ( | 
          void * |           ptr,  | 
        
        
           | 
           | 
          size_t |           size,  | 
        
        
           | 
           | 
          FontFaceDisposingFunction |           disp_fn ) | 
        
      
 
Loads a font from memory data. 
- Parameters
 - 
  
    | ptr | Pointer to the font data.  | 
    | size | Size of the font data.  | 
    | disp_fn | Function to call when the font is no longer needed and needs disposing.  | 
  
   
- Returns
 - Index of the loaded font face. 
 
 
 
◆ RenderText()
Renders a text string with the Font instance. 
- Parameters
 - 
  
    | str | Text string to render.  | 
    | clr | Color to render the text with.  | 
  
   
- Returns
 - Raw SDL2 texture containing the rendered text. 
 
 
 
◆ Unload()
      
        
          | void pu::ttf::Font::Unload  | 
          ( | 
          i32 |           font_idx | ) | 
           | 
        
      
 
Unloads a font face. 
- Parameters
 - 
  
    | font_idx | Index of the font face to unload.  | 
  
   
 
 
◆ DefaultFontSize
  
  
      
        
          | u32 pu::ttf::Font::DefaultFontSize = 25 | 
         
       
   | 
  
staticconstexpr   | 
  
 
Default font size to use when creating a new font. 
 
 
◆ InvalidFontFaceIndex
  
  
      
        
          | i32 pu::ttf::Font::InvalidFontFaceIndex = -1 | 
         
       
   | 
  
staticconstexpr   | 
  
 
Constant representing an invalid font face index. 
 
 
The documentation for this class was generated from the following file: