SDL3_ttf
This page is under development.
- SDL3_ttf.TTF_AddFallbackFont(font: LP_TTF_Font, fallback: LP_TTF_Font) c_bool[source]
Add a fallback font.
- SDL3_ttf.TTF_AppendTextString(text: LP_TTF_Text, string: c_char_p, length: c_size_t) c_bool[source]
Append UTF-8 text to a text object.
- SDL3_ttf.TTF_CopyFont(existing_font: LP_TTF_Font) LP_TTF_Font[source]
Create a copy of an existing font.
- SDL3_ttf.TTF_CreateGPUTextEngine(device: LP_SDL_GPUDevice) LP_TTF_TextEngine[source]
Create a text engine for drawing text with the SDL GPU API.
- SDL3_ttf.TTF_CreateGPUTextEngineWithProperties(props: SDL_PropertiesID) LP_TTF_TextEngine[source]
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
- SDL3_ttf.TTF_CreateRendererTextEngine(renderer: LP_SDL_Renderer) LP_TTF_TextEngine[source]
Create a text engine for drawing text on an SDL renderer.
- SDL3_ttf.TTF_CreateRendererTextEngineWithProperties(props: SDL_PropertiesID) LP_TTF_TextEngine[source]
Create a text engine for drawing text on an SDL renderer, with the specified properties.
- SDL3_ttf.TTF_CreateSurfaceTextEngine() LP_TTF_TextEngine[source]
Create a text engine for drawing text on SDL surfaces.
- SDL3_ttf.TTF_CreateText(engine: LP_TTF_TextEngine, font: LP_TTF_Font, text: c_char_p, length: c_size_t) LP_TTF_Text[source]
Create a text object from UTF-8 text and a text engine.
- SDL3_ttf.TTF_DeleteTextString(text: LP_TTF_Text, offset: c_int, length: c_int) c_bool[source]
Delete UTF-8 text from a text object.
- SDL3_ttf.TTF_DestroyGPUTextEngine(engine: LP_TTF_TextEngine) None[source]
Destroy a text engine created for drawing text with the SDL GPU API.
- SDL3_ttf.TTF_DestroyRendererTextEngine(engine: LP_TTF_TextEngine) None[source]
Destroy a text engine created for drawing text on an SDL renderer.
- SDL3_ttf.TTF_DestroySurfaceTextEngine(engine: LP_TTF_TextEngine) None[source]
Destroy a text engine created for drawing text on SDL surfaces.
- SDL3_ttf.TTF_DestroyText(text: LP_TTF_Text) None[source]
Destroy a text object created by a text engine.
- SDL3_ttf.TTF_DrawRendererText(text: LP_TTF_Text, x: c_float, y: c_float) c_bool[source]
Draw text to an SDL renderer.
- SDL3_ttf.TTF_DrawSurfaceText(text: LP_TTF_Text, x: c_int, y: c_int, surface: LP_SDL_Surface) c_bool[source]
Draw text to an SDL surface.
- SDL3_ttf.TTF_FontHasGlyph(font: LP_TTF_Font, ch: c_uint32) c_bool[source]
Check whether a glyph is provided by the font for a UNICODE codepoint.
- SDL3_ttf.TTF_FontIsFixedWidth(font: LP_TTF_Font) c_bool[source]
Query whether a font is fixed-width.
- SDL3_ttf.TTF_FontIsScalable(font: LP_TTF_Font) c_bool[source]
Query whether a font is scalable or not.
- SDL3_ttf.TTF_GetFontAscent(font: LP_TTF_Font) c_int[source]
Query the offset from the baseline to the top of a font.
- SDL3_ttf.TTF_GetFontDPI(font: LP_TTF_Font, hdpi: LP_c_int, vdpi: LP_c_int) c_bool[source]
Get font target resolutions, in dots per inch.
- SDL3_ttf.TTF_GetFontDescent(font: LP_TTF_Font) c_int[source]
Query the offset from the baseline to the bottom of a font.
- SDL3_ttf.TTF_GetFontDirection(font: LP_TTF_Font) TTF_Direction[source]
Get the direction to be used for text shaping by a font.
- SDL3_ttf.TTF_GetFontHinting(font: LP_TTF_Font) TTF_HintingFlags[source]
Query a font’s current FreeType hinter setting.
- SDL3_ttf.TTF_GetFontKerning(font: LP_TTF_Font) c_bool[source]
Query whether or not kerning is enabled for a font.
- SDL3_ttf.TTF_GetFontLineSkip(font: LP_TTF_Font) c_int[source]
Query the spacing between lines of text for a font.
- SDL3_ttf.TTF_GetFontProperties(font: LP_TTF_Font) SDL_PropertiesID[source]
Get the properties associated with a font.
- SDL3_ttf.TTF_GetFontSDF(font: LP_TTF_Font) c_bool[source]
Query whether Signed Distance Field rendering is enabled for a font.
- SDL3_ttf.TTF_GetFontScript(font: LP_TTF_Font) c_uint32[source]
Get the script used for text shaping a font.
- SDL3_ttf.TTF_GetFontStyle(font: LP_TTF_Font) TTF_FontStyleFlags[source]
Query a font’s current style.
- SDL3_ttf.TTF_GetFontWeight(font: LP_TTF_Font) c_int[source]
Query a font’s weight, in terms of the lightness/heaviness of the strokes.
- SDL3_ttf.TTF_GetFontWrapAlignment(font: LP_TTF_Font) TTF_HorizontalAlignment[source]
Query a font’s current wrap alignment option.
- SDL3_ttf.TTF_GetFreeTypeVersion(major: LP_c_int, minor: LP_c_int, patch: LP_c_int) None[source]
Query the version of the FreeType library in use.
- SDL3_ttf.TTF_GetGPUTextDrawData(text: LP_TTF_Text) LP_TTF_GPUAtlasDrawSequence[source]
Get the geometry data needed for drawing the text.
- SDL3_ttf.TTF_GetGPUTextEngineWinding(engine: LP_TTF_TextEngine) TTF_GPUTextEngineWinding[source]
Get the winding order of the vertices returned by TTF_GetGPUTextDrawData for a particular GPU text engine
- SDL3_ttf.TTF_GetGlyphImage(font: LP_TTF_Font, ch: c_uint32, image_type: LP_TTF_ImageType) LP_SDL_Surface[source]
Get the pixel image for a UNICODE codepoint.
- SDL3_ttf.TTF_GetGlyphImageForIndex(font: LP_TTF_Font, glyph_index: c_uint32, image_type: LP_TTF_ImageType) LP_SDL_Surface[source]
Get the pixel image for a character index.
- SDL3_ttf.TTF_GetGlyphKerning(font: LP_TTF_Font, previous_ch: c_uint32, ch: c_uint32, kerning: LP_c_int) c_bool[source]
Query the kerning size between the glyphs of two UNICODE codepoints.
- SDL3_ttf.TTF_GetGlyphMetrics(font: LP_TTF_Font, ch: c_uint32, minx: LP_c_int, maxx: LP_c_int, miny: LP_c_int, maxy: LP_c_int, advance: LP_c_int) c_bool[source]
Query the metrics (dimensions) of a font’s glyph for a UNICODE codepoint.
- SDL3_ttf.TTF_GetGlyphScript(ch: c_uint32) c_uint32[source]
Get the script used by a 32-bit codepoint.
- SDL3_ttf.TTF_GetHarfBuzzVersion(major: LP_c_int, minor: LP_c_int, patch: LP_c_int) None[source]
Query the version of the HarfBuzz library in use.
- SDL3_ttf.TTF_GetNextTextSubString(text: LP_TTF_Text, substring: LP_TTF_SubString, next: LP_TTF_SubString) c_bool[source]
Get the next substring in a text object
- SDL3_ttf.TTF_GetPreviousTextSubString(text: LP_TTF_Text, substring: LP_TTF_SubString, previous: LP_TTF_SubString) c_bool[source]
Get the previous substring in a text object
- SDL3_ttf.TTF_GetStringSize(font: LP_TTF_Font, text: c_char_p, length: c_size_t, w: LP_c_int, h: LP_c_int) c_bool[source]
Calculate the dimensions of a rendered string of UTF-8 text.
- SDL3_ttf.TTF_GetStringSizeWrapped(font: LP_TTF_Font, text: c_char_p, length: c_size_t, wrap_width: c_int, w: LP_c_int, h: LP_c_int) c_bool[source]
Calculate the dimensions of a rendered string of UTF-8 text.
- SDL3_ttf.TTF_GetTextColor(text: LP_TTF_Text, r: LP_c_uint8, g: LP_c_uint8, b: LP_c_uint8, a: LP_c_uint8) c_bool[source]
Get the color of a text object.
- SDL3_ttf.TTF_GetTextColorFloat(text: LP_TTF_Text, r: LP_c_float, g: LP_c_float, b: LP_c_float, a: LP_c_float) c_bool[source]
Get the color of a text object.
- SDL3_ttf.TTF_GetTextDirection(text: LP_TTF_Text) TTF_Direction[source]
Get the direction to be used for text shaping a text object.
- SDL3_ttf.TTF_GetTextEngine(text: LP_TTF_Text) LP_TTF_TextEngine[source]
Get the text engine used by a text object.
- SDL3_ttf.TTF_GetTextFont(text: LP_TTF_Text) LP_TTF_Font[source]
Get the font used by a text object.
- SDL3_ttf.TTF_GetTextPosition(text: LP_TTF_Text, x: LP_c_int, y: LP_c_int) c_bool[source]
Get the position of a text object.
- SDL3_ttf.TTF_GetTextProperties(text: LP_TTF_Text) SDL_PropertiesID[source]
Get the properties associated with a text object.
- SDL3_ttf.TTF_GetTextScript(text: LP_TTF_Text) c_uint32[source]
Get the script used for text shaping a text object.
- SDL3_ttf.TTF_GetTextSize(text: LP_TTF_Text, w: LP_c_int, h: LP_c_int) c_bool[source]
Get the size of a text object.
- SDL3_ttf.TTF_GetTextSubString(text: LP_TTF_Text, offset: c_int, substring: LP_TTF_SubString) c_bool[source]
Get the substring of a text object that surrounds a text offset.
- SDL3_ttf.TTF_GetTextSubStringForLine(text: LP_TTF_Text, line: c_int, substring: LP_TTF_SubString) c_bool[source]
Get the substring of a text object that contains the given line.
- SDL3_ttf.TTF_GetTextSubStringForPoint(text: LP_TTF_Text, x: c_int, y: c_int, substring: LP_TTF_SubString) c_bool[source]
Get the portion of a text string that is closest to a point.
- SDL3_ttf.TTF_GetTextSubStringsForRange(text: LP_TTF_Text, offset: c_int, length: c_int, count: LP_c_int) LP_LP_TTF_SubString[source]
Get the substrings of a text object that contain a range of text.
- SDL3_ttf.TTF_GetTextWrapWidth(text: LP_TTF_Text, wrap_width: LP_c_int) c_bool[source]
Get whether wrapping is enabled on a text object.
- SDL3_ttf.TTF_InsertTextString(text: LP_TTF_Text, offset: c_int, string: c_char_p, length: c_size_t) c_bool[source]
Insert UTF-8 text into a text object.
- SDL3_ttf.TTF_MeasureString(font: LP_TTF_Font, text: c_char_p, length: c_size_t, max_width: c_int, measured_width: LP_c_int, measured_length: LP_c_size_t) c_bool[source]
Calculate how much of a UTF-8 string will fit in a given width.
- SDL3_ttf.TTF_OpenFont(file: c_char_p, ptsize: c_float) LP_TTF_Font[source]
Create a font from a file, using a specified point size.
- SDL3_ttf.TTF_OpenFontIO(src: LP_SDL_IOStream, closeio: c_bool, ptsize: c_float) LP_TTF_Font[source]
Create a font from an SDL_IOStream, using a specified point size.
- SDL3_ttf.TTF_OpenFontWithProperties(props: SDL_PropertiesID) LP_TTF_Font[source]
Create a font with the specified properties.
- SDL3_ttf.TTF_RemoveFallbackFont(font: LP_TTF_Font, fallback: LP_TTF_Font) None[source]
Remove a fallback font.
- SDL3_ttf.TTF_RenderGlyph_Blended(font: LP_TTF_Font, ch: c_uint32, fg: SDL_Color) LP_SDL_Surface[source]
Render a single UNICODE codepoint at high quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderGlyph_LCD(font: LP_TTF_Font, ch: c_uint32, fg: SDL_Color, bg: SDL_Color) LP_SDL_Surface[source]
Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderGlyph_Shaded(font: LP_TTF_Font, ch: c_uint32, fg: SDL_Color, bg: SDL_Color) LP_SDL_Surface[source]
Render a single UNICODE codepoint at high quality to a new 8-bit surface.
- SDL3_ttf.TTF_RenderGlyph_Solid(font: LP_TTF_Font, ch: c_uint32, fg: SDL_Color) LP_SDL_Surface[source]
Render a single 32-bit glyph at fast quality to a new 8-bit surface.
- SDL3_ttf.TTF_RenderText_Blended(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color) LP_SDL_Surface[source]
Render UTF-8 text at high quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderText_Blended_Wrapped(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, wrap_width: c_int) LP_SDL_Surface[source]
Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderText_LCD(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, bg: SDL_Color) LP_SDL_Surface[source]
Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderText_LCD_Wrapped(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, bg: SDL_Color, wrap_width: c_int) LP_SDL_Surface[source]
Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface.
- SDL3_ttf.TTF_RenderText_Shaded(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, bg: SDL_Color) LP_SDL_Surface[source]
Render UTF-8 text at high quality to a new 8-bit surface.
- SDL3_ttf.TTF_RenderText_Shaded_Wrapped(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, bg: SDL_Color, wrap_width: c_int) LP_SDL_Surface[source]
Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
- SDL3_ttf.TTF_RenderText_Solid(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color) LP_SDL_Surface[source]
Render UTF-8 text at fast quality to a new 8-bit surface.
- SDL3_ttf.TTF_RenderText_Solid_Wrapped(font: LP_TTF_Font, text: c_char_p, length: c_size_t, fg: SDL_Color, wrapLength: c_int) LP_SDL_Surface[source]
Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
- SDL3_ttf.TTF_SetFontDirection(font: LP_TTF_Font, direction: TTF_Direction) c_bool[source]
Set the direction to be used for text shaping by a font.
- SDL3_ttf.TTF_SetFontHinting(font: LP_TTF_Font, hinting: TTF_HintingFlags) None[source]
Set a font’s current hinter setting.
- SDL3_ttf.TTF_SetFontKerning(font: LP_TTF_Font, enabled: c_bool) None[source]
Set if kerning is enabled for a font.
- SDL3_ttf.TTF_SetFontLanguage(font: LP_TTF_Font, language_bcp47: c_char_p) c_bool[source]
Set language to be used for text shaping by a font.
- SDL3_ttf.TTF_SetFontLineSkip(font: LP_TTF_Font, lineskip: c_int) None[source]
Set the spacing between lines of text for a font.
- SDL3_ttf.TTF_SetFontOutline(font: LP_TTF_Font, outline: c_int) c_bool[source]
Set a font’s current outline.
- SDL3_ttf.TTF_SetFontSDF(font: LP_TTF_Font, enabled: c_bool) c_bool[source]
Enable Signed Distance Field rendering for a font.
- SDL3_ttf.TTF_SetFontScript(font: LP_TTF_Font, script: c_uint32) c_bool[source]
Set the script to be used for text shaping by a font.
- SDL3_ttf.TTF_SetFontSize(font: LP_TTF_Font, ptsize: c_float) c_bool[source]
Set a font’s size dynamically.
- SDL3_ttf.TTF_SetFontSizeDPI(font: LP_TTF_Font, ptsize: c_float, hdpi: c_int, vdpi: c_int) c_bool[source]
Set font size dynamically with target resolutions, in dots per inch.
- SDL3_ttf.TTF_SetFontStyle(font: LP_TTF_Font, style: TTF_FontStyleFlags) None[source]
Set a font’s current style.
- SDL3_ttf.TTF_SetFontWrapAlignment(font: LP_TTF_Font, align: TTF_HorizontalAlignment) None[source]
Set a font’s current wrap alignment option.
- SDL3_ttf.TTF_SetGPUTextEngineWinding(engine: LP_TTF_TextEngine, winding: TTF_GPUTextEngineWinding) None[source]
Sets the winding order of the vertices returned by TTF_GetGPUTextDrawData for a particular GPU text engine.
- SDL3_ttf.TTF_SetTextColor(text: LP_TTF_Text, r: c_uint8, g: c_uint8, b: c_uint8, a: c_uint8) c_bool[source]
Set the color of a text object.
- SDL3_ttf.TTF_SetTextColorFloat(text: LP_TTF_Text, r: c_float, g: c_float, b: c_float, a: c_float) c_bool[source]
Set the color of a text object.
- SDL3_ttf.TTF_SetTextDirection(text: LP_TTF_Text, direction: TTF_Direction) c_bool[source]
Set the direction to be used for text shaping a text object.
- SDL3_ttf.TTF_SetTextEngine(text: LP_TTF_Text, engine: LP_TTF_TextEngine) c_bool[source]
Set the text engine used by a text object.
- SDL3_ttf.TTF_SetTextFont(text: LP_TTF_Text, font: LP_TTF_Font) c_bool[source]
Set the font used by a text object.
- SDL3_ttf.TTF_SetTextPosition(text: LP_TTF_Text, x: c_int, y: c_int) c_bool[source]
Set the position of a text object.
- SDL3_ttf.TTF_SetTextScript(text: LP_TTF_Text, script: c_uint32) c_bool[source]
Set the script to be used for text shaping a text object.
- SDL3_ttf.TTF_SetTextString(text: LP_TTF_Text, string: c_char_p, length: c_size_t) c_bool[source]
Set the UTF-8 text used by a text object.
- SDL3_ttf.TTF_SetTextWrapWhitespaceVisible(text: LP_TTF_Text, visible: c_bool) c_bool[source]
Set whether whitespace should be visible when wrapping a text object.
- SDL3_ttf.TTF_SetTextWrapWidth(text: LP_TTF_Text, wrap_width: c_int) c_bool[source]
Set whether wrapping is enabled on a text object.
- SDL3_ttf.TTF_StringToTag(string: c_char_p) c_uint32[source]
Convert from a 4 character string to a 32-bit tag.
- SDL3_ttf.TTF_TagToString(tag: c_uint32, string: c_char_p, size: c_size_t) None[source]
Convert from a 32-bit tag to a 4 character string.
- SDL3_ttf.TTF_TextWrapWhitespaceVisible(text: LP_TTF_Text) c_bool[source]
Return whether whitespace is shown when wrapping a text object.