proc linked_Version(): ptr Version {...}{.importc: "TTF_Linked_Version", cdecl.}
-
Make sure this is defined (only available in newer SDL versions)
This function gets the version of the dynamically linked SDL_ttf library.
it should NOT be used to fill a version structure, instead you should
use the SDL_TTF_VERSION() macro.
proc byteSwappedUNICODE(swapped: cint) {...}{.importc: "TTF_ByteSwappedUNICODE", cdecl.}
-
This function tells the library whether UNICODE text is generally
byteswapped. A UNICODE BOM character in a string will override
this setting for the remainder of that string.
proc init(): cint {...}{.importc: "TTF_Init", cdecl.}
-
Initialize the TTF engine - returns 0 if successful, -1 on error
proc openFont(file: cstring; ptsize: cint): ptr Font {...}{.importc: "TTF_OpenFont", cdecl.}
-
Open a font file and create a font of the specified point size.
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.
proc openFontIndex(file: cstring; ptsize: cint; index: clong): ptr Font {...}{.
importc: "TTF_OpenFontIndex", cdecl.}
-
proc openFontRW(src: ptr RWops; freesrc: cint; ptsize: cint): ptr Font {...}{.
importc: "TTF_OpenFontRW", cdecl.}
-
proc openFontIndexRW(src: ptr RWops; freesrc: cint; ptsize: cint; index: clong): ptr Font {...}{.
importc: "TTF_OpenFontIndexRW", cdecl.}
-
proc getFontStyle(font: ptr Font): cint {...}{.importc: "TTF_GetFontStyle", cdecl.}
-
proc setFontStyle(font: ptr Font; style: cint) {...}{.importc: "TTF_SetFontStyle", cdecl.}
-
proc getFontOutline(font: ptr Font): cint {...}{.importc: "TTF_GetFontOutline", cdecl.}
-
proc setFontOutline(font: ptr Font; outline: cint) {...}{.importc: "TTF_SetFontOutline",
cdecl.}
-
proc getFontHinting(font: ptr Font): cint {...}{.importc: "TTF_GetFontHinting", cdecl.}
-
proc setFontHinting(font: ptr Font; hinting: cint) {...}{.importc: "TTF_SetFontHinting",
cdecl.}
-
proc fontHeight(font: ptr Font): cint {...}{.importc: "TTF_FontHeight", cdecl.}
-
Get the total height of the font - usually equal to point size
proc fontAscent(font: ptr Font): cint {...}{.importc: "TTF_FontAscent", cdecl.}
-
Get the offset from the baseline to the top of the font
This is a positive value, relative to the baseline.
proc fontDescent(font: ptr Font): cint {...}{.importc: "TTF_FontDescent", cdecl.}
-
Get the offset from the baseline to the bottom of the font
This is a negative value, relative to the baseline.
proc fontLineSkip(font: ptr Font): cint {...}{.importc: "TTF_FontLineSkip", cdecl.}
-
Get the recommended spacing between lines of text for this font
proc getFontKerning(font: ptr Font): cint {...}{.importc: "TTF_GetFontKerning", cdecl.}
-
Get/Set whether or not kerning is allowed for this font
proc setFontKerning(font: ptr Font; allowed: cint) {...}{.importc: "TTF_SetFontKerning",
cdecl.}
-
proc fontFaces(font: ptr Font): clong {...}{.importc: "TTF_FontFaces", cdecl.}
-
Get the number of faces of the font
proc fontFaceIsFixedWidth(font: ptr Font): cint {...}{.
importc: "TTF_FontFaceIsFixedWidth", cdecl.}
-
Get the font face attributes, if any
proc fontFaceFamilyName(font: ptr Font): cstring {...}{.importc: "TTF_FontFaceFamilyName",
cdecl.}
-
proc fontFaceStyleName(font: ptr Font): cstring {...}{.importc: "TTF_FontFaceStyleName",
cdecl.}
-
proc glyphIsProvided(font: ptr Font; ch: Uint16): cint {...}{.
importc: "TTF_GlyphIsProvided", cdecl.}
-
Check wether a glyph is provided by the font or not
proc glyphMetrics(font: ptr Font; ch: Uint16; minx: ptr cint; maxx: ptr cint;
miny: ptr cint; maxy: ptr cint; advance: ptr cint): cint {...}{.
importc: "TTF_GlyphMetrics", cdecl.}
-
Get the metrics (dimensions) of a glyph
To understand what these metrics mean, here is a useful link:
http:freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
proc sizeText(font: ptr Font; text: cstring; w: ptr cint; h: ptr cint): cint {...}{.
importc: "TTF_SizeText", cdecl.}
-
Get the dimensions of a rendered string of text
proc sizeUTF8(font: ptr Font; text: cstring; w: ptr cint; h: ptr cint): cint {...}{.
importc: "TTF_SizeUTF8", cdecl.}
-
proc sizeUNICODE(font: ptr Font; text: ptr Uint16; w: ptr cint; h: ptr cint): cint {...}{.
importc: "TTF_SizeUNICODE", cdecl.}
-
proc renderText_Solid(font: ptr Font; text: cstring; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderText_Solid", cdecl.}
-
Create an 8-bit palettized surface and render the given text at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is set
to the text color.
This function returns the new surface, or NULL if there was an error.
proc renderUTF8_Solid(font: ptr Font; text: cstring; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderUTF8_Solid", cdecl.}
-
proc renderUNICODE_Solid(font: ptr Font; text: ptr Uint16; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderUNICODE_Solid", cdecl.}
-
proc renderGlyph_Solid(font: ptr Font; ch: Uint16; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderGlyph_Solid", cdecl.}
-
Create an 8-bit palettized surface and render the given glyph at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is 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.
This function returns the new surface, or NULL if there was an error.
proc renderText_Shaded(font: ptr Font; text: cstring; fg: Color; bg: Color): ptr Surface {...}{.
importc: "TTF_RenderText_Shaded", cdecl.}
-
Create an 8-bit palettized surface and render the given text at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
This function returns the new surface, or NULL if there was an error.
proc renderUTF8_Shaded(font: ptr Font; text: cstring; fg: Color; bg: Color): ptr Surface {...}{.
importc: "TTF_RenderUTF8_Shaded", cdecl.}
-
proc renderUNICODE_Shaded(font: ptr Font; text: ptr Uint16; fg: Color; bg: Color): ptr Surface {...}{.
importc: "TTF_RenderUNICODE_Shaded", cdecl.}
-
proc renderGlyph_Shaded(font: ptr Font; ch: Uint16; fg: Color; bg: Color): ptr Surface {...}{.
importc: "TTF_RenderGlyph_Shaded", cdecl.}
-
Create an 8-bit palettized surface and render the given glyph at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
proc renderText_Blended(font: ptr Font; text: cstring; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderText_Blended", cdecl.}
-
Create a 32-bit ARGB surface and render the given text at high quality,
using alpha blending to dither the font with the given color.
This function returns the new surface, or NULL if there was an error.
proc renderUTF8_Blended(font: ptr Font; text: cstring; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderUTF8_Blended", cdecl.}
-
proc renderUNICODE_Blended(font: ptr Font; text: ptr Uint16; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderUNICODE_Blended", cdecl.}
-
proc renderText_Blended_Wrapped(font: ptr Font; text: cstring; fg: Color;
wrapLength: Uint32): ptr Surface {...}{.
importc: "TTF_RenderText_Blended_Wrapped", cdecl.}
-
Create a 32-bit ARGB surface and render the given text at high quality,
using alpha blending to dither the font with the given color.
Text is wrapped to multiple lines on line endings and on word boundaries
if it extends beyond wrapLength in pixels.
This function returns the new surface, or NULL if there was an error.
proc renderUTF8_Blended_Wrapped(font: ptr Font; text: cstring; fg: Color;
wrapLength: Uint32): ptr Surface {...}{.
importc: "TTF_RenderUTF8_Blended_Wrapped", cdecl.}
-
proc renderUNICODE_Blended_Wrapped(font: ptr Font; text: ptr Uint16; fg: Color;
wrapLength: Uint32): ptr Surface {...}{.
importc: "TTF_RenderUNICODE_Blended_Wrapped", cdecl.}
-
proc renderGlyph_Blended(font: ptr Font; ch: Uint16; fg: Color): ptr Surface {...}{.
importc: "TTF_RenderGlyph_Blended", cdecl.}
-
Create a 32-bit ARGB surface and render the given glyph at high quality,
using alpha blending to dither the font with the given color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
proc closeFont(font: ptr Font) {...}{.importc: "TTF_CloseFont", cdecl.}
-
Close an opened font file
proc quit() {...}{.importc: "TTF_Quit", cdecl.}
-
De-initialize the TTF engine
proc wasInit(): cint {...}{.importc: "TTF_WasInit", cdecl.}
-
Check if the TTF engine is initialized
proc getFontKerningSize(font: ptr Font; prevIndex: cint; index: cint): cint {...}{.
importc: "TTF_GetFontKerningSize", cdecl.}
-
Get the kerning size of two glyphs indices
DEPRECATED: this function requires FreeType font indexes, not glyphs,
by accident, which we don't expose through this API, so it could give
wildly incorrect results, especially with non-ASCII values.
Going forward, please use TTF_GetFontKerningSizeGlyphs() instead, which
does what you probably expected this function to do.
proc getFontKerningSizeGlyphs(font: ptr Font; previousCh: Uint16; ch: Uint16): cint {...}{.
importc: "TTF_GetFontKerningSizeGlyphs", cdecl.}
-
Get the kerning size of two glyphs