Class Font

D class that wraps TTF_Font enclosing a font object to render text from

class Font ;

Constructors

NameDescription
this (ttfFont, isOwner, userRef) Constructs a Font from a vanilla TTF_Font* from bindbc-sdl
this (file, size) Loads a Font from a font file, which wraps TTF_OpenFont
this (file, size, index) Loads a Font from a font file with a face index, which wraps TTF_OpenFontIndex
this (data, size) Loads a Font from a buffer, which wraps TTF_OpenFontRW
this (data, size, index) Loads a Font from a buffer with a face index, which wraps TTF_OpenFontIndexRW
this (file, size, hdpi, vdpi) Loads a Font from a font file with DPI, which wraps TTF_OpenFontDPI (from SDL_ttf 2.0.18)
this (file, size, index, hdpi, vdpi) Loads a Font from a font file with DPI and face index, which wraps TTF_OpenFontIndexDPI (from SDL_ttf 2.0.18)
this (data, size, hdpi, vdpi) Loads a Font from a buffer with DPI, which wraps TTF_OpenFontDPIRW (from SDL_ttf 2.0.18)
this (data, size, index, hdpi, vdpi) Loads a Font from a buffer with DPI and face index, which wraps TTF_OpenFontIndexDPIRW (from SDL_ttf 2.0.18)

Fields

NameTypeDescription
ttfFont sdl_ttf.TTF_Font*Internal TTF_Font pointer

Properties

NameTypeDescription
ascent[get] intWraps TTF_FontAscent to get the Font's ascent
bold[get] boolWraps TTF_GetFontStyle to get whether the Font style is bold
bold[set] boolWraps TTF_SetFontStyle to set the Font style to be bold
descent[get] intWraps TTF_FontDescent to get the Font's descent
direction[set] DirectionWraps TTF_SetFontDirection (from SDL_ttf 2.20) to set the Font's script direction
faces[get] ulongWraps TTF_FontFaces to get the Font's number of font faces
familyName[get] stringWraps TTF_FontFaceFamilyName to get the Font family name
fixedWidth[get] boolWraps TTF_FontFaceIsFixedWidth to check whether the Font's font face is fixed width
height[get] intWraps TTF_FontHeight to get the Font's height
hinting[get] HintingWraps TTF_GetFontHinting to get the Font hinting
hinting[set] HintingWraps TTF_SetFontHinting to set the Font hinting
italic[get] boolWraps TTF_GetFontStyle to get whether the Font style is italic
italic[set] boolWraps TTF_SetFontStyle to set the Font style to be italic
kerning[get] boolWraps TTF_GetFontKerning to get the Font's kerning
kerning[set] boolWraps TTF_SetFontKerning to set the Font's kerning
lineSkip[get] intWraps TTF_FontLineSkip to get the Font's line skip
outline[get] uintWraps TTF_GetFontOutline to get the Font outline value
outline[set] uintWraps TTF_SetFontOutline to set the Font outline value
scriptName[set] stringWraps TTF_SetFontScriptName (from SDL_ttf 2.20) to set the Font's script name
sdf[get] boolWraps TTF_GetFontSDF (from SDL_ttf 2.0.18) to get whether the Font has signed distance field
sdf[set] boolWraps TTF_SetFontSDF (from SDL_ttf 2.0.18) to set signed distance field
size[set] uintWraps TTF_SetFontSize (from SDL_ttf 2.0.18) to set the Font's size
sizeDPI[set] std.typecons.Tuple!(uint,uint,uint)Wraps TTF_SetFontSizeDPI (from SDL_ttf 2.0.18) to set the Font's size in DPI
strikethrough[get] boolWraps TTF_GetFontStyle to get whether the Font style is strikethrough
strikethrough[set] boolWraps TTF_SetFontStyle to set the Font style to be strikethrough
styleName[get] stringWraps TTF_FontFaceStyleName to get the Font style name
underline[get] boolWraps TTF_GetFontStyle to get whether the Font style is underlined
underline[set] boolWraps TTF_SetFontStyle to set the Font style to be underlined
wrappedAlign[get] WrappedAlignWraps TTF_GetFontWrappedAlign (from SDL_ttf 2.20) to get the Font's wrap alignment mode
wrappedAlign[set] WrappedAlignWraps TTF_SetFontWrappedAlign (from SDL_ttf 2.20) to set the Font's wrap alignment mode

Methods

NameDescription
glyphKerning (prevGlyph, glyph) Wraps TTF_GetFontKerningSize (from SDL_ttf 2.0.14) to get the kerning between two glyphs in the Font
glyphKerning (prevGlyph, glyph) Wraps TTF_GetFontKerningSize (from SDL_ttf 2.0.18) to get the kerning between two glyphs in the Font
glyphMetrics (glyph) Wraps TTF_GlyphMetrics to the metrics of a glyph in the Font
glyphMetrics (glyph) Wraps TTF_GlyphMetrics32 (from SDL_ttf 2.0.18) to the metrics of a glyph in the Font
measureText (text, measureWidth) Wraps TTF_MeasureUTF8 (from SDL_ttf 2.0.18) to calculate the maximum number of characters from a text that can be rendered given a maximum fitting width
measureText (text, measureWidth) Wraps TTF_MeasureUNICODE (from SDL_ttf 2.0.18) to calculate the maximum number of characters from a text that can be rendered given a maximum fitting width
opEquals (rhs) Equality operator overload
providesGlyph (glyph) Wraps TTF_GlyphIsProvided to check whether the Font provides a glyph
providesGlyph (glyph) Wraps TTF_GlyphIsProvided32 (from SDL_ttf 2.0.18) to check whether the Font provides a glyph
render (glyph, foreground, background, quality) Wraps TTF_RenderGlyph_Solid, TTF_RenderGlyph_Shaded, TTF_RenderGlyph_Blended, and additionally TTF_RenderGlyph_LCD (from SDL_ttf 2.20) to render a glyph in the Font
render (glyph, foreground, background, quality) Wraps TTF_RenderGlyph32_Solid, TTF_RenderGlyph32_Shaded, TTF_RenderGlyph32_Blended (from SDL_ttf 2.0.18), and additionally TTF_RenderGlyph32_LCD (from SDL_ttf 2.20) to render a glyph in the Font
render (text, foreground, background, quality, wrapLength) Wraps TTF_RenderUTF8_Solid, TTF_RenderUTF8_Shaded, TTF_RenderUTF8_Blended, and additionally TTF_RenderUTF8_LCD (from SDL_ttf 2.20), as well as TTF_RenderUTF8_Solid_Wrapped, TTF_RenderUTF8_Shaded_Wrapped, TTF_RenderUTF8_Blended_Wrapped (from SDL_ttf 2.0.18), and TTF_RenderUTF8_LCD_Wrapped (from SDL_ttf 2.20) to render a text string in the Font
render (text, foreground, background, quality, wrapLength) Wraps TTF_RenderUNICODE_Solid, TTF_RenderUNICODE_Shaded, TTF_RenderUNICODE_Blended, and additionally TTF_RenderUNICODE_LCD (from SDL_ttf 2.20), as well as TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, TTF_RenderUNICODE_Blended_Wrapped (from SDL_ttf 2.0.18), and TTF_RenderUNICODE_LCD_Wrapped (from SDL_ttf 2.20) to render a text string in the Font
textSize (text) Wraps TTF_SizeUTF8 to get the size of a rendered text in the Font
textSize (text) Wraps TTF_SizeUNICODE to get the size of a rendered text in the Font
toHash () Gets the hash of the Font
toString () Formats the Font into its construction representation: "dsdl2.ttf.Font(<ttfFont>)"