All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzu_freetype_font.h File Reference

FreeType font. More...

Namespaces

 kanzi
 

Functions

kzsError kzuFreetypeSystemCreate (const struct KzcMemoryManager *memoryManager, kanzi::Domain *domain, struct KzuFreetypeSystem **out_freetypeSystem)
 Creates an FreeType font system. More...
 
kzsError kzuFreetypeSystemDelete (struct KzuFreetypeSystem *freetypeSystem)
 Deletes an FreeType font system. More...
 
struct KzuFreetypeSystemkzuFreetypeSystemFromTruetypeSystem (struct KzuTruetypeSystem *truetypeSystem)
 Type casts a generic TrueType font system to more specific FreeType font system. More...
 
struct KzuTruetypeSystemkzuFreetypeSystemToTruetypeSystem (struct KzuFreetypeSystem *freetypeSystem)
 Type casts a FreeType font system to more generic TrueType font system. More...
 
kzsError kzuFreetypeFontCreate (const struct KzcMemoryManager *memoryManager, struct KzuFreetypeSystem *freetypeSystem, struct KzuFreetypeFont **out_freetypeFont)
 Creates new FreeType font. More...
 
kzsError kzuFreetypeFontCreateFromResource (const struct KzcMemoryManager *memoryManager, struct KzuFreetypeSystem *freetypeSystem, kzString resourcePath, struct KzuFreetypeFont **out_freetypeFont)
 Creates new FreeType font from resource. More...
 
kzsError kzuFreetypeFontCreateFromFile (const struct KzcMemoryManager *memoryManager, struct KzuFreetypeSystem *freetypeSystem, kzString filePath, struct KzuFreetypeFont **out_freetypeFont)
 Creates new FreeType font from file. More...
 
kzsError kzuFreetypeFontCreateFromMemory (const struct KzcMemoryManager *memoryManager, struct KzuFreetypeSystem *freetypeSystem, const kzByte *data, kzUint size, struct KzuFreetypeFont **out_freetypeFont)
 Creates new FreeType font from memory. More...
 
kzsError kzuFreetypeFontLoadFromKZB (struct KzuFreetypeFont *freetypeFont, struct KzcInputStream *inputStream, const struct KzuBinaryFileInfo *file)
 Loads FreeType font from KZB. More...
 
struct KzuFreetypeFontkzuFreetypeFontFromFont (struct KzuFont *font)
 Type casts generic font structure to FreeType font structure. More...
 
struct KzuFontkzuFreetypeFontToFont (struct KzuFreetypeFont *freetypeFont)
 Type casts FreeType font structure to generic font structure. More...
 
kzsError kzuFreetypeFontSetSize (struct KzuFreetypeFont *freetypeFont, kzFloat size)
 Sets the size of FreeType font (in pixels). More...
 
kzFloat kzuFreetypeFontGetSize (const struct KzuFreetypeFont *freetypeFont)
 Returns the size of FreeType font. More...
 
void kzuFreetypeFontSetColor (struct KzuFreetypeFont *freetypeFont, struct KzcColorRGBA color)
 Sets the color of the font. More...
 
struct KzcColorRGBA kzuFreetypeFontGetColor (const struct KzuFreetypeFont *freetypeFont)
 Gets the color of the font. More...
 
kzFloat kzuFreetypeFontGetLineHeight (const struct KzuFreetypeFont *freetypeFont)
 Returns the line height of FreeType font. More...
 
kzFloat kzuFreetypeFontGetAscender (const struct KzuFreetypeFont *freetypeFont)
 Returns the ascender of FreeType font. More...
 
kzUint kzuFreetypeFontGetGlyphIndex (const struct KzuFreetypeFont *freetypeFont, kzUnicodeChar character)
 Returns the glyph index in the font for the given unicode code point. More...
 
kzsError kzuFreetypeFontGetCharacterMetrics (const struct KzuFreetypeFont *freetypeFont, kzUint glyphIndex, kzFloat *out_advanceX, kzFloat *out_advanceY, struct KzcRectangle *out_boundingBox)
 Returns the advance of given character using FreeType font. More...
 
kzsError kzuFreetypeFontGetKerning (const struct KzuFreetypeFont *freetypeFont, kzUint previousGlyphIndex, kzUint glyphIndex, kzFloat *out_kerningX, kzFloat *out_kerningY)
 Returns the kerning of given character pair using FreeType font. More...
 
kzsError kzuFreetypeFontPrepareTextLayout (struct KzuTextLayout *textLayout, kanzi::Renderer *renderer)
 Prepares the given pre-layouted text for fast rendering using FreeType. More...
 
kzsError kzuFreetypeFontDrawTextLayout (struct KzuTextLayout *textLayout, kanzi::Renderer *renderer, kzFloat x, kzFloat y)
 Draw the given pre-layouted text using FreeType. More...
 
kzsError kzuFreetypeFontDrawTextLayout3D (struct KzuTextLayout *textLayout, kanzi::Renderer *renderer)
 Draw the given pre-layouted text in 3D space using FreeType. More...
 
kzsError kzuFreetypeFontFreeTextLayoutData (struct KzuTextLayout *textLayout)
 Frees the data and resources created by the prepare function. More...
 
kzsError kzuFreetypeFontLoadCharacterGlyph (const struct KzuFreetypeFont *freetypeFont, kzUint glyphIndex, kzUint *out_width, kzUint *out_height, const kzByte **out_data)
 Loads a bitmap data for a single character glyph. More...
 
void * kzuFreetypeFontGetFace (const struct KzuFreetypeFont *freetypeFont)
 Returns the FT_Face object from FreeType font. More...
 

Variables

const KzuFontType KZU_FONT_TYPE_FREETYPE
 Font type identifier for font FreeType fonts. More...
 

Detailed Description

FreeType font.

Copyright 2008-2020 by Rightware. All rights reserved.

Function Documentation

kzsError kzuFreetypeSystemCreate ( const struct KzcMemoryManager memoryManager,
kanzi::Domain domain,
struct KzuFreetypeSystem **  out_freetypeSystem 
)

Creates an FreeType font system.

kzsError kzuFreetypeSystemDelete ( struct KzuFreetypeSystem freetypeSystem)

Deletes an FreeType font system.

struct KzuFreetypeSystem* kzuFreetypeSystemFromTruetypeSystem ( struct KzuTruetypeSystem truetypeSystem)

Type casts a generic TrueType font system to more specific FreeType font system.

struct KzuTruetypeSystem* kzuFreetypeSystemToTruetypeSystem ( struct KzuFreetypeSystem freetypeSystem)

Type casts a FreeType font system to more generic TrueType font system.

kzsError kzuFreetypeFontCreate ( const struct KzcMemoryManager memoryManager,
struct KzuFreetypeSystem freetypeSystem,
struct KzuFreetypeFont **  out_freetypeFont 
)

Creates new FreeType font.

kzsError kzuFreetypeFontCreateFromResource ( const struct KzcMemoryManager memoryManager,
struct KzuFreetypeSystem freetypeSystem,
kzString  resourcePath,
struct KzuFreetypeFont **  out_freetypeFont 
)

Creates new FreeType font from resource.

kzsError kzuFreetypeFontCreateFromFile ( const struct KzcMemoryManager memoryManager,
struct KzuFreetypeSystem freetypeSystem,
kzString  filePath,
struct KzuFreetypeFont **  out_freetypeFont 
)

Creates new FreeType font from file.

kzsError kzuFreetypeFontCreateFromMemory ( const struct KzcMemoryManager memoryManager,
struct KzuFreetypeSystem freetypeSystem,
const kzByte data,
kzUint  size,
struct KzuFreetypeFont **  out_freetypeFont 
)

Creates new FreeType font from memory.

kzsError kzuFreetypeFontLoadFromKZB ( struct KzuFreetypeFont freetypeFont,
struct KzcInputStream inputStream,
const struct KzuBinaryFileInfo file 
)

Loads FreeType font from KZB.

struct KzuFreetypeFont* kzuFreetypeFontFromFont ( struct KzuFont font)

Type casts generic font structure to FreeType font structure.

struct KzuFont* kzuFreetypeFontToFont ( struct KzuFreetypeFont freetypeFont)

Type casts FreeType font structure to generic font structure.

kzsError kzuFreetypeFontSetSize ( struct KzuFreetypeFont freetypeFont,
kzFloat  size 
)

Sets the size of FreeType font (in pixels).

kzFloat kzuFreetypeFontGetSize ( const struct KzuFreetypeFont freetypeFont)

Returns the size of FreeType font.

void kzuFreetypeFontSetColor ( struct KzuFreetypeFont freetypeFont,
struct KzcColorRGBA  color 
)

Sets the color of the font.

struct KzcColorRGBA kzuFreetypeFontGetColor ( const struct KzuFreetypeFont freetypeFont)

Gets the color of the font.

kzFloat kzuFreetypeFontGetLineHeight ( const struct KzuFreetypeFont freetypeFont)

Returns the line height of FreeType font.

kzFloat kzuFreetypeFontGetAscender ( const struct KzuFreetypeFont freetypeFont)

Returns the ascender of FreeType font.

kzUint kzuFreetypeFontGetGlyphIndex ( const struct KzuFreetypeFont freetypeFont,
kzUnicodeChar  character 
)

Returns the glyph index in the font for the given unicode code point.

kzsError kzuFreetypeFontGetCharacterMetrics ( const struct KzuFreetypeFont freetypeFont,
kzUint  glyphIndex,
kzFloat out_advanceX,
kzFloat out_advanceY,
struct KzcRectangle out_boundingBox 
)

Returns the advance of given character using FreeType font.

kzsError kzuFreetypeFontGetKerning ( const struct KzuFreetypeFont freetypeFont,
kzUint  previousGlyphIndex,
kzUint  glyphIndex,
kzFloat out_kerningX,
kzFloat out_kerningY 
)

Returns the kerning of given character pair using FreeType font.

kzsError kzuFreetypeFontPrepareTextLayout ( struct KzuTextLayout textLayout,
kanzi::Renderer renderer 
)

Prepares the given pre-layouted text for fast rendering using FreeType.

kzsError kzuFreetypeFontDrawTextLayout ( struct KzuTextLayout textLayout,
kanzi::Renderer renderer,
kzFloat  x,
kzFloat  y 
)

Draw the given pre-layouted text using FreeType.

kzsError kzuFreetypeFontDrawTextLayout3D ( struct KzuTextLayout textLayout,
kanzi::Renderer renderer 
)

Draw the given pre-layouted text in 3D space using FreeType.

kzsError kzuFreetypeFontFreeTextLayoutData ( struct KzuTextLayout textLayout)

Frees the data and resources created by the prepare function.

kzsError kzuFreetypeFontLoadCharacterGlyph ( const struct KzuFreetypeFont freetypeFont,
kzUint  glyphIndex,
kzUint out_width,
kzUint out_height,
const kzByte **  out_data 
)

Loads a bitmap data for a single character glyph.

The data doesn't need to be released, but it is valid only until prepare text layout, draw text layout or this function gets called again. The data is returned as a greyscale image with 8 bits per pixel, with the first scanline being the bottom line of the image.

void* kzuFreetypeFontGetFace ( const struct KzuFreetypeFont freetypeFont)

Returns the FT_Face object from FreeType font.

Variable Documentation

const KzuFontType KZU_FONT_TYPE_FREETYPE

Font type identifier for font FreeType fonts.