//
// Generated by Brutal.Sdl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.SdlApi.Ttf
{
public readonly unsafe partial struct TtfFont
{
///
/// Add a fallback font.
///
/// the font to add as a fallback.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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 TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created
/// both fonts.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
///
public bool AddFallback(TtfFont fallback) => SdlTtf.AddFallbackFont(this, fallback);
///
/// Remove all fallback fonts.
///
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
///
public void ClearFallbackFonts() => SdlTtf.ClearFallbackFonts(this);
///
/// Dispose of a previously-created font.
///
///
///
/// Call this when done with a font. This function will free any resources
/// associated with it. It is safe to call this function on NULL, for example
/// on the result of a failed call to TTF_OpenFont().
///
///
/// The font is not valid after being passed to this function. String pointers
/// from functions that return information on this font, such as
/// TTF_GetFontFamilyName() and TTF_GetFontStyleName(), are no longer valid
/// after this call, as well.
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function should not be called while any other thread is
/// using the font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
///
public void Close()
{
if (IsNull())
{
return;
}
SdlTtf.CloseFont(this);
}
///
/// Ergonomic wrapper over TTF_CopyFont. Throws instead of returning a null handle on failure.
///
/// The created handle (never a null handle).
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public TtfFont Copy() => SdlTtf.CopyFont(this);
///
/// Check whether a glyph is provided by the font for a UNICODE codepoint.
///
/// the codepoint to check.
/// true if font provides a glyph for this character, false if not.
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool HasGlyph(uint ch) => SdlTtf.FontHasGlyph(this, ch);
///
/// Query whether a font is fixed-width.
///
/// true if the font is fixed-width, false otherwise.
///
///
/// 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.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool IsFixedWidth() => SdlTtf.FontIsFixedWidth(this);
///
/// Query whether a font is scalable or not.
///
/// true if the font is scalable, false otherwise.
///
///
/// Scalability lets us distinguish between outline and bitmap fonts.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool IsScalable() => SdlTtf.FontIsScalable(this);
///
/// Query the offset from the baseline to the top of a font.
///
/// the font's ascent.
///
///
/// This is a positive value, relative to the baseline.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public int GetAscent() => SdlTtf.GetFontAscent(this);
///
/// Get font target resolutions, in dots per inch.
///
/// a pointer filled in with the target horizontal DPI.
/// a pointer filled in with the target vertical DPI.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool GetDPI(out int hdpi, out int vdpi) => SdlTtf.GetFontDPI(this, out hdpi, out vdpi);
///
/// Query the offset from the baseline to the bottom of a font.
///
/// the font's descent.
///
///
/// This is a negative value, relative to the baseline.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public int GetDescent() => SdlTtf.GetFontDescent(this);
///
/// Get the direction to be used for text shaping by a font.
///
/// the direction to be used for text shaping.
///
///
/// This defaults to TTF_DIRECTION_INVALID if it hasn't been set.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public TtfDirection GetDirection() => SdlTtf.GetFontDirection(this);
///
/// Query a font's family name.
///
/// the font's family name.
///
///
/// 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 TTF_CloseFont().
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public string? GetFamilyName() => SdlTtf.GetFontFamilyName(this);
///
/// Get the font generation.
///
///
/// the font generation or 0 on failure; call SDL_GetError() for more
/// information.
///
///
///
/// The generation is incremented each time font properties change that require
/// rebuilding glyphs, such as style, size, etc.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public uint GetGeneration() => SdlTtf.GetFontGeneration(this);
///
/// Query the total height of a font.
///
/// the font's height.
///
///
/// This is usually equal to point size.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public int GetHeight() => SdlTtf.GetFontHeight(this);
///
/// Query a font's current FreeType hinter setting.
///
///
/// the font's current hinter value, or TTF_HINTING_INVALID if the
/// font is invalid.
///
///
///
/// The hinter setting is a single value:
///
///
/// - TTF_HINTING_NORMAL
/// - TTF_HINTING_LIGHT
/// - TTF_HINTING_MONO
/// - TTF_HINTING_NONE
/// - TTF_HINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public TtfHintingFlags GetHinting() => SdlTtf.GetFontHinting(this);
///
/// Query whether or not kerning is enabled for a font.
///
/// true if kerning is enabled, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool GetKerning() => SdlTtf.GetFontKerning(this);
///
/// Query the spacing between lines of text for a font.
///
/// the font's recommended spacing.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public int GetLineSkip() => SdlTtf.GetFontLineSkip(this);
///
/// Query a font's current outline.
///
/// the font's current outline value.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public int GetOutline() => SdlTtf.GetFontOutline(this);
///
/// Get the properties associated with a font.
///
///
/// a valid property ID on success or 0 on failure; call
/// SDL_GetError() for more information.
///
///
///
/// The following read-write properties are provided by SDL:
///
///
/// - TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER: The FT_Stroker_LineCap value
/// used when setting the font outline, defaults to
/// FT_STROKER_LINECAP_ROUND.
/// - TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER: The FT_Stroker_LineJoin value
/// used when setting the font outline, defaults to
/// FT_STROKER_LINEJOIN_ROUND.
/// - TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER: The FT_Fixed miter limit used
/// when setting the font outline, defaults to 0.
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public uint GetProperties() => SdlTtf.GetFontProperties(this);
///
/// Query whether Signed Distance Field rendering is enabled for a font.
///
/// true if enabled, false otherwise.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool GetSDF() => SdlTtf.GetFontSDF(this);
///
/// Get the script used for text shaping a font.
///
///
/// an
/// [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
/// or 0 if a script hasn't been set.
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public uint GetScript() => SdlTtf.GetFontScript(this);
///
/// Get the size of a font.
///
///
/// the size of the font, or 0.0f on failure; call SDL_GetError() for
/// more information.
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
///
public float GetSize() => SdlTtf.GetFontSize(this);
///
/// Query a font's current style.
///
/// the current font style, as a set of bit flags.
///
///
/// The font styles are a set of bit flags, OR'd together:
///
///
/// - TTF_STYLE_NORMAL (is zero)
/// - TTF_STYLE_BOLD
/// - TTF_STYLE_ITALIC
/// - TTF_STYLE_UNDERLINE
/// - TTF_STYLE_STRIKETHROUGH
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public TtfFontStyleFlags GetStyle() => SdlTtf.GetFontStyle(this);
///
/// Query a font's style name.
///
/// the font's style name.
///
///
/// 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 TTF_CloseFont().
///
///
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public string? GetStyleName() => SdlTtf.GetFontStyleName(this);
///
/// Query a font's weight, in terms of the lightness/heaviness of the strokes.
///
/// the font's current weight.
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.4.0.
///
public int GetWeight() => SdlTtf.GetFontWeight(this);
///
/// Query a font's current wrap alignment option.
///
/// the font's current wrap alignment option.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public TtfHorizontalAlignment GetWrapAlignment() => SdlTtf.GetFontWrapAlignment(this);
///
/// Get the pixel image for a UNICODE codepoint.
///
/// the codepoint to check.
///
/// a pointer filled in with the glyph image type, may be
/// NULL.
///
///
/// an SDL_Surface containing the glyph, or NULL on failure; call
/// SDL_GetError() for more information.
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public SdlSurface* GetGlyphImage(uint ch, out TtfImageType image_type) =>
SdlTtf.GetGlyphImage(this, ch, out image_type);
///
/// Get the pixel image for a character index.
///
/// the index of the glyph to return.
///
/// a pointer filled in with the glyph image type, may be
/// NULL.
///
///
/// an SDL_Surface containing the glyph, or NULL on failure; call
/// SDL_GetError() for more information.
///
///
///
/// This is useful for text engine implementations, which can call this with
/// the glyph_index in a TTF_CopyOperation
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public SdlSurface* GetGlyphImageForIndex(uint glyph_index, out TtfImageType image_type) =>
SdlTtf.GetGlyphImageForIndex(this, glyph_index, out image_type);
///
/// Query the kerning size between the glyphs of two UNICODE codepoints.
///
/// the previous codepoint.
/// the current codepoint.
///
/// a pointer filled in with the kerning size between the two
/// glyphs, in pixels, may be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool GetGlyphKerning(uint previous_ch, uint ch, out int kerning) =>
SdlTtf.GetGlyphKerning(this, previous_ch, ch, out kerning);
///
/// Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.
///
/// the codepoint to check.
///
/// 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.
///
///
/// a pointer filled in with the maximum x coordinate of the glyph
/// from the left edge of its bounding box.
///
///
/// 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.
///
///
/// a pointer filled in with the maximum y coordinate of the glyph
/// from the bottom edge of its bounding box.
///
///
/// a pointer filled in with the distance to the next glyph from
/// the left edge of this glyph's bounding box.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// To understand what these metrics mean, here is a useful link:
///
///
/// https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool GetGlyphMetrics(uint ch, out int minx, out int maxx, out int miny, out int maxy, out int advance) =>
SdlTtf.GetGlyphMetrics(this, ch, out minx, out maxx, out miny, out maxy, out advance);
///
/// Query the number of faces of a font.
///
/// the number of FreeType font faces.
///
/// It is safe to call this function from any thread.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public int GetNumFaces() => SdlTtf.GetNumFontFaces(this);
///
/// Calculate the dimensions of a rendered string of UTF-8 text.
///
/// text to calculate, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// will be filled with width, in pixels, on return.
/// will be filled with height, in pixels, on return.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This will report the width and height, in pixels, of the space that the
/// specified string will take to fully render.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool GetStringSize(string text, nuint length, int* w, int* h) =>
SdlTtf.GetStringSize(this, text, length, w, h);
///
/// Calculate the dimensions of a rendered string of UTF-8 text.
///
/// text to calculate, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the maximum width or 0 to wrap on newline characters.
/// will be filled with width, in pixels, on return.
/// will be filled with height, in pixels, on return.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool GetStringSizeWrapped(string text, nuint length, int wrap_width, int* w, int* h) =>
SdlTtf.GetStringSizeWrapped(this, text, length, wrap_width, w, h);
///
/// Calculate how much of a UTF-8 string will fit in a given width.
///
/// text to calculate, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
///
/// maximum width, in pixels, available for the string, or 0
/// for unbounded width.
///
///
/// a pointer filled in with the width, in pixels, of the
/// string that will fit, may be NULL.
///
///
/// a pointer filled in with the length, in bytes, of
/// the string that will fit, may be NULL.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool MeasureString(
string text,
nuint length,
int max_width,
int* measured_width,
nuint* measured_length
) => SdlTtf.MeasureString(this, text, length, max_width, measured_width, measured_length);
///
/// Remove a fallback font.
///
/// the font to remove as a fallback.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created
/// both fonts.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
///
public void RemoveFallback(TtfFont fallback) => SdlTtf.RemoveFallbackFont(this, fallback);
///
/// Ergonomic wrapper over TTF_RenderGlyph_Blended. Throws instead of returning a null pointer on
/// failure.
///
/// the codepoint to render.
/// the foreground color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderGlyphBlended(uint ch, SdlColor fg) => SdlTtf.RenderGlyphBlended(this, ch, fg);
///
/// Ergonomic wrapper over TTF_RenderGlyph_LCD. Throws instead of returning a null pointer on failure.
///
/// the codepoint to render.
/// the foreground color for the text.
/// the background color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderGlyphLCD(uint ch, SdlColor fg, SdlColor bg) => SdlTtf.RenderGlyphLCD(this, ch, fg, bg);
///
/// Ergonomic wrapper over TTF_RenderGlyph_Shaded. Throws instead of returning a null pointer on
/// failure.
///
/// the codepoint to render.
/// the foreground color for the text.
/// the background color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderGlyphShaded(uint ch, SdlColor fg, SdlColor bg) =>
SdlTtf.RenderGlyphShaded(this, ch, fg, bg);
///
/// Ergonomic wrapper over TTF_RenderGlyph_Solid. Throws instead of returning a null pointer on
/// failure.
///
/// the character to render.
/// the foreground color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderGlyphSolid(uint ch, SdlColor fg) => SdlTtf.RenderGlyphSolid(this, ch, fg);
///
/// Ergonomic wrapper over TTF_RenderText_Blended. Throws instead of returning a null pointer on
/// failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextBlended(string text, nuint length, SdlColor fg) =>
SdlTtf.RenderTextBlended(this, text, length, fg);
///
/// Ergonomic wrapper over TTF_RenderText_Blended_Wrapped. Throws instead of returning a null pointer
/// on failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
///
/// the maximum width of the text surface or 0 to wrap on
/// newline characters.
///
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextBlendedWrapped(string text, nuint length, SdlColor fg, int wrap_width) =>
SdlTtf.RenderTextBlendedWrapped(this, text, length, fg, wrap_width);
///
/// Ergonomic wrapper over TTF_RenderText_LCD. Throws instead of returning a null pointer on failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// the background color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextLCD(string text, nuint length, SdlColor fg, SdlColor bg) =>
SdlTtf.RenderTextLCD(this, text, length, fg, bg);
///
/// Ergonomic wrapper over TTF_RenderText_LCD_Wrapped. Throws instead of returning a null pointer on
/// failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// the background color for the text.
///
/// the maximum width of the text surface or 0 to wrap on
/// newline characters.
///
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextLCDWrapped(string text, nuint length, SdlColor fg, SdlColor bg, int wrap_width) =>
SdlTtf.RenderTextLCDWrapped(this, text, length, fg, bg, wrap_width);
///
/// Ergonomic wrapper over TTF_RenderText_Shaded. Throws instead of returning a null pointer on
/// failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// the background color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextShaded(string text, nuint length, SdlColor fg, SdlColor bg) =>
SdlTtf.RenderTextShaded(this, text, length, fg, bg);
///
/// Ergonomic wrapper over TTF_RenderText_Shaded_Wrapped. Throws instead of returning a null pointer on
/// failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// the background color for the text.
///
/// the maximum width of the text surface or 0 to wrap on
/// newline characters.
///
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextShadedWrapped(
string text,
nuint length,
SdlColor fg,
SdlColor bg,
int wrap_width
) => SdlTtf.RenderTextShadedWrapped(this, text, length, fg, bg, wrap_width);
///
/// Ergonomic wrapper over TTF_RenderText_Solid. Throws instead of returning a null pointer on failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextSolid(string text, nuint length, SdlColor fg) =>
SdlTtf.RenderTextSolid(this, text, length, fg);
///
/// Ergonomic wrapper over TTF_RenderText_Solid_Wrapped. Throws instead of returning a null pointer on
/// failure.
///
/// text to render, in UTF-8 encoding.
///
/// the length of the text, in bytes, or 0 for null terminated
/// text.
///
/// the foreground color for the text.
///
/// the maximum width of the text surface or 0 to wrap on
/// newline characters.
///
/// The created resource (never null); the caller owns it and is responsible for freeing it.
/// The SDL call failed; the message carries the SDL_GetError
/// text.
public SdlSurface* RenderTextSolidWrapped(string text, nuint length, SdlColor fg, int wrapLength) =>
SdlTtf.RenderTextSolidWrapped(this, text, length, fg, wrapLength);
///
/// Set the direction to be used for text shaping by a font.
///
/// the new direction for text to flow.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This function only supports left-to-right text shaping if SDL_ttf was not
/// built with HarfBuzz support.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool SetDirection(TtfDirection direction) => SdlTtf.SetFontDirection(this, direction);
///
/// Set a font's current hinter setting.
///
/// the new hinter setting.
///
///
/// This updates any TTF_Text objects using this font, and clears
/// already-generated glyphs, if any, from the cache.
///
///
/// The hinter setting is a single value:
///
///
/// - TTF_HINTING_NORMAL
/// - TTF_HINTING_LIGHT
/// - TTF_HINTING_MONO
/// - TTF_HINTING_NONE
/// - TTF_HINTING_LIGHT_SUBPIXEL (available in SDL_ttf 3.0.0 and later)
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public void SetHinting(TtfHintingFlags hinting) => SdlTtf.SetFontHinting(this, hinting);
///
/// Set if kerning is enabled for a font.
///
/// true to enable kerning, false to disable.
///
///
/// 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 TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public void SetKerning(bool enabled) => SdlTtf.SetFontKerning(this, enabled);
///
/// Set language to be used for text shaping by a font.
///
///
/// a null-terminated string containing the desired
/// language's BCP47 code. Or null to reset the value.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// If SDL_ttf was not built with HarfBuzz support, this function returns
/// false.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
public bool SetLanguage(string language_bcp47) => SdlTtf.SetFontLanguage(this, language_bcp47);
///
/// Set the spacing between lines of text for a font.
///
/// the new line spacing for the font.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public void SetLineSkip(int lineskip) => SdlTtf.SetFontLineSkip(this, lineskip);
///
/// Set a font's current outline.
///
/// positive outline value, 0 to default.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This uses the font properties TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER,
/// TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER, and
/// TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER when setting the font outline.
///
///
/// This updates any TTF_Text objects using this font, and clears
/// already-generated glyphs, if any, from the cache.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool SetOutline(int outline) => SdlTtf.SetFontOutline(this, outline);
///
/// Enable Signed Distance Field rendering for a font.
///
/// true to enable SDF, false to disable.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// 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 TTF_Text objects using this font, and clears
/// already-generated glyphs, if any, from the cache.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool SetSDF(bool enabled) => SdlTtf.SetFontSDF(this, enabled);
///
/// Set the script to be used for text shaping by a font.
///
///
/// an
/// [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
/// .
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This returns false if SDL_ttf isn't built with HarfBuzz support.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool SetScript(uint script) => SdlTtf.SetFontScript(this, script);
///
/// Set a font's size dynamically.
///
/// the new point size.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This updates any TTF_Text objects using this font, and clears
/// already-generated glyphs, if any, from the cache.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool SetSize(float ptsize) => SdlTtf.SetFontSize(this, ptsize);
///
/// Set font size dynamically with target resolutions, in dots per inch.
///
/// the new point size.
/// the target horizontal DPI.
/// the target vertical DPI.
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// This updates any TTF_Text objects using this font, and clears
/// already-generated glyphs, if any, from the cache.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public bool SetSizeDPI(float ptsize, int hdpi, int vdpi) => SdlTtf.SetFontSizeDPI(this, ptsize, hdpi, vdpi);
///
/// Set a font's current style.
///
/// the new style values to set, OR'd together.
///
///
/// This updates any TTF_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:
///
///
/// - TTF_STYLE_NORMAL (is zero)
/// - TTF_STYLE_BOLD
/// - TTF_STYLE_ITALIC
/// - TTF_STYLE_UNDERLINE
/// - TTF_STYLE_STRIKETHROUGH
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public void SetStyle(TtfFontStyleFlags style) => SdlTtf.SetFontStyle(this, style);
///
/// Set a font's current wrap alignment option.
///
/// the new wrap alignment option.
///
///
/// This updates any TTF_Text objects using this font.
///
///
///
/// This function should be called on the thread that created the
/// font.
///
///
/// This function is available since SDL_ttf 3.0.0.
///
///
public void SetWrapAlignment(TtfHorizontalAlignment align) => SdlTtf.SetFontWrapAlignment(this, align);
}
}