|
SDL3pp
A slim C++ wrapper for SDL3
|
Header file for SDL_ttf library. More...

Classes | |
| struct | SDL::FontParam |
| Safely wrap Font for non owning parameters. More... | |
| struct | SDL::TextEngineParam |
| Safely wrap TextEngine for non owning parameters. More... | |
| struct | SDL::TextParam |
| Safely wrap Text for non owning parameters. More... | |
| struct | SDL::TextConstParam |
| Safely wrap Text for non owning const parameters. More... | |
| class | SDL::Font |
| The internal structure containing font information. More... | |
| struct | SDL::FontRef |
| Semi-safe reference for Font. More... | |
| class | SDL::TextEngine |
| A resource engine. More... | |
| struct | SDL::SurfaceTextEngine |
| A surface based text engine. More... | |
| struct | SDL::RendererTextEngine |
| A renderer based text engine. More... | |
| struct | SDL::GPUTextEngine |
| A GPU based text engine. More... | |
| class | SDL::Text |
| Text created with Text.Text() More... | |
| struct | SDL::TextRef |
| Semi-safe reference for Text. More... | |
| class | SDL::SubStringIterator |
| Iterator for substrings. More... | |
Macros | |
| #define | SDL_TTF_VERSION |
| This is the version number macro for the current SDL_ttf version. More... | |
| #define | SDL_TTF_VERSION_ATLEAST(X, Y, Z) |
| This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z. More... | |
Typedefs | |
| using | SDL::FontRaw = TTF_Font * |
| Alias to raw representation for Font. | |
| using | SDL::TextEngineRaw = TTF_TextEngine * |
| Alias to raw representation for TextEngine. | |
| using | SDL::TextRaw = TTF_Text * |
| Alias to raw representation for Text. | |
| using | SDL::TextData = TTF_TextData |
| Internal data for Text. | |
| using | SDL::FontStyleFlags = Uint32 |
| Font style flags for Font. More... | |
| using | SDL::HintingFlags = TTF_HintingFlags |
| Hinting flags for TTF (TrueType Fonts) More... | |
| using | SDL::HorizontalAlignment = TTF_HorizontalAlignment |
| The horizontal alignment used when rendering wrapped text. More... | |
| using | SDL::Direction = TTF_Direction |
| Direction flags. More... | |
| using | SDL::ImageType = TTF_ImageType |
| The type of data in a glyph image. More... | |
| using | SDL::SubStringFlags = Uint32 |
| Flags for SubString. More... | |
| using | SDL::GPUTextEngineWinding = TTF_GPUTextEngineWinding |
| The winding order of the vertices returned by Text.GetGPUDrawData. More... | |
| using | SDL::GPUAtlasDrawSequence = TTF_GPUAtlasDrawSequence |
| Draw sequence returned by Text.GetGPUDrawData. More... | |
| using | SDL::SubString = TTF_SubString |
| The representation of a substring within text. More... | |
Functions | |
| void | SDL::GetFreeTypeVersion (int *major, int *minor, int *patch) |
| Query the version of the FreeType library in use. More... | |
| void | SDL::GetHarfBuzzVersion (int *major, int *minor, int *patch) |
| Query the version of the HarfBuzz library in use. More... | |
| Font | SDL::OpenFont (StringParam file, float ptsize) |
| Create a font from a file, using a specified point size. More... | |
| Font | SDL::OpenFont (IOStreamParam src, float ptsize, bool closeio=false) |
| Create a font from an IOStream, using a specified point size. More... | |
| Font | SDL::OpenFontWithProperties (PropertiesParam props) |
| Create a font with the specified properties. More... | |
| Font | SDL::CopyFont (FontParam existing_font) |
| Create a copy of an existing font. More... | |
| PropertiesRef | SDL::GetFontProperties (FontParam font) |
| Get the properties associated with a font. More... | |
| Uint32 | SDL::GetFontGeneration (FontParam font) |
| Get the font generation. More... | |
| void | SDL::AddFallbackFont (FontParam font, FontParam fallback) |
| Add a fallback font. More... | |
| void | SDL::RemoveFallbackFont (FontParam font, FontParam fallback) |
| Remove a fallback font. More... | |
| void | SDL::ClearFallbackFonts (FontParam font) |
| Remove all fallback fonts. More... | |
| void | SDL::SetFontSize (FontParam font, float ptsize) |
| Set a font's size dynamically. More... | |
| void | SDL::SetFontSizeDPI (FontParam font, float ptsize, int hdpi, int vdpi) |
| Set font size dynamically with target resolutions, in dots per inch. More... | |
| float | SDL::GetFontSize (FontParam font) |
| Get the size of a font. More... | |
| void | SDL::GetFontDPI (FontParam font, int *hdpi, int *vdpi) |
| Get font target resolutions, in dots per inch. More... | |
| void | SDL::SetFontStyle (FontParam font, FontStyleFlags style) |
| Set a font's current style. More... | |
| FontStyleFlags | SDL::GetFontStyle (FontParam font) |
| Query a font's current style. More... | |
| void | SDL::SetFontOutline (FontParam font, int outline) |
| Set a font's current outline. More... | |
| int | SDL::GetFontOutline (FontParam font) |
| Query a font's current outline. More... | |
| void | SDL::SetFontHinting (FontParam font, HintingFlags hinting) |
| Set a font's current hinter setting. More... | |
| int | SDL::GetNumFontFaces (FontParam font) |
| Query the number of faces of a font. More... | |
| HintingFlags | SDL::GetFontHinting (FontParam font) |
| Query a font's current FreeType hinter setting. More... | |
| void | SDL::SetFontSDF (FontParam font, bool enabled) |
| Enable Signed Distance Field rendering for a font. More... | |
| bool | SDL::GetFontSDF (FontParam font) |
| Query whether Signed Distance Field rendering is enabled for a font. More... | |
| int | SDL::GetFontWeight (FontParam font) |
| Query a font's weight, in terms of the lightness/heaviness of the strokes. More... | |
| void | SDL::SetFontWrapAlignment (FontParam font, HorizontalAlignment align) |
| Set a font's current wrap alignment option. More... | |
| HorizontalAlignment | SDL::GetFontWrapAlignment (FontParam font) |
| Query a font's current wrap alignment option. More... | |
| int | SDL::GetFontHeight (FontParam font) |
| Query the total height of a font. More... | |
| int | SDL::GetFontAscent (FontParam font) |
| Query the offset from the baseline to the top of a font. More... | |
| int | SDL::GetFontDescent (FontParam font) |
| Query the offset from the baseline to the bottom of a font. More... | |
| void | SDL::SetFontLineSkip (FontParam font, int lineskip) |
| Set the spacing between lines of text for a font. More... | |
| int | SDL::GetFontLineSkip (FontParam font) |
| Query the spacing between lines of text for a font. More... | |
| void | SDL::SetFontKerning (FontParam font, bool enabled) |
| Set if kerning is enabled for a font. More... | |
| bool | SDL::GetFontKerning (FontParam font) |
| Query whether or not kerning is enabled for a font. More... | |
| bool | SDL::FontIsFixedWidth (FontParam font) |
| Query whether a font is fixed-width. More... | |
| bool | SDL::FontIsScalable (FontParam font) |
| Query whether a font is scalable or not. More... | |
| const char * | SDL::GetFontFamilyName (FontParam font) |
| Query a font's family name. More... | |
| const char * | SDL::GetFontStyleName (FontParam font) |
| Query a font's style name. More... | |
| void | SDL::SetFontDirection (FontParam font, Direction direction) |
| Set the direction to be used for text shaping by a font. More... | |
| Direction | SDL::GetFontDirection (FontParam font) |
| Get the direction to be used for text shaping by a font. More... | |
| Uint32 | SDL::StringToTag (StringParam string) |
| Convert from a 4 character string to a 32-bit tag. More... | |
| void | SDL::TagToString (Uint32 tag, char *string, size_t size) |
| Convert from a 32-bit tag to a 4 character string. More... | |
| void | SDL::SetFontScript (FontParam font, Uint32 script) |
| Set the script to be used for text shaping by a font. More... | |
| Uint32 | SDL::GetFontScript (FontParam font) |
| Get the script used for text shaping a font. More... | |
| Uint32 | SDL::GetGlyphScript (Uint32 ch) |
| Get the script used by a 32-bit codepoint. More... | |
| void | SDL::SetFontLanguage (FontParam font, StringParam language_bcp47) |
| Set language to be used for text shaping by a font. More... | |
| bool | SDL::FontHasGlyph (FontParam font, Uint32 ch) |
| Check whether a glyph is provided by the font for a UNICODE codepoint. More... | |
| Surface | SDL::GetGlyphImage (FontParam font, Uint32 ch, ImageType *image_type) |
| Get the pixel image for a UNICODE codepoint. More... | |
| Surface | SDL::GetGlyphImageForIndex (FontParam font, Uint32 glyph_index, ImageType *image_type) |
| Get the pixel image for a character index. More... | |
| void | SDL::GetGlyphMetrics (FontParam font, Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance) |
| Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint. More... | |
| int | SDL::GetGlyphKerning (FontParam font, Uint32 previous_ch, Uint32 ch) |
| Query the kerning size between the glyphs of two UNICODE codepoints. More... | |
| void | SDL::GetStringSize (FontParam font, std::string_view text, int *w, int *h) |
| Calculate the dimensions of a rendered string of UTF-8 text. More... | |
| void | SDL::GetStringSizeWrapped (FontParam font, std::string_view text, int wrap_width, int *w, int *h) |
| Calculate the dimensions of a rendered string of UTF-8 text. More... | |
| void | SDL::MeasureString (FontParam font, std::string_view text, int max_width, int *measured_width, size_t *measured_length) |
| Calculate how much of a UTF-8 string will fit in a given width. More... | |
| Surface | SDL::RenderText_Solid (FontParam font, std::string_view text, Color fg) |
| Render UTF-8 text at fast quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderText_Solid_Wrapped (FontParam font, std::string_view text, Color fg, int wrapLength) |
| Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderGlyph_Solid (FontParam font, Uint32 ch, ColorRaw fg) |
| Render a single 32-bit glyph at fast quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderText_Shaded (FontParam font, std::string_view text, Color fg, Color bg) |
| Render UTF-8 text at high quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderText_Shaded_Wrapped (FontParam font, std::string_view text, Color fg, Color bg, int wrap_width) |
| Render word-wrapped UTF-8 text at high quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderGlyph_Shaded (FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg) |
| Render a single UNICODE codepoint at high quality to a new 8-bit surface. More... | |
| Surface | SDL::RenderText_Blended (FontParam font, std::string_view text, Color fg) |
| Render UTF-8 text at high quality to a new ARGB surface. More... | |
| Surface | SDL::RenderText_Blended_Wrapped (FontParam font, std::string_view text, Color fg, int wrap_width) |
| Render word-wrapped UTF-8 text at high quality to a new ARGB surface. More... | |
| Surface | SDL::RenderGlyph_Blended (FontParam font, Uint32 ch, ColorRaw fg) |
| Render a single UNICODE codepoint at high quality to a new ARGB surface. More... | |
| Surface | SDL::RenderText_LCD (FontParam font, std::string_view text, Color fg, Color bg) |
| Render UTF-8 text at LCD subpixel quality to a new ARGB surface. More... | |
| Surface | SDL::RenderText_LCD_Wrapped (FontParam font, std::string_view text, Color fg, Color bg, int wrap_width) |
| Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface. More... | |
| Surface | SDL::RenderGlyph_LCD (FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg) |
| Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface. More... | |
| SurfaceTextEngine | SDL::CreateSurfaceTextEngine () |
| Create a text engine for drawing text on SDL surfaces. More... | |
| void | SDL::DrawSurfaceText (TextConstParam text, Point p, SurfaceParam surface) |
| Draw text to an SDL surface. More... | |
| void | SDL::DestroySurfaceTextEngine (TextEngineRaw engine) |
| Destroy a text engine created for drawing text on SDL surfaces. More... | |
| RendererTextEngine | SDL::CreateRendererTextEngine (RendererParam renderer) |
| Create a text engine for drawing text on an SDL renderer. More... | |
| RendererTextEngine | SDL::CreateRendererTextEngineWithProperties (PropertiesParam props) |
| Create a text engine for drawing text on an SDL renderer, with the specified properties. More... | |
| void | SDL::DrawRendererText (TextConstParam text, FPoint p) |
| Draw text to an SDL renderer. More... | |
| void | SDL::DestroyRendererTextEngine (TextEngineRaw engine) |
| Destroy a text engine created for drawing text on an SDL renderer. More... | |
| GPUTextEngine | SDL::CreateGPUTextEngine (GPUDeviceParam device) |
| Create a text engine for drawing text with the SDL GPU API. More... | |
| GPUTextEngine | SDL::CreateGPUTextEngineWithProperties (PropertiesParam props) |
| Create a text engine for drawing text with the SDL GPU API, with the specified properties. More... | |
| GPUAtlasDrawSequence * | SDL::GetGPUTextDrawData (TextConstParam text) |
| Get the geometry data needed for drawing the text. More... | |
| void | SDL::DestroyGPUTextEngine (TextEngineRaw engine) |
| Destroy a text engine created for drawing text with the SDL GPU API. More... | |
| void | SDL::SetGPUTextEngineWinding (TextEngineParam engine, GPUTextEngineWinding winding) |
| Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engine. More... | |
| GPUTextEngineWinding | SDL::GetGPUTextEngineWinding (TextEngineParam engine) |
| Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engine. More... | |
| Text | SDL::CreateText (TextEngineParam engine, FontParam font, std::string_view text) |
| Create a text object from UTF-8 text and a text engine. More... | |
| PropertiesRef | SDL::GetTextProperties (TextConstParam text) |
| Get the properties associated with a text object. More... | |
| void | SDL::SetTextEngine (TextParam text, TextEngineParam engine) |
| Set the text engine used by a text object. More... | |
| TextEngineParam | SDL::GetTextEngine (TextConstParam text) |
| Get the text engine used by a text object. More... | |
| bool | SDL::SetTextFont (TextParam text, FontParam font) |
| Set the font used by a text object. More... | |
| FontRef | SDL::GetTextFont (TextConstParam text) |
| Get the font used by a text object. More... | |
| void | SDL::SetTextDirection (TextParam text, Direction direction) |
| Set the direction to be used for text shaping a text object. More... | |
| Direction | SDL::GetTextDirection (TextConstParam text) |
| Get the direction to be used for text shaping a text object. More... | |
| void | SDL::SetTextScript (TextParam text, Uint32 script) |
| Set the script to be used for text shaping a text object. More... | |
| Uint32 | SDL::GetTextScript (TextConstParam text) |
| Get the script used for text shaping a text object. More... | |
| void | SDL::SetTextColor (TextParam text, Color c) |
| Set the color of a text object. More... | |
| void | SDL::SetTextColorFloat (TextParam text, FColor c) |
| Set the color of a text object. More... | |
| void | SDL::GetTextColor (TextConstParam text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) |
| Get the color of a text object. More... | |
| Color | SDL::GetTextColor (TextParam text) |
| Get the color of a text object. More... | |
| void | SDL::GetTextColorFloat (TextConstParam text, float *r, float *g, float *b, float *a) |
| Get the color of a text object. More... | |
| FColor | SDL::GetTextColorFloat (TextParam text) |
| Get the color of a text object. More... | |
| bool | SDL::SetTextPosition (TextParam text, Point p) |
| Set the position of a text object. More... | |
| bool | SDL::GetTextPosition (TextConstParam text, int *x, int *y) |
| Get the position of a text object. More... | |
| Point | SDL::GetTextPosition (TextParam text) |
| Get the position of a text object. More... | |
| void | SDL::SetTextWrapWidth (TextParam text, int wrap_width) |
| Set whether wrapping is enabled on a text object. More... | |
| int | SDL::GetTextWrapWidth (TextConstParam text) |
| Get whether wrapping is enabled on a text object. More... | |
| void | SDL::SetTextWrapWhitespaceVisible (TextParam text, bool visible) |
| Set whether whitespace should be visible when wrapping a text object. More... | |
| bool | SDL::TextWrapWhitespaceVisible (TextConstParam text) |
| Return whether whitespace is shown when wrapping a text object. More... | |
| void | SDL::SetTextString (TextParam text, std::string_view string) |
| Set the UTF-8 text used by a text object. More... | |
| void | SDL::InsertTextString (TextParam text, int offset, std::string_view string) |
| Insert UTF-8 text into a text object. More... | |
| void | SDL::AppendTextString (TextParam text, std::string_view string) |
| Append UTF-8 text to a text object. More... | |
| void | SDL::DeleteTextString (TextParam text, int offset, int length) |
| Delete UTF-8 text from a text object. More... | |
| void | SDL::GetTextSize (TextConstParam text, int *w, int *h) |
| Get the size of a text object. More... | |
| Point | SDL::GetTextSize (TextParam text) |
| Get the size of a text object. More... | |
| void | SDL::GetTextSubString (TextConstParam text, int offset, SubString *substring) |
| Get the substring of a text object that surrounds a text offset. More... | |
| void | SDL::GetTextSubStringForLine (TextConstParam text, int line, SubString *substring) |
| Get the substring of a text object that contains the given line. More... | |
| OwnArray< SubString * > | SDL::GetTextSubStringsForRange (TextConstParam text, int offset, int length) |
| Get the substrings of a text object that contain a range of text. More... | |
| void | SDL::GetTextSubStringForPoint (TextConstParam text, Point p, SubString *substring) |
| Get the portion of a text string that is closest to a point. More... | |
| void | SDL::GetPreviousTextSubString (TextConstParam text, const SubString &substring, SubString *previous) |
| Get the previous substring in a text object. More... | |
| void | SDL::GetNextTextSubString (TextConstParam text, const SubString &substring, SubString *next) |
| Get the next substring in a text object. More... | |
| void | SDL::UpdateText (TextParam text) |
| Update the layout of a text object. More... | |
| void | SDL::DestroyText (TextRaw text) |
| Destroy a text object created by a text engine. More... | |
| void | SDL::CloseFont (FontRaw font) |
| Dispose of a previously-created font. More... | |
| Font | SDL::Font::Copy () const |
| Create a copy of an existing font. More... | |
| PropertiesRef | SDL::Font::GetProperties () |
| Get the properties associated with a font. More... | |
| Uint32 | SDL::Font::GetGeneration () const |
| Get the font generation. More... | |
| void | SDL::Font::AddFallback (FontParam fallback) |
| Add a fallback font. More... | |
| void | SDL::Font::RemoveFallback (FontParam fallback) |
| Remove a fallback font. More... | |
| void | SDL::Font::ClearFallbacks () |
| Remove all fallback fonts. More... | |
| void | SDL::Font::SetSize (float ptsize) |
| Set a font's size dynamically. More... | |
| void | SDL::Font::SetSizeDPI (float ptsize, int hdpi, int vdpi) |
| Set font size dynamically with target resolutions, in dots per inch. More... | |
| float | SDL::Font::GetSize () const |
| Get the size of a font. More... | |
| void | SDL::Font::GetDPI (int *hdpi, int *vdpi) const |
| Get font target resolutions, in dots per inch. More... | |
| void | SDL::Font::SetStyle (FontStyleFlags style) |
| Set a font's current style. More... | |
| FontStyleFlags | SDL::Font::GetStyle () const |
| Query a font's current style. More... | |
| void | SDL::Font::SetOutline (int outline) |
| Set a font's current outline. More... | |
| int | SDL::Font::GetOutline () const |
| Query a font's current outline. More... | |
| void | SDL::Font::SetHinting (HintingFlags hinting) |
| Set a font's current hinter setting. More... | |
| int | SDL::Font::GetNumFaces () const |
| Query the number of faces of a font. More... | |
| HintingFlags | SDL::Font::GetHinting () const |
| Query a font's current FreeType hinter setting. More... | |
| void | SDL::Font::SetSDF (bool enabled) |
| Enable Signed Distance Field rendering for a font. More... | |
| bool | SDL::Font::GetSDF () const |
| Query whether Signed Distance Field rendering is enabled for a font. More... | |
| int | SDL::Font::GetWeight () const |
| Query a font's weight, in terms of the lightness/heaviness of the strokes. More... | |
| void | SDL::Font::SetWrapAlignment (HorizontalAlignment align) |
| Set a font's current wrap alignment option. More... | |
| HorizontalAlignment | SDL::Font::GetWrapAlignment () const |
| Query a font's current wrap alignment option. More... | |
| int | SDL::Font::GetHeight () const |
| Query the total height of a font. More... | |
| int | SDL::Font::GetAscent () const |
| Query the offset from the baseline to the top of a font. More... | |
| int | SDL::Font::GetDescent () const |
| Query the offset from the baseline to the bottom of a font. More... | |
| void | SDL::Font::SetLineSkip (int lineskip) |
| Set the spacing between lines of text for a font. More... | |
| int | SDL::Font::GetLineSkip () const |
| Query the spacing between lines of text for a font. More... | |
| void | SDL::Font::SetKerning (bool enabled) |
| Set if kerning is enabled for a font. More... | |
| bool | SDL::Font::GetKerning () const |
| Query whether or not kerning is enabled for a font. More... | |
| bool | SDL::Font::IsFixedWidth () const |
| Query whether a font is fixed-width. More... | |
| bool | SDL::Font::IsScalable () const |
| Query whether a font is scalable or not. More... | |
| const char * | SDL::Font::GetFamilyName () const |
| Query a font's family name. More... | |
| const char * | SDL::Font::GetStyleName () const |
| Query a font's style name. More... | |
| void | SDL::Font::SetDirection (Direction direction) |
| Set the direction to be used for text shaping by a font. More... | |
| Direction | SDL::Font::GetDirection () const |
| Get the direction to be used for text shaping by a font. More... | |
| void | SDL::Font::SetScript (Uint32 script) |
| Set the script to be used for text shaping by a font. More... | |
| Uint32 | SDL::Font::GetScript () const |
| Get the script used for text shaping a font. More... | |
| static Uint32 | SDL::Font::GetGlyphScript (Uint32 ch) |
| Get the script used by a 32-bit codepoint. More... | |
| void | SDL::Font::SetLanguage (StringParam language_bcp47) |
| Set language to be used for text shaping by a font. More... | |
| bool | SDL::Font::HasGlyph (Uint32 ch) const |
| Check whether a glyph is provided by the font for a UNICODE codepoint. More... | |
| Surface | SDL::Font::GetGlyphImage (Uint32 ch, ImageType *image_type) const |
| Get the pixel image for a UNICODE codepoint. More... | |
| Surface | SDL::Font::GetGlyphImageForIndex (Uint32 glyph_index, ImageType *image_type) const |
| Get the pixel image for a character index. More... | |
| void | SDL::Font::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 | SDL::Font::GetGlyphKerning (Uint32 previous_ch, Uint32 ch) const |
| Query the kerning size between the glyphs of two UNICODE codepoints. More... | |
| void | SDL::Font::GetStringSize (std::string_view text, int *w, int *h) const |
| Calculate the dimensions of a rendered string of UTF-8 text. More... | |
| void | SDL::Font::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 | SDL::Font::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 | SDL::Font::RenderText_Solid (std::string_view text, Color fg) const |
| Render UTF-8 text at fast quality to a new 8-bit surface. More... | |
| Surface | SDL::Font::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 | SDL::Font::RenderGlyph_Solid (Uint32 ch, ColorRaw fg) const |
| Render a single 32-bit glyph at fast quality to a new 8-bit surface. More... | |
| Surface | SDL::Font::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 | SDL::Font::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 | SDL::Font::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 | SDL::Font::RenderText_Blended (std::string_view text, Color fg) const |
| Render UTF-8 text at high quality to a new ARGB surface. More... | |
| Surface | SDL::Font::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 | SDL::Font::RenderGlyph_Blended (Uint32 ch, ColorRaw fg) const |
| Render a single UNICODE codepoint at high quality to a new ARGB surface. More... | |
| Surface | SDL::Font::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 | SDL::Font::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 | SDL::Font::RenderGlyph_LCD (Uint32 ch, ColorRaw fg, ColorRaw bg) const |
| Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface. More... | |
| void | SDL::Text::DrawSurface (Point p, SurfaceParam surface) const |
| Draw text to an SDL surface. More... | |
| void | SDL::SurfaceTextEngine::Destroy () final |
| Destroy a text engine created for drawing text on SDL surfaces. More... | |
| void | SDL::Text::DrawRenderer (FPoint p) const |
| Draw text to an SDL renderer. More... | |
| void | SDL::RendererTextEngine::Destroy () final |
| Destroy a text engine created for drawing text on an SDL renderer. More... | |
| GPUAtlasDrawSequence * | SDL::Text::GetGPUDrawData () const |
| Get the geometry data needed for drawing the text. More... | |
| void | SDL::GPUTextEngine::Destroy () final |
| Destroy a text engine created for drawing text with the SDL GPU API. More... | |
| void | SDL::GPUTextEngine::SetGPUWinding (GPUTextEngineWinding winding) |
| Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engine. More... | |
| GPUTextEngineWinding | SDL::GPUTextEngine::GetGPUWinding () const |
| Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engine. More... | |
| Text | SDL::TextEngine::CreateText (FontParam font, std::string_view text) |
| Create a text object from UTF-8 text and a text engine. More... | |
| PropertiesRef | SDL::Text::GetProperties () const |
| Get the properties associated with a text object. More... | |
| void | SDL::Text::SetEngine (TextEngineParam engine) |
| Set the text engine used by a text object. More... | |
| TextEngineParam | SDL::Text::GetEngine () const |
| Get the text engine used by a text object. More... | |
| bool | SDL::Text::SetFont (FontParam font) |
| Set the font used by a text object. More... | |
| FontRef | SDL::Text::GetFont () const |
| Get the font used by a text object. More... | |
| void | SDL::Text::SetDirection (Direction direction) |
| Set the direction to be used for text shaping a text object. More... | |
| Direction | SDL::Text::GetDirection () const |
| Get the direction to be used for text shaping a text object. More... | |
| void | SDL::Text::SetScript (Uint32 script) |
| Set the script to be used for text shaping a text object. More... | |
| Uint32 | SDL::Text::GetScript () const |
| Get the script used for text shaping a text object. More... | |
| void | SDL::Text::SetColor (Color c) |
| Set the color of a text object. More... | |
| void | SDL::Text::SetColorFloat (FColor c) |
| Set the color of a text object. More... | |
| void | SDL::Text::GetColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const |
| Get the color of a text object. More... | |
| Color | SDL::Text::GetColor () const |
| Get the color of a text object. More... | |
| void | SDL::Text::GetColorFloat (float *r, float *g, float *b, float *a) const |
| Get the color of a text object. More... | |
| FColor | SDL::Text::GetColorFloat () const |
| Get the color of a text object. More... | |
| bool | SDL::Text::SetPosition (Point p) |
| Set the position of a text object. More... | |
| bool | SDL::Text::GetPosition (int *x, int *y) const |
| Get the position of a text object. More... | |
| Point | SDL::Text::GetPosition () const |
| Get the position of a text object. More... | |
| void | SDL::Text::SetWrapWidth (int wrap_width) |
| Set whether wrapping is enabled on a text object. More... | |
| int | SDL::Text::GetWrapWidth () const |
| Get whether wrapping is enabled on a text object. More... | |
| void | SDL::Text::SetWrapWhitespaceVisible (bool visible) |
| Set whether whitespace should be visible when wrapping a text object. More... | |
| bool | SDL::Text::IsWrapWhitespaceVisible () const |
| Return whether whitespace is shown when wrapping a text object. More... | |
| void | SDL::Text::SetString (std::string_view string) |
| Set the UTF-8 text used by a text object. More... | |
| void | SDL::Text::InsertString (int offset, std::string_view string) |
| Insert UTF-8 text into a text object. More... | |
| void | SDL::Text::AppendString (std::string_view string) |
| Append UTF-8 text to a text object. More... | |
| void | SDL::Text::DeleteString (int offset, int length) |
| Delete UTF-8 text from a text object. More... | |
| void | SDL::Text::GetSize (int *w, int *h) const |
| Get the size of a text object. More... | |
| Point | SDL::Text::GetSize () const |
| Get the size of a text object. More... | |
| void | SDL::Text::GetSubString (int offset, SubString *substring) const |
| Get the substring of a text object that surrounds a text offset. More... | |
| void | SDL::Text::GetSubStringForLine (int line, SubString *substring) const |
| Get the substring of a text object that contains the given line. More... | |
| OwnArray< SubString * > | SDL::Text::GetSubStringsForRange (int offset, int length=-1) const |
| Get the substrings of a text object that contain a range of text. More... | |
| void | SDL::Text::GetSubStringForPoint (Point p, SubString *substring) const |
| Get the portion of a text string that is closest to a point. More... | |
| void | SDL::Text::GetPreviousSubString (const SubString &substring, SubString *previous) const |
| Get the previous substring in a text object. More... | |
| void | SDL::Text::GetNextSubString (const SubString &substring, SubString *next) const |
| Get the next substring in a text object. More... | |
| void | SDL::Text::Update () |
| Update the layout of a text object. More... | |
| void | SDL::Text::Destroy () |
| Destroy a text object created by a text engine. More... | |
| void | SDL::Font::Close () |
| Dispose of a previously-created font. More... | |
Variables | |
| constexpr FontStyleFlags | SDL::STYLE_NORMAL = TTF_STYLE_NORMAL |
| No special style. | |
| constexpr FontStyleFlags | SDL::STYLE_BOLD = TTF_STYLE_BOLD |
| Bold style. | |
| constexpr FontStyleFlags | SDL::STYLE_ITALIC = TTF_STYLE_ITALIC |
| Italic style. | |
| constexpr FontStyleFlags | SDL::STYLE_UNDERLINE |
| Underlined text. More... | |
| constexpr FontStyleFlags | SDL::STYLE_STRIKETHROUGH |
| Strikethrough text. More... | |
| constexpr HintingFlags | SDL::HINTING_INVALID = TTF_HINTING_INVALID |
| INVALID. | |
| constexpr HintingFlags | SDL::HINTING_NORMAL |
| Normal hinting applies standard grid-fitting. More... | |
| constexpr HintingFlags | SDL::HINTING_LIGHT = TTF_HINTING_LIGHT |
| Light hinting applies subtle adjustments to improve rendering. | |
| constexpr HintingFlags | SDL::HINTING_MONO = TTF_HINTING_MONO |
| Monochrome hinting adjusts the font for better rendering at lower resolutions. | |
| constexpr HintingFlags | SDL::HINTING_NONE = TTF_HINTING_NONE |
| No hinting, the font is rendered without any grid-fitting. | |
| constexpr HintingFlags | SDL::HINTING_LIGHT_SUBPIXEL = TTF_HINTING_LIGHT_SUBPIXEL |
| Light hinting with subpixel rendering for more precise font edges. | |
| constexpr HorizontalAlignment | SDL::HORIZONTAL_ALIGN_INVALID |
| INVALID. More... | |
| constexpr HorizontalAlignment | SDL::HORIZONTAL_ALIGN_LEFT |
| LEFT. More... | |
| constexpr HorizontalAlignment | SDL::HORIZONTAL_ALIGN_CENTER |
| CENTER. More... | |
| constexpr HorizontalAlignment | SDL::HORIZONTAL_ALIGN_RIGHT |
| RIGHT. More... | |
| constexpr Direction | SDL::DIRECTION_INVALID = TTF_DIRECTION_INVALID |
| INVALID. | |
| constexpr Direction | SDL::DIRECTION_LTR = TTF_DIRECTION_LTR |
| Left to Right. | |
| constexpr Direction | SDL::DIRECTION_RTL = TTF_DIRECTION_RTL |
| Right to Left. | |
| constexpr Direction | SDL::DIRECTION_TTB = TTF_DIRECTION_TTB |
| Top to Bottom. | |
| constexpr Direction | SDL::DIRECTION_BTT = TTF_DIRECTION_BTT |
| Bottom to Top. | |
| constexpr ImageType | SDL::IMAGE_INVALID = TTF_IMAGE_INVALID |
| INVALID. | |
| constexpr ImageType | SDL::IMAGE_ALPHA |
| The color channels are white. More... | |
| constexpr ImageType | SDL::IMAGE_COLOR |
| The color channels have image data. More... | |
| constexpr ImageType | SDL::IMAGE_SDF = TTF_IMAGE_SDF |
| The alpha channel has signed distance field information. | |
| constexpr SubStringFlags | SDL::SUBSTRING_DIRECTION_MASK |
| The mask for the flow direction for this substring. More... | |
| constexpr SubStringFlags | SDL::SUBSTRING_TEXT_START |
| This substring contains the beginning of the text. More... | |
| constexpr SubStringFlags | SDL::SUBSTRING_LINE_START = TTF_SUBSTRING_LINE_START |
This substring contains the beginning of line line_index | |
| constexpr SubStringFlags | SDL::SUBSTRING_LINE_END = TTF_SUBSTRING_LINE_END |
This substring contains the end of line line_index | |
| constexpr SubStringFlags | SDL::SUBSTRING_TEXT_END |
| This substring contains the end of the text. More... | |
| constexpr GPUTextEngineWinding | SDL::GPU_TEXTENGINE_WINDING_INVALID |
| INVALID. More... | |
| constexpr GPUTextEngineWinding | SDL::GPU_TEXTENGINE_WINDING_CLOCKWISE |
| CLOCKWISE. More... | |
| constexpr GPUTextEngineWinding | SDL::GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE |
| COUNTER_CLOCKWISE. More... | |
| constexpr int | SDL::FONT_WEIGHT_THIN |
| Thin (100) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_EXTRA_LIGHT |
| ExtraLight (200) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_LIGHT |
| Light (300) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_NORMAL |
| Normal (400) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_MEDIUM |
| Medium (500) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_SEMI_BOLD |
| SemiBold (600) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_BOLD |
| Bold (700) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_EXTRA_BOLD |
| ExtraBold (800) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_BLACK |
| Black (900) named font weight value. More... | |
| constexpr int | SDL::FONT_WEIGHT_EXTRA_BLACK |
| ExtraBlack (950) named font weight value. More... | |
This library is a wrapper around the excellent FreeType 2.0 library, available at: https://www.freetype.org/
| #define SDL_TTF_VERSION |
| #define SDL_TTF_VERSION_ATLEAST | ( | X, | |
| Y, | |||
| Z | |||
| ) |
| using SDL::Direction = typedef TTF_Direction |
The values here are chosen to match hb_direction_t
| using SDL::FontStyleFlags = typedef Uint32 |
These are the flags which can be used to set the style of a font in SDL_ttf. A combination of these flags can be used with functions that set or query font style, such as Font.SetStyle or Font.GetStyle.
| using SDL::GPUAtlasDrawSequence = typedef TTF_GPUAtlasDrawSequence |
| using SDL::GPUTextEngineWinding = typedef TTF_GPUTextEngineWinding |
| using SDL::HintingFlags = typedef TTF_HintingFlags |
This enum specifies the level of hinting to be applied to the font rendering. The hinting level determines how much the font's outlines are adjusted for better alignment on the pixel grid.
| using SDL::HorizontalAlignment = typedef TTF_HorizontalAlignment |
| using SDL::ImageType = typedef TTF_ImageType |
| using SDL::SubString = typedef TTF_SubString |
| using SDL::SubStringFlags = typedef Uint32 |
|
inline |
Add a font that will be used for glyphs that are not in the current font. The fallback font should have the same size and style as the current font.
If there are multiple fallback fonts, they are used in the order added.
This updates any Text objects using this font.
| fallback | the font to add as a fallback. |
| Error | on failure. |
Add a font that will be used for glyphs that are not in the current font. The fallback font should have the same size and style as the current font.
If there are multiple fallback fonts, they are used in the order added.
This updates any Text objects using this font.
| font | the font to modify. |
| fallback | the font to add as a fallback. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| string | the UTF-8 text to insert. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| string | the UTF-8 text to insert. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font.
| font | the font to modify. |
|
inline |
This updates any Text objects using this font.
|
inline |
Call this when done with a font. This function will free any resources associated with it. It is safe to call this function on nullptr, for example on the result of a failed call to Font.Font().
The font is not valid after being passed to this function. String pointers from functions that return information on this font, such as Font.GetFamilyName() and Font.GetStyleName(), are no longer valid after this call, as well.
|
inline |
Call this when done with a font. This function will free any resources associated with it. It is safe to call this function on nullptr, for example on the result of a failed call to Font.Font().
The font is not valid after being passed to this function. String pointers from functions that return information on this font, such as Font.GetFamilyName() and Font.GetStyleName(), are no longer valid after this call, as well.
| font | the font to dispose of. |
|
inline |
The copy will be distinct from the original, but will share the font file and have the same size and style as the original.
| Error | on failure. |
The copy will be distinct from the original, but will share the font file and have the same size and style as the original.
When done with the returned Font, use Font.Close() to dispose of it.
| existing_font | the font to copy. |
| Error | on failure. |
|
inline |
| device | the GPUDevice to use for creating textures and drawing text. |
|
inline |
These are the supported properties:
prop::GpuTextEngine.DEVICE_POINTER: the GPUDevice to use for creating textures and drawing text.prop::GpuTextEngine.ATLAS_TEXTURE_SIZE_NUMBER: the size of the texture atlas| props | the properties to use. |
|
inline |
| renderer | the renderer to use for creating textures and drawing text. |
|
inline |
These are the supported properties:
prop::RendererTextEngine.RENDERER_POINTER: the renderer to use for creating textures and drawing textprop::RendererTextEngine.ATLAS_TEXTURE_SIZE_NUMBER: the size of the texture atlas| props | the properties to use. |
|
inline |
nullptr.
| font | the font to render with. |
| text | the text to use, in UTF-8 encoding. |
|
inline |
| engine | the text engine to use when creating the text object, may be nullptr. |
| font | the font to render with. |
| text | the text to use, in UTF-8 encoding. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| offset | the offset, in bytes, from the beginning of the string if >= 0, the offset from the end of the string if < 0. Note that this does not do UTF-8 validation, so you should only delete at UTF-8 sequence boundaries. |
| length | the length of text to delete, in bytes, or -1 for the remainder of the string. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| offset | the offset, in bytes, from the beginning of the string if >= 0, the offset from the end of the string if < 0. Note that this does not do UTF-8 validation, so you should only delete at UTF-8 sequence boundaries. |
| length | the length of text to delete, in bytes, or -1 for the remainder of the string. |
| Error | on failure. |
|
inline |
|
inlinefinalvirtual |
All text created by this engine should be destroyed before calling this function.
Implements SDL::TextEngine.
|
inlinefinalvirtual |
All text created by this engine should be destroyed before calling this function.
Implements SDL::TextEngine.
|
inlinefinalvirtual |
All text created by this engine should be destroyed before calling this function.
Implements SDL::TextEngine.
|
inline |
All text created by this engine should be destroyed before calling this function.
| engine | a TextEngine object created with GPUTextEngine.GPUTextEngine(). |
|
inline |
All text created by this engine should be destroyed before calling this function.
| engine | a TextEngine object created with RendererTextEngine.RendererTextEngine(). |
|
inline |
All text created by this engine should be destroyed before calling this function.
| engine | a TextEngine object created with SurfaceTextEngine.SurfaceTextEngine(). |
|
inline |
| text | the text to destroy. |
|
inline |
text must have been created using a TextEngine from RendererTextEngine.RendererTextEngine(), and will draw using the renderer passed to that function.
| p | the x,y coordinates in pixels, positive from the top-left edge towards the bottom-right. |
| Error | on failure. |
|
inline |
text must have been created using a TextEngine from RendererTextEngine.RendererTextEngine(), and will draw using the renderer passed to that function.
| text | the text to draw. |
| p | the (x, y) coordinate in pixels, positive from the left edge towards the right and from the top edge towards the bottom. |
| Error | on failure. |
|
inline |
text must have been created using a TextEngine from SurfaceTextEngine.SurfaceTextEngine().
| p | the x,y coordinates in pixels, positive from the top-left edge towards the bottom-right. |
| surface | the surface to draw on. |
| Error | on failure. |
|
inline |
text must have been created using a TextEngine from SurfaceTextEngine.SurfaceTextEngine().
| text | the text to draw. |
| p | the (x, y) coordinate in pixels, positive from the left edge towards the right and from the top edge towards the bottom. |
| surface | the surface to draw on. |
| Error | on failure. |
| font | the font to query. |
| ch | the codepoint to check. |
|
inline |
A "fixed-width" font means all glyphs are the same width across; a lowercase 'i' will be the same size across as a capital 'W', for example. This is common for terminals and text editors, and other apps that treat text as a grid. Most other things (WYSIWYG word processors, web pages, etc) are more likely to not be fixed-width in most cases.
| font | the font to query. |
|
inline |
Scalability lets us distinguish between outline and bitmap fonts.
| font | the font to query. |
|
inline |
This is a positive value, relative to the baseline.
|
inline |
| Error | on failure. |
| r | a pointer filled in with the red color value in the range of 0-255, may be nullptr. |
| g | a pointer filled in with the green color value in the range of 0-255, may be nullptr. |
| b | a pointer filled in with the blue color value in the range of 0-255, may be nullptr. |
| a | a pointer filled in with the alpha value in the range of 0-255, may be nullptr. |
| Error | on failure. |
|
inline |
| Error | on failure. |
|
inline |
| r | a pointer filled in with the red color value, normally in the range of 0-1, may be nullptr. |
| g | a pointer filled in with the green color value, normally in the range of 0-1, may be nullptr. |
| b | a pointer filled in with the blue color value, normally in the range of 0-1, may be nullptr. |
| a | a pointer filled in with the alpha value in the range of 0-1, may be nullptr. |
| Error | on failure. |
|
inline |
This is a negative value, relative to the baseline.
|
inline |
This defaults to DIRECTION_INVALID if it hasn't been set.
|
inline |
This defaults to the direction of the font used by the text object.
|
inline |
| hdpi | a pointer filled in with the target horizontal DPI. |
| vdpi | a pointer filled in with the target vertical DPI. |
| Error | on failure. |
|
inline |
| Error | on failure. |
|
inline |
This string is dictated by the contents of the font file.
Note that the returned string is to internal storage, and should not be modified or free'd by the caller. The string becomes invalid, with the rest of the font, when font is handed to Font.Close().
|
inline |
| Error | on failure. |
|
inline |
This is a positive value, relative to the baseline.
| font | the font to query. |
|
inline |
This is a negative value, relative to the baseline.
| font | the font to query. |
This defaults to DIRECTION_INVALID if it hasn't been set.
| font | the font to query. |
|
inline |
| font | the font to query. |
| hdpi | a pointer filled in with the target horizontal DPI. |
| vdpi | a pointer filled in with the target vertical DPI. |
| Error | on failure. |
|
inline |
This string is dictated by the contents of the font file.
Note that the returned string is to internal storage, and should not be modified or free'd by the caller. The string becomes invalid, with the rest of the font, when font is handed to Font.Close().
| font | the font to query. |
The generation is incremented each time font properties change that require rebuilding glyphs, such as style, size, etc.
| font | the font to query. |
|
inline |
This is usually equal to point size.
| font | the font to query. |
|
inline |
The hinter setting is a single value:
HINTING_NORMALHINTING_LIGHTHINTING_MONOHINTING_NONEHINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
The following read-write properties are provided by SDL:
prop::Font.OUTLINE_LINE_CAP_NUMBER: The FT_Stroker_LineCap value used when setting the font outline, defaults to FT_STROKER_LINECAP_ROUND.prop::Font.OUTLINE_LINE_JOIN_NUMBER: The FT_Stroker_LineJoin value used when setting the font outline, defaults to FT_STROKER_LINEJOIN_ROUND.prop::Font.OUTLINE_MITER_LIMIT_NUMBER: The FT_Fixed miter limit used when setting the font outline, defaults to 0.| font | the font to query. |
| Error | on failure. |
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
The font styles are a set of bit flags, OR'd together:
STYLE_NORMAL (is zero)STYLE_BOLDSTYLE_ITALICSTYLE_UNDERLINESTYLE_STRIKETHROUGH| font | the font to query. |
|
inline |
This string is dictated by the contents of the font file.
Note that the returned string is to internal storage, and should not be modified or free'd by the caller. The string becomes invalid, with the rest of the font, when font is handed to Font.Close().
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
| font | the font to query. |
|
inline |
TTF.Init() should be called before calling this function.
| major | to be filled in with the major version number. Can be nullptr. |
| minor | to be filled in with the minor version number. Can be nullptr. |
| patch | to be filled in with the param version number. Can be nullptr. |
|
inline |
The generation is incremented each time font properties change that require rebuilding glyphs, such as style, size, etc.
| font | the font to query. |
| ch | the codepoint to check. |
| image_type | a pointer filled in with the glyph image type, may be nullptr. |
| ch | the codepoint to check. |
| image_type | a pointer filled in with the glyph image type, may be nullptr. |
|
inline |
This is useful for text engine implementations, which can call this with the glyph_index in a TTF_CopyOperation
| font | the font to query. |
| glyph_index | the index of the glyph to return. |
| image_type | a pointer filled in with the glyph image type, may be nullptr. |
|
inline |
This is useful for text engine implementations, which can call this with the glyph_index in a TTF_CopyOperation
| glyph_index | the index of the glyph to return. |
| image_type | a pointer filled in with the glyph image type, may be nullptr. |
| font | the font to query. |
| previous_ch | the previous codepoint. |
| ch | the current codepoint. |
| Error | on failure. |
| previous_ch | the previous codepoint. |
| ch | the current codepoint. |
| Error | on failure. |
|
inline |
To understand what these metrics mean, here is a useful link:
https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
| font | the font to query. |
| ch | the codepoint to check. |
| minx | a pointer filled in with the minimum x coordinate of the glyph from the left edge of its bounding box. This value may be negative. |
| maxx | a pointer filled in with the maximum x coordinate of the glyph from the left edge of its bounding box. |
| miny | a pointer filled in with the minimum y coordinate of the glyph from the bottom edge of its bounding box. This value may be negative. |
| maxy | a pointer filled in with the maximum y coordinate of the glyph from the bottom edge of its bounding box. |
| advance | a pointer filled in with the distance to the next glyph from the left edge of this glyph's bounding box. |
| Error | on failure. |
|
inline |
To understand what these metrics mean, here is a useful link:
https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
| ch | the codepoint to check. |
| minx | a pointer filled in with the minimum x coordinate of the glyph from the left edge of its bounding box. This value may be negative. |
| maxx | a pointer filled in with the maximum x coordinate of the glyph from the left edge of its bounding box. |
| miny | a pointer filled in with the minimum y coordinate of the glyph from the bottom edge of its bounding box. This value may be negative. |
| maxy | a pointer filled in with the maximum y coordinate of the glyph from the bottom edge of its bounding box. |
| advance | a pointer filled in with the distance to the next glyph from the left edge of this glyph's bounding box. |
| Error | on failure. |
| ch | the character code to check. |
| ch | the character code to check. |
|
inline |
text must have been created using a TextEngine from GPUTextEngine.GPUTextEngine().
The positive X-axis is taken towards the right and the positive Y-axis is taken upwards for both the vertex and the texture coordinates, i.e, it follows the same convention used by the SDL_GPU API. If you want to use a different coordinate system you will need to transform the vertices yourself.
If the text looks blocky use linear filtering.
|
inline |
text must have been created using a TextEngine from GPUTextEngine.GPUTextEngine().
The positive X-axis is taken towards the right and the positive Y-axis is taken upwards for both the vertex and the texture coordinates, i.e, it follows the same convention used by the SDL_GPU API. If you want to use a different coordinate system you will need to transform the vertices yourself.
If the text looks blocky use linear filtering.
| text | the text to draw. |
|
inline |
| engine | a TextEngine object created with GPUTextEngine.GPUTextEngine(). |
|
inline |
|
inline |
If HarfBuzz is not available, the version reported is 0.0.0.
| major | to be filled in with the major version number. Can be nullptr. |
| minor | to be filled in with the minor version number. Can be nullptr. |
| patch | to be filled in with the param version number. Can be nullptr. |
|
inline |
This is usually equal to point size.
|
inline |
The hinter setting is a single value:
HINTING_NORMALHINTING_LIGHTHINTING_MONOHINTING_NONEHINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)
|
inline |
|
inline |
If called at the end of the text, this will return a zero length substring with the SUBSTRING_TEXT_END flag set.
| substring | the SubString to query. |
| next | a pointer filled in with the next substring. |
| Error | on failure. |
|
inline |
If called at the end of the text, this will return a zero length substring with the SUBSTRING_TEXT_END flag set.
| text | the Text to query. |
| substring | the SubString to query. |
| next | a pointer filled in with the next substring. |
| Error | on failure. |
|
inline |
|
inline |
| font | the font to query. |
|
inline |
|
inline |
| Error | on failure. |
|
inline |
| x | a pointer filled in with the x offset of the upper left corner of this text in pixels, may be nullptr. |
| y | a pointer filled in with the y offset of the upper left corner of this text in pixels, may be nullptr. |
|
inline |
If called at the start of the text, this will return a zero length substring with the SUBSTRING_TEXT_START flag set.
| substring | the SubString to query. |
| previous | a pointer filled in with the previous substring in the text object. |
| Error | on failure. |
|
inline |
If called at the start of the text, this will return a zero length substring with the SUBSTRING_TEXT_START flag set.
| text | the Text to query. |
| substring | the SubString to query. |
| previous | a pointer filled in with the previous substring in the text object. |
| Error | on failure. |
|
inline |
The following read-write properties are provided by SDL:
prop::Font.OUTLINE_LINE_CAP_NUMBER: The FT_Stroker_LineCap value used when setting the font outline, defaults to FT_STROKER_LINECAP_ROUND.prop::Font.OUTLINE_LINE_JOIN_NUMBER: The FT_Stroker_LineJoin value used when setting the font outline, defaults to FT_STROKER_LINEJOIN_ROUND.prop::Font.OUTLINE_MITER_LIMIT_NUMBER: The FT_Fixed miter limit used when setting the font outline, defaults to 0.| Error | on failure. |
|
inline |
| Error | on failure. |
|
inline |
|
inline |
This defaults to the script of the font used by the text object.
|
inline |
|
inline |
|
inline |
The size of the text may change when the font or font style and size change.
| Error | on failure. |
|
inline |
The size of the text may change when the font or font style and size change.
| w | a pointer filled in with the width of the text, in pixels, may be nullptr. |
| h | a pointer filled in with the height of the text, in pixels, may be nullptr. |
| Error | on failure. |
|
inline |
This will report the width and height, in pixels, of the space that the specified string will take to fully render.
| font | the font to query. |
| text | text to calculate, in UTF-8 encoding. |
| w | will be filled with width, in pixels, on return. |
| h | will be filled with height, in pixels, on return. |
| Error | on failure. |
|
inline |
This will report the width and height, in pixels, of the space that the specified string will take to fully render.
| text | text to calculate, in UTF-8 encoding. |
| w | will be filled with width, in pixels, on return. |
| h | will be filled with height, in pixels, on return. |
| Error | on failure. |
|
inline |
This will report the width and height, in pixels, of the space that the specified string will take to fully render.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
| font | the font to query. |
| text | text to calculate, in UTF-8 encoding. |
| wrap_width | the maximum width or 0 to wrap on newline characters. |
| w | will be filled with width, in pixels, on return. |
| h | will be filled with height, in pixels, on return. |
| Error | on failure. |
|
inline |
This will report the width and height, in pixels, of the space that the specified string will take to fully render.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
| text | text to calculate, in UTF-8 encoding. |
| wrap_width | the maximum width or 0 to wrap on newline characters. |
| w | will be filled with width, in pixels, on return. |
| h | will be filled with height, in pixels, on return. |
| Error | on failure. |
|
inline |
The font styles are a set of bit flags, OR'd together:
STYLE_NORMAL (is zero)STYLE_BOLDSTYLE_ITALICSTYLE_UNDERLINESTYLE_STRIKETHROUGH
|
inline |
This string is dictated by the contents of the font file.
Note that the returned string is to internal storage, and should not be modified or free'd by the caller. The string becomes invalid, with the rest of the font, when font is handed to Font.Close().
|
inline |
If offset is less than 0, this will return a zero length substring at the beginning of the text with the SUBSTRING_TEXT_START flag set. If offset is greater than or equal to the length of the text string, this will return a zero length substring at the end of the text with the SUBSTRING_TEXT_END flag set.
| offset | a byte offset into the text string. |
| substring | a pointer filled in with the substring containing the offset. |
| Error | on failure. |
|
inline |
If line is less than 0, this will return a zero length substring at the beginning of the text with the SUBSTRING_TEXT_START flag set. If line is greater than or equal to text->num_lines this will return a zero length substring at the end of the text with the SUBSTRING_TEXT_END flag set.
| line | a zero-based line index, in the range [0 .. text->num_lines-1]. |
| substring | a pointer filled in with the substring containing the offset. |
| Error | on failure. |
This will return the closest substring of text to the given point.
| p | the coordinates relative to the top-left side of the text, may be outside the bounds of the text area. |
| substring | a pointer filled in with the closest substring of text to the given point. |
| Error | on failure. |
|
inline |
| offset | a byte offset into the text string. |
| length | the length of the range being queried, in bytes, or -1 for the remainder of the string. |
|
inline |
| text | the Text to query. |
| r | a pointer filled in with the red color value in the range of 0-255, may be nullptr. |
| g | a pointer filled in with the green color value in the range of 0-255, may be nullptr. |
| b | a pointer filled in with the blue color value in the range of 0-255, may be nullptr. |
| a | a pointer filled in with the alpha value in the range of 0-255, may be nullptr. |
| Error | on failure. |
| text | the Text to query. |
| Error | on failure. |
|
inline |
| text | the Text to query. |
| r | a pointer filled in with the red color value, normally in the range of 0-1, may be nullptr. |
| g | a pointer filled in with the green color value, normally in the range of 0-1, may be nullptr. |
| b | a pointer filled in with the blue color value, normally in the range of 0-1, may be nullptr. |
| a | a pointer filled in with the alpha value in the range of 0-1, may be nullptr. |
| Error | on failure. |
| text | the Text to query. |
| Error | on failure. |
|
inline |
This defaults to the direction of the font used by the text object.
| text | the text to query. |
|
inline |
| text | the Text to query. |
| Error | on failure. |
|
inline |
| text | the Text to query. |
| Error | on failure. |
|
inline |
| text | the Text to query. |
| x | a pointer filled in with the x offset of the upper left corner of this text in pixels, may be nullptr. |
| y | a pointer filled in with the y offset of the upper left corner of this text in pixels, may be nullptr. |
| text | the Text to query. |
| Error | on failure. |
|
inline |
|
inline |
This defaults to the script of the font used by the text object.
| text | the text to query. |
|
inline |
The size of the text may change when the font or font style and size change.
| text | the Text to query. |
| w | a pointer filled in with the width of the text, in pixels, may be nullptr. |
| h | a pointer filled in with the height of the text, in pixels, may be nullptr. |
| Error | on failure. |
The size of the text may change when the font or font style and size change.
| text | the Text to query. |
| Error | on failure. |
|
inline |
If offset is less than 0, this will return a zero length substring at the beginning of the text with the SUBSTRING_TEXT_START flag set. If offset is greater than or equal to the length of the text string, this will return a zero length substring at the end of the text with the SUBSTRING_TEXT_END flag set.
| text | the Text to query. |
| offset | a byte offset into the text string. |
| substring | a pointer filled in with the substring containing the offset. |
| Error | on failure. |
|
inline |
If line is less than 0, this will return a zero length substring at the beginning of the text with the SUBSTRING_TEXT_START flag set. If line is greater than or equal to text->num_lines this will return a zero length substring at the end of the text with the SUBSTRING_TEXT_END flag set.
| text | the Text to query. |
| line | a zero-based line index, in the range [0 .. text->num_lines-1]. |
| substring | a pointer filled in with the substring containing the offset. |
| Error | on failure. |
|
inline |
This will return the closest substring of text to the given point.
| text | the Text to query. |
| p | the coordinates relative to the top-left side of the text, may be outside the bounds of the text area. |
| substring | a pointer filled in with the closest substring of text to the given point. |
| Error | on failure. |
|
inline |
| text | the Text to query. |
| offset | a byte offset into the text string. |
| length | the length of the range being queried, in bytes, or -1 for the remainder of the string. |
|
inline |
| text | the Text to query. |
| Error | on failure. |
|
inline |
|
inline |
|
inline |
| Error | on failure. |
|
inline |
| ch | the codepoint to check. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| offset | the offset, in bytes, from the beginning of the string if >= 0, the offset from the end of the string if < 0. Note that this does not do UTF-8 validation, so you should only insert at UTF-8 sequence boundaries. |
| string | the UTF-8 text to insert. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| offset | the offset, in bytes, from the beginning of the string if >= 0, the offset from the end of the string if < 0. Note that this does not do UTF-8 validation, so you should only insert at UTF-8 sequence boundaries. |
| string | the UTF-8 text to insert. |
| Error | on failure. |
|
inline |
A "fixed-width" font means all glyphs are the same width across; a lowercase 'i' will be the same size across as a capital 'W', for example. This is common for terminals and text editors, and other apps that treat text as a grid. Most other things (WYSIWYG word processors, web pages, etc) are more likely to not be fixed-width in most cases.
|
inline |
Scalability lets us distinguish between outline and bitmap fonts.
|
inline |
|
inline |
This reports the number of characters that can be rendered before reaching max_width.
This does not need to render the string to do this calculation.
| font | the font to query. |
| text | text to calculate, in UTF-8 encoding. |
| max_width | maximum width, in pixels, available for the string, or 0 for unbounded width. |
| measured_width | a pointer filled in with the width, in pixels, of the string that will fit, may be nullptr. |
| measured_length | a pointer filled in with the length, in bytes, of the string that will fit, may be nullptr. |
| Error | on failure. |
|
inline |
This reports the number of characters that can be rendered before reaching max_width.
This does not need to render the string to do this calculation.
| text | text to calculate, in UTF-8 encoding. |
| max_width | maximum width, in pixels, available for the string, or 0 for unbounded width. |
| measured_width | a pointer filled in with the width, in pixels, of the string that will fit, may be nullptr. |
| measured_length | a pointer filled in with the length, in bytes, of the string that will fit, may be nullptr. |
| Error | on failure. |
|
inline |
Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.
If closeio is true, src will be automatically closed once the font is closed. Otherwise you should keep src open until the font is closed.
When done with the returned Font, use Font.Close() to dispose of it.
| src | an IOStream to provide a font file's data. |
| ptsize | point size to use for the newly-opened font. |
| closeio | true to close src when the font is closed, false to leave it open. |
| Error | on failure. |
|
inline |
Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.
When done with the returned Font, use Font.Close() to dispose of it.
| file | path to font file. |
| ptsize | point size to use for the newly-opened font. |
| Error | on failure. |
|
inline |
These are the supported properties:
prop::Font.CREATE_FILENAME_STRING: the font file to open, if an IOStream isn't being used. This is required if prop::Font.CREATE_IOSTREAM_POINTER and prop::Font.CREATE_EXISTING_FONT_POINTER aren't set.prop::Font.CREATE_IOSTREAM_POINTER: an IOStream containing the font to be opened. This should not be closed until the font is closed. This is required if prop::Font.CREATE_FILENAME_STRING and prop::Font.CREATE_EXISTING_FONT_POINTER aren't set.prop::Font.CREATE_IOSTREAM_OFFSET_NUMBER: the offset in the iostream for the beginning of the font, defaults to 0.prop::Font.CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN: true if closing the font should also close the associated IOStream.prop::Font.CREATE_SIZE_FLOAT: the point size of the font. Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.prop::Font.CREATE_FACE_NUMBER: the face index of the font, if the font contains multiple font faces.prop::Font.CREATE_HORIZONTAL_DPI_NUMBER: the horizontal DPI to use for font rendering, defaults to prop::Font.CREATE_VERTICAL_DPI_NUMBER if set, or 72 otherwise.prop::Font.CREATE_VERTICAL_DPI_NUMBER: the vertical DPI to use for font rendering, defaults to prop::Font.CREATE_HORIZONTAL_DPI_NUMBER if set, or 72 otherwise.prop::Font.CREATE_EXISTING_FONT_POINTER: an optional Font that, if set, will be used as the font data source and the initial size and style of the new font.| props | the properties to use. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font.
| fallback | the font to remove as a fallback. |
This updates any Text objects using this font.
| font | the font to modify. |
| fallback | the font to remove as a fallback. |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Shaded, and Font.RenderGlyph_LCD.
| font | the font to render with. |
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Shaded, and Font.RenderGlyph_LCD.
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Shaded, and Font.RenderGlyph_Blended.
| font | the font to render with. |
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Shaded, and Font.RenderGlyph_Blended.
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Blended, and Font.RenderGlyph_LCD.
| font | the font to render with. |
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Solid, Font.RenderGlyph_Blended, and Font.RenderGlyph_LCD.
| ch | the codepoint to render. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Shaded, Font.RenderGlyph_Blended, and Font.RenderGlyph_LCD.
| font | the font to render with. |
| ch | the character to render. |
| fg | the foreground color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
The glyph is rendered without any padding or centering in the X direction, and aligned normally in the Y direction.
You can render at other quality levels with Font.RenderGlyph_Shaded, Font.RenderGlyph_Blended, and Font.RenderGlyph_LCD.
| ch | the character to render. |
| fg | the foreground color for the text. |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Blended_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Shaded, and Font.RenderText_LCD.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Blended_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Shaded, and Font.RenderText_LCD.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
|
inline |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Shaded_Wrapped, and Font.RenderText_LCD_Wrapped.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
|
inline |
This function will allocate a new 32-bit, ARGB surface, using alpha blending to dither the font with the given color. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Shaded_Wrapped, and Font.RenderText_LCD_Wrapped.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_LCD_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Shaded, and Font.RenderText_Blended.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_LCD_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Shaded, and Font.RenderText_Blended.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
|
inline |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Shaded_Wrapped, and Font.RenderText_Blended_Wrapped.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
|
inline |
This function will allocate a new 32-bit, ARGB surface, and render alpha-blended text using FreeType's LCD subpixel rendering. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Shaded_Wrapped, and Font.RenderText_Blended_Wrapped.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Shaded_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Blended, and Font.RenderText_LCD.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Shaded_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid, Font.RenderText_Blended, and Font.RenderText_LCD.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
|
inline |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Blended_Wrapped, and Font.RenderText_LCD_Wrapped.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
|
inline |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the specified background color, while other pixels have varying degrees of the foreground color. This function returns the new surface, or nullptr if there was an error.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels.
If wrap_width is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Solid_Wrapped, Font.RenderText_Blended_Wrapped, and Font.RenderText_LCD_Wrapped.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| bg | the background color for the text. |
| wrap_width | the maximum width of the text surface or 0 to wrap on newline characters. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Solid_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Shaded, Font.RenderText_Blended, and Font.RenderText_LCD.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
This will not word-wrap the string; you'll get a surface with a single line of text, as long as the string requires. You can use Font.RenderText_Solid_Wrapped() instead if you need to wrap the output to multiple lines.
This will not wrap on newline characters.
You can render at other quality levels with Font.RenderText_Shaded, Font.RenderText_Blended, and Font.RenderText_LCD.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
|
inline |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrapLength in pixels.
If wrapLength is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Shaded_Wrapped, Font.RenderText_Blended_Wrapped, and Font.RenderText_LCD_Wrapped.
| font | the font to render with. |
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| wrapLength | the maximum width of the text surface or 0 to wrap on newline characters. |
|
inline |
This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color.
Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrapLength in pixels.
If wrapLength is 0, this function will only wrap on newline characters.
You can render at other quality levels with Font.RenderText_Shaded_Wrapped, Font.RenderText_Blended_Wrapped, and Font.RenderText_LCD_Wrapped.
| text | text to render, in UTF-8 encoding. |
| fg | the foreground color for the text. |
| wrapLength | the maximum width of the text surface or 0 to wrap on newline characters. |
|
inline |
The default text color is white (255, 255, 255, 255).
| c | the color values in the range of 0-255. |
| Error | on failure. |
|
inline |
The default text color is white (1.0f, 1.0f, 1.0f, 1.0f).
| c | the color value, normally in the range of 0-1. |
| Error | on failure. |
|
inline |
This function only supports left-to-right text shaping if SDL_ttf was not built with HarfBuzz support.
This updates any Text objects using this font.
| direction | the new direction for text to flow. |
| Error | on failure. |
|
inline |
This function only supports left-to-right text shaping if SDL_ttf was not built with HarfBuzz support.
| direction | the new direction for text to flow. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| engine | the text engine to use for drawing. |
| Error | on failure. |
|
inline |
When a text object has a font, any changes to the font will automatically regenerate the text. If you set the font to nullptr, the text will continue to render but changes to the font will no longer affect the text.
This function may cause the internal text representation to be rebuilt.
| font | the font to use, may be nullptr. |
This function only supports left-to-right text shaping if SDL_ttf was not built with HarfBuzz support.
This updates any Text objects using this font.
| font | the font to modify. |
| direction | the new direction for text to flow. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
The hinter setting is a single value:
HINTING_NORMALHINTING_LIGHTHINTING_MONOHINTING_NONEHINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)| font | the font to set a new hinter setting on. |
| hinting | the new hinter setting. |
|
inline |
Newly-opened fonts default to allowing kerning. This is generally a good policy unless you have a strong reason to disable it, as it tends to produce better rendering (with kerning disabled, some fonts might render the word kerning as something that looks like keming for example).
This updates any Text objects using this font.
| font | the font to set kerning on. |
| enabled | true to enable kerning, false to disable. |
|
inline |
If SDL_ttf was not built with HarfBuzz support, this function returns false.
This updates any Text objects using this font.
| font | the font to specify a language for. |
| language_bcp47 | a null-terminated string containing the desired language's BCP47 code. Or null to reset the value. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font.
| font | the font to modify. |
| lineskip | the new line spacing for the font. |
|
inline |
This uses the font properties prop::Font.OUTLINE_LINE_CAP_NUMBER, prop::Font.OUTLINE_LINE_JOIN_NUMBER, and prop::Font.OUTLINE_MITER_LIMIT_NUMBER when setting the font outline.
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| font | the font to set a new outline on. |
| outline | positive outline value, 0 to default. |
| Error | on failure. |
This returns false if SDL_ttf isn't built with HarfBuzz support.
This updates any Text objects using this font.
| font | the font to modify. |
| script | an ISO 15924 code. |
| Error | on failure. |
|
inline |
SDF is a technique that helps fonts look sharp even when scaling and rotating, and requires special shader support for display.
This works with Blended APIs, and generates the raw signed distance values in the alpha channel of the resulting texture.
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| font | the font to set SDF support on. |
| enabled | true to enable SDF, false to disable. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| font | the font to resize. |
| ptsize | the new point size. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| font | the font to resize. |
| ptsize | the new point size. |
| hdpi | the target horizontal DPI. |
| vdpi | the target vertical DPI. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
The font styles are a set of bit flags, OR'd together:
STYLE_NORMAL (is zero)STYLE_BOLDSTYLE_ITALICSTYLE_UNDERLINESTYLE_STRIKETHROUGH| font | the font to set a new style on. |
| style | the new style values to set, OR'd together. |
|
inline |
This updates any Text objects using this font.
| font | the font to set a new wrap alignment option on. |
| align | the new wrap alignment option. |
|
inline |
| engine | a TextEngine object created with GPUTextEngine.GPUTextEngine(). |
| winding | the new winding order option. |
|
inline |
| winding | the new winding order option. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
The hinter setting is a single value:
HINTING_NORMALHINTING_LIGHTHINTING_MONOHINTING_NONEHINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)| hinting | the new hinter setting. |
|
inline |
Newly-opened fonts default to allowing kerning. This is generally a good policy unless you have a strong reason to disable it, as it tends to produce better rendering (with kerning disabled, some fonts might render the word kerning as something that looks like keming for example).
This updates any Text objects using this font.
| enabled | true to enable kerning, false to disable. |
|
inline |
If SDL_ttf was not built with HarfBuzz support, this function returns false.
This updates any Text objects using this font.
| language_bcp47 | a null-terminated string containing the desired language's BCP47 code. Or null to reset the value. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font.
| lineskip | the new line spacing for the font. |
|
inline |
This uses the font properties prop::Font.OUTLINE_LINE_CAP_NUMBER, prop::Font.OUTLINE_LINE_JOIN_NUMBER, and prop::Font.OUTLINE_MITER_LIMIT_NUMBER when setting the font outline.
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| outline | positive outline value, 0 to default. |
| Error | on failure. |
|
inline |
This can be used to position multiple text objects within a single wrapping text area.
This function may cause the internal text representation to be rebuilt.
| p | the x, y offset of the upper left corner of this text in pixels. |
|
inline |
This returns false if SDL_ttf isn't built with HarfBuzz support.
This updates any Text objects using this font.
| script | an ISO 15924 code. |
| Error | on failure. |
|
inline |
This returns false if SDL_ttf isn't built with HarfBuzz support.
| script | an ISO 15924 code. |
| Error | on failure. |
|
inline |
SDF is a technique that helps fonts look sharp even when scaling and rotating, and requires special shader support for display.
This works with Blended APIs, and generates the raw signed distance values in the alpha channel of the resulting texture.
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| enabled | true to enable SDF, false to disable. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| ptsize | the new point size. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
| ptsize | the new point size. |
| hdpi | the target horizontal DPI. |
| vdpi | the target vertical DPI. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| string | the UTF-8 text to use. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font, and clears already-generated glyphs, if any, from the cache.
The font styles are a set of bit flags, OR'd together:
STYLE_NORMAL (is zero)STYLE_BOLDSTYLE_ITALICSTYLE_UNDERLINESTYLE_STRIKETHROUGH| style | the new style values to set, OR'd together. |
The default text color is white (255, 255, 255, 255).
| text | the Text to modify. |
| c | the color value in the range of 0-255. |
| Error | on failure. |
The default text color is white (1.0f, 1.0f, 1.0f, 1.0f).
| text | the Text to modify. |
| c | the color value, normally in the range of 0-1. |
| Error | on failure. |
This function only supports left-to-right text shaping if SDL_ttf was not built with HarfBuzz support.
| text | the text to modify. |
| direction | the new direction for text to flow. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| engine | the text engine to use for drawing. |
| Error | on failure. |
When a text object has a font, any changes to the font will automatically regenerate the text. If you set the font to nullptr, the text will continue to render but changes to the font will no longer affect the text.
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| font | the font to use, may be nullptr. |
This can be used to position multiple text objects within a single wrapping text area.
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| p | the x, y offset of the upper left corner of this text in pixels. |
This returns false if SDL_ttf isn't built with HarfBuzz support.
| text | the text to modify. |
| script | an ISO 15924 code. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| string | the UTF-8 text to use, may be nullptr. |
| Error | on failure. |
|
inline |
If the whitespace is visible, it will take up space for purposes of alignment and wrapping. This is good for editing, but looks better when centered or aligned if whitespace around line wrapping is hidden. This defaults false.
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| visible | true to show whitespace when wrapping text, false to hide it. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| text | the Text to modify. |
| wrap_width | the maximum width in pixels, 0 to wrap on newline characters. |
| Error | on failure. |
|
inline |
This updates any Text objects using this font.
| align | the new wrap alignment option. |
|
inline |
If the whitespace is visible, it will take up space for purposes of alignment and wrapping. This is good for editing, but looks better when centered or aligned if whitespace around line wrapping is hidden. This defaults false.
This function may cause the internal text representation to be rebuilt.
| visible | true to show whitespace when wrapping text, false to hide it. |
| Error | on failure. |
|
inline |
This function may cause the internal text representation to be rebuilt.
| wrap_width | the maximum width in pixels, 0 to wrap on newline characters. |
| Error | on failure. |
|
inline |
| string | the 4 character string to convert. |
|
inline |
| tag | the 32-bit tag to convert. |
| string | a pointer filled in with the 4 character representation of the tag. |
| size | the size of the buffer pointed at by string, should be at least 4. |
|
inline |
| text | the Text to query. |
|
inline |
This is automatically done when the layout is requested or the text is rendered, but you can call this if you need more control over the timing of when the layout and text engine representation are updated.
| Error | on failure. |
|
inline |
This is automatically done when the layout is requested or the text is rendered, but you can call this if you need more control over the timing of when the layout and text engine representation are updated.
| text | the Text to update. |
| Error | on failure. |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |