Font

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

@safe final
static if(bindSDLTTF)
class Font {}

Constructors

this
this(TTF_Font* ttfFont, bool isOwner, void* userRef)

Constructs a dsdl2.ttf.Font from a vanilla TTF_Font* from bindbc-sdl

this
this(string file, uint size)

Loads a dsdl2.ttf.Font from a font file, which wraps TTF_OpenFont

this
this(string file, uint size, size_t index)

Loads a dsdl2.ttf.Font from a font file with a face index, which wraps TTF_OpenFontIndex

this
this(void[] data, uint size)

Loads a dsdl2.ttf.Font from a buffer, which wraps TTF_OpenFontRW

this
this(void[] data, uint size, size_t index)

Loads a dsdl2.ttf.Font from a buffer with a face index, which wraps TTF_OpenFontIndexRW

this
this(string file, uint size, uint hdpi, uint vdpi)

Loads a dsdl2.ttf.Font from a font file with DPI, which wraps TTF_OpenFontDPI (from SDL_ttf 2.0.18)

this
this(string file, uint size, size_t index, uint hdpi, uint vdpi)

Loads a dsdl2.ttf.Font from a font file with DPI and face index, which wraps TTF_OpenFontIndexDPI (from SDL_ttf 2.0.18)

this
this(void[] data, uint size, uint hdpi, uint vdpi)

Loads a dsdl2.ttf.Font from a buffer with DPI, which wraps TTF_OpenFontDPIRW (from SDL_ttf 2.0.18)

this
this(void[] data, uint size, size_t index, uint hdpi, uint vdpi)

Loads a dsdl2.ttf.Font from a buffer with DPI and face index, which wraps TTF_OpenFontIndexDPIRW (from SDL_ttf 2.0.18)

Destructor

~this
~this()
Undocumented in source.

Members

Functions

ascent
int ascent()

Wraps TTF_FontAscent to get the dsdl2.ttf.Font's ascent

bold
bool bold()

Wraps TTF_GetFontStyle to get whether the dsdl2.ttf.Font style is bold

bold
void bold(bool newBold)

Wraps TTF_SetFontStyle to set the dsdl2.ttf.Font style to be bold

descent
int descent()

Wraps TTF_FontDescent to get the dsdl2.ttf.Font's descent

direction
void direction(Direction newDirection)

Wraps TTF_SetFontDirection (from SDL_ttf 2.20) to set the dsdl2.ttf.Font's script direction

faces
size_t faces()

Wraps TTF_FontFaces to get the dsdl2.ttf.Font's number of font faces

familyName
string familyName()

Wraps TTF_FontFaceFamilyName to get the dsdl2.ttf.Font family name

fixedWidth
bool fixedWidth()

Wraps TTF_FontFaceIsFixedWidth to check whether the dsdl2.ttf.Font's font face is fixed width

glyphKerning
int glyphKerning(wchar prevGlyph, wchar glyph)

Wraps TTF_GetFontKerningSize (from SDL_ttf 2.0.14) to get the kerning between two glyphs in the dsdl2.ttf.Font

glyphKerning
int glyphKerning(dchar prevGlyph, dchar glyph)

Wraps TTF_GetFontKerningSize (from SDL_ttf 2.0.18) to get the kerning between two glyphs in the dsdl2.ttf.Font

glyphMetrics
GlyphMetrics glyphMetrics(wchar glyph)

Wraps TTF_GlyphMetrics to the metrics of a glyph in the dsdl2.ttf.Font

glyphMetrics
GlyphMetrics glyphMetrics(dchar glyph)

Wraps TTF_GlyphMetrics32 (from SDL_ttf 2.0.18) to the metrics of a glyph in the dsdl2.ttf.Font

height
int height()

Wraps TTF_FontHeight to get the dsdl2.ttf.Font's height

hinting
Hinting hinting()

Wraps TTF_GetFontHinting to get the dsdl2.ttf.Font hinting

hinting
void hinting(Hinting newHinting)

Wraps TTF_SetFontHinting to set the dsdl2.ttf.Font hinting

italic
bool italic()

Wraps TTF_GetFontStyle to get whether the dsdl2.ttf.Font style is italic

italic
void italic(bool newItalic)

Wraps TTF_SetFontStyle to set the dsdl2.ttf.Font style to be italic

kerning
bool kerning()

Wraps TTF_GetFontKerning to get the dsdl2.ttf.Font's kerning

kerning
void kerning(bool newKerning)

Wraps TTF_SetFontKerning to set the dsdl2.ttf.Font's kerning

lineSkip
int lineSkip()

Wraps TTF_FontLineSkip to get the dsdl2.ttf.Font's line skip

measureText
TextMeasurement measureText(string text, uint 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
TextMeasurement measureText(wstring text, uint 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
bool opEquals(Font rhs)

Equality operator overload

outline
uint outline()

Wraps TTF_GetFontOutline to get the dsdl2.ttf.Font outline value

outline
void outline(uint newOutline)

Wraps TTF_SetFontOutline to set the dsdl2.ttf.Font outline value

providesGlyph
bool providesGlyph(wchar glyph)

Wraps TTF_GlyphIsProvided to check whether the dsdl2.ttf.Font provides a glyph

providesGlyph
bool providesGlyph(dchar glyph)

Wraps TTF_GlyphIsProvided32 (from SDL_ttf 2.0.18) to check whether the dsdl2.ttf.Font provides a glyph

render
Surface render(wchar glyph, Color foreground, Color background, RenderQuality 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 dsdl2.ttf.Font

render
Surface render(dchar glyph, Color foreground, Color background, RenderQuality 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 dsdl2.ttf.Font

render
Surface render(string text, Color foreground, Color background, RenderQuality quality, uint 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 dsdl2.ttf.Font

render
Surface render(wstring text, Color foreground, Color background, RenderQuality quality, uint 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 dsdl2.ttf.Font

scriptName
void scriptName(string newScriptName)

Wraps TTF_SetFontScriptName (from SDL_ttf 2.20) to set the dsdl2.ttf.Font's script name

sdf
bool sdf()

Wraps TTF_GetFontSDF (from SDL_ttf 2.0.18) to get whether the dsdl2.ttf.Font has signed distance field

sdf
void sdf(bool newSDF)

Wraps TTF_SetFontSDF (from SDL_ttf 2.0.18) to set signed distance field

size
void size(uint newSize)

Wraps TTF_SetFontSize (from SDL_ttf 2.0.18) to set the dsdl2.ttf.Font's size

sizeDPI
void sizeDPI(Tuple!(uint, uint, uint) newSizeDPI)

Wraps TTF_SetFontSizeDPI (from SDL_ttf 2.0.18) to set the dsdl2.ttf.Font's size in DPI

strikethrough
bool strikethrough()

Wraps TTF_GetFontStyle to get whether the dsdl2.ttf.Font style is strikethrough

strikethrough
void strikethrough(bool newStrikethrough)

Wraps TTF_SetFontStyle to set the dsdl2.ttf.Font style to be strikethrough

styleName
string styleName()

Wraps TTF_FontFaceStyleName to get the dsdl2.ttf.Font style name

textSize
uint[2] textSize(string text)

Wraps TTF_SizeUTF8 to get the size of a rendered text in the dsdl2.ttf.Font

textSize
uint[2] textSize(wstring text)

Wraps TTF_SizeUNICODE to get the size of a rendered text in the dsdl2.ttf.Font

toHash
hash_t toHash()

Gets the hash of the dsdl2.ttf.Font

toString
string toString()

Formats the dsdl2.ttf.Font into its construction representation: "dsdl2.ttf.Font(<ttfFont>)"

underline
bool underline()

Wraps TTF_GetFontStyle to get whether the dsdl2.ttf.Font style is underlined

underline
void underline(bool newUnderline)

Wraps TTF_SetFontStyle to set the dsdl2.ttf.Font style to be underlined

wrappedAlign
WrappedAlign wrappedAlign()

Wraps TTF_GetFontWrappedAlign (from SDL_ttf 2.20) to get the dsdl2.ttf.Font's wrap alignment mode

wrappedAlign
void wrappedAlign(WrappedAlign newWrappedAlign)

Wraps TTF_SetFontWrappedAlign (from SDL_ttf 2.20) to set the dsdl2.ttf.Font's wrap alignment mode

Variables

ttfFont
TTF_Font* ttfFont;

Internal TTF_Font pointer

Meta