SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::FontRef Struct Reference

Semi-safe reference for Font.

Inheritance diagram for SDL::FontRef:
Inheritance graph
[legend]
Collaboration diagram for SDL::FontRef:
Collaboration graph
[legend]

Public Member Functions

 FontRef (FontParam resource)
 Constructs from FontParam. More...
 
 FontRef (const FontRef &other)
 Copy constructor.
 
 ~FontRef ()
 Destructor.
 
- Public Member Functions inherited from SDL::Font
constexpr Font ()=default
 Default ctor.
 
constexpr Font (const FontRaw resource)
 Constructs from FontParam. More...
 
constexpr Font (const Font &other)=delete
 Copy constructor.
 
constexpr Font (Font &&other)
 Move constructor.
 
constexpr Font (const FontRef &other)=delete
 
constexpr Font (FontRef &&other)=delete
 
 Font (StringParam file, float ptsize)
 Create a font from a file, using a specified point size. More...
 
 Font (IOStreamParam src, float ptsize, bool closeio=false)
 Create a font from an IOStream, using a specified point size. More...
 
 Font (PropertiesParam props)
 Create a font with the specified properties. More...
 
 ~Font ()
 Destructor.
 
Fontoperator= (Font other)
 Assignment operator.
 
constexpr FontRaw get () const
 Retrieves underlying FontRaw.
 
constexpr FontRaw release ()
 Retrieves underlying FontRaw and clear this.
 
constexpr auto operator<=> (const Font &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator FontParam () const
 Converts to FontParam.
 
void Close ()
 Dispose of a previously-created font. More...
 
Font Copy () const
 Create a copy of an existing font. More...
 
PropertiesRef GetProperties ()
 Get the properties associated with a font. More...
 
Uint32 GetGeneration () const
 Get the font generation. More...
 
void AddFallback (FontParam fallback)
 Add a fallback font. More...
 
void RemoveFallback (FontParam fallback)
 Remove a fallback font. More...
 
void ClearFallbacks ()
 Remove all fallback fonts. More...
 
void SetSize (float ptsize)
 Set a font's size dynamically. More...
 
void SetSizeDPI (float ptsize, int hdpi, int vdpi)
 Set font size dynamically with target resolutions, in dots per inch. More...
 
float GetSize () const
 Get the size of a font. More...
 
void GetDPI (int *hdpi, int *vdpi) const
 Get font target resolutions, in dots per inch. More...
 
void SetStyle (FontStyleFlags style)
 Set a font's current style. More...
 
FontStyleFlags GetStyle () const
 Query a font's current style. More...
 
void SetOutline (int outline)
 Set a font's current outline. More...
 
int GetOutline () const
 Query a font's current outline. More...
 
void SetHinting (HintingFlags hinting)
 Set a font's current hinter setting. More...
 
int GetNumFaces () const
 Query the number of faces of a font. More...
 
HintingFlags GetHinting () const
 Query a font's current FreeType hinter setting. More...
 
void SetSDF (bool enabled)
 Enable Signed Distance Field rendering for a font. More...
 
bool GetSDF () const
 Query whether Signed Distance Field rendering is enabled for a font. More...
 
int GetWeight () const
 Query a font's weight, in terms of the lightness/heaviness of the strokes. More...
 
void SetWrapAlignment (HorizontalAlignment align)
 Set a font's current wrap alignment option. More...
 
HorizontalAlignment GetWrapAlignment () const
 Query a font's current wrap alignment option. More...
 
int GetHeight () const
 Query the total height of a font. More...
 
int GetAscent () const
 Query the offset from the baseline to the top of a font. More...
 
int GetDescent () const
 Query the offset from the baseline to the bottom of a font. More...
 
void SetLineSkip (int lineskip)
 Set the spacing between lines of text for a font. More...
 
int GetLineSkip () const
 Query the spacing between lines of text for a font. More...
 
void SetKerning (bool enabled)
 Set if kerning is enabled for a font. More...
 
bool GetKerning () const
 Query whether or not kerning is enabled for a font. More...
 
bool IsFixedWidth () const
 Query whether a font is fixed-width. More...
 
bool IsScalable () const
 Query whether a font is scalable or not. More...
 
const char * GetFamilyName () const
 Query a font's family name. More...
 
const char * GetStyleName () const
 Query a font's style name. More...
 
void SetDirection (Direction direction)
 Set the direction to be used for text shaping by a font. More...
 
Direction GetDirection () const
 Get the direction to be used for text shaping by a font. More...
 
void SetScript (Uint32 script)
 Set the script to be used for text shaping by a font. More...
 
Uint32 GetScript () const
 Get the script used for text shaping a font. More...
 
void SetLanguage (StringParam language_bcp47)
 Set language to be used for text shaping by a font. More...
 
bool HasGlyph (Uint32 ch) const
 Check whether a glyph is provided by the font for a UNICODE codepoint. More...
 
Surface GetGlyphImage (Uint32 ch, ImageType *image_type) const
 Get the pixel image for a UNICODE codepoint. More...
 
Surface GetGlyphImageForIndex (Uint32 glyph_index, ImageType *image_type) const
 Get the pixel image for a character index. More...
 
void GetGlyphMetrics (Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance) const
 Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint. More...
 
int GetGlyphKerning (Uint32 previous_ch, Uint32 ch) const
 Query the kerning size between the glyphs of two UNICODE codepoints. More...
 
Point GetStringSize (std::string_view text) const
 Calculate the dimensions of a rendered string of UTF-8 text. More...
 
void GetStringSize (std::string_view text, int *w, int *h) const
 Calculate the dimensions of a rendered string of UTF-8 text. More...
 
Point GetStringSizeWrapped (std::string_view text, int wrap_width) const
 Calculate the dimensions of a rendered string of UTF-8 text. More...
 
void GetStringSizeWrapped (std::string_view text, int wrap_width, int *w, int *h) const
 Calculate the dimensions of a rendered string of UTF-8 text. More...
 
void MeasureString (std::string_view text, int max_width, int *measured_width, size_t *measured_length) const
 Calculate how much of a UTF-8 string will fit in a given width. More...
 
Surface RenderText_Solid (std::string_view text, Color fg) const
 Render UTF-8 text at fast quality to a new 8-bit surface. More...
 
Surface RenderText_Solid_Wrapped (std::string_view text, Color fg, int wrapLength) const
 Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface. More...
 
Surface RenderGlyph_Solid (Uint32 ch, ColorRaw fg) const
 Render a single 32-bit glyph at fast quality to a new 8-bit surface. More...
 
Surface RenderText_Shaded (std::string_view text, Color fg, Color bg) const
 Render UTF-8 text at high quality to a new 8-bit surface. More...
 
Surface RenderText_Shaded_Wrapped (std::string_view text, Color fg, Color bg, int wrap_width) const
 Render word-wrapped UTF-8 text at high quality to a new 8-bit surface. More...
 
Surface RenderGlyph_Shaded (Uint32 ch, ColorRaw fg, ColorRaw bg) const
 Render a single UNICODE codepoint at high quality to a new 8-bit surface. More...
 
Surface RenderText_Blended (std::string_view text, Color fg) const
 Render UTF-8 text at high quality to a new ARGB surface. More...
 
Surface RenderText_Blended_Wrapped (std::string_view text, Color fg, int wrap_width) const
 Render word-wrapped UTF-8 text at high quality to a new ARGB surface. More...
 
Surface RenderGlyph_Blended (Uint32 ch, ColorRaw fg) const
 Render a single UNICODE codepoint at high quality to a new ARGB surface. More...
 
Surface RenderText_LCD (std::string_view text, Color fg, Color bg) const
 Render UTF-8 text at LCD subpixel quality to a new ARGB surface. More...
 
Surface RenderText_LCD_Wrapped (std::string_view text, Color fg, Color bg, int wrap_width) const
 Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface. More...
 
Surface RenderGlyph_LCD (Uint32 ch, ColorRaw fg, ColorRaw bg) const
 Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SDL::Font
static Uint32 GetGlyphScript (Uint32 ch)
 Get the script used by a 32-bit codepoint. More...
 

Constructor & Destructor Documentation

◆ FontRef()

SDL::FontRef::FontRef ( FontParam  resource)
inline
Parameters
resourcea FontRaw or Font.

This does not takes ownership!


The documentation for this struct was generated from the following file: