/* Freetype GL - A C OpenGL Freetype engine
*
* Distributed under the OSI-approved BSD 2-Clause License. See accompanying
* file `LICENSE` for more details.
*/
extern "C" __cplusplus
namespace ftgl
/**
* @file texture-font.h
* @author Nicolas Rougier (Nicolas.Rougier@inria.fr)
*
* @defgroup texture-font Texture font
*
* Texture font.
*
* Example Usage:
* @code
* #include "texture-font.h"
*
* int main( int arrgc, char *argv[] )
* {
* return 0;
* }
* @endcode
*
* @{
*/
/**
* A list of possible ways to render a glyph.
*/
typedef enum rendermode_t
rendermode_t;
/**
* A structure that hold a kerning value relatively to a Unicode
* codepoint.
*
* This structure cannot be used alone since the (necessary) right
* Unicode codepoint is implicitely held by the owner of this structure.
*/
typedef struct kerning_t
kerning_t;
/*
* Glyph metrics:
* --------------
*
* xmin xmax
* | |
* |<-------- width -------->|
* | |
* | +-------------------------+----------------- ymax
* | | ggggggggg ggggg | ^ ^
* | | g:::::::::ggg::::g | | |
* | | g:::::::::::::::::g | | |
* | | g::::::ggggg::::::gg | | |
* | | g:::::g g:::::g | | |
* offset_x -|-------->| g:::::g g:::::g | offset_y |
* | | g:::::g g:::::g | | |
* | | g::::::g g:::::g | | |
* | | g:::::::ggggg:::::g | | |
* | | g::::::::::::::::g | | height
* | | gg::::::::::::::g | | |
* baseline ---*---------|---- gggggggg::::::g-----*-------- |
* / | | g:::::g | |
* origin | | gggggg g:::::g | |
* | | g:::::gg gg:::::g | |
* | | g::::::ggg:::::::g | |
* | | gg:::::::::::::g | |
* | | ggg::::::ggg | |
* | | gggggg | v
* | +-------------------------+----------------- ymin
* | |
* |------------- advance_x ---------->|
*/
/**
* A structure that describe a glyph.
*/
typedef struct texture_glyph_t
texture_glyph_t;
/**
* Texture font structure.
*/
typedef struct texture_font_t
texture_font_t;
/**
* This function creates a new texture font from given filename and size. The
* texture atlas is used to store glyph on demand. Note the depth of the atlas
* will determine if the font is rendered as alpha channel only (depth = 1) or
* RGB (depth = 3) that correspond to subpixel rendering (if available on your
* freetype implementation).
*
* @param atlas A texture atlas
* @param pt_size Size of font to be created (in points)
* @param filename A font filename
*
* @return A new empty font (no glyph inside yet)
*
*/
texture_font_t *
;
/**
* This function creates a new texture font from a memory location and size.
* The texture atlas is used to store glyph on demand. Note the depth of the
* atlas will determine if the font is rendered as alpha channel only
* (depth = 1) or RGB (depth = 3) that correspond to subpixel rendering (if
* available on your freetype implementation).
*
* @param atlas A texture atlas
* @param pt_size Size of font to be created (in points)
* @param memory_base Start of the font file in memory
* @param memory_size Size of the font file memory region, in bytes
*
* @return A new empty font (no glyph inside yet)
*
*/
texture_font_t *
;
/**
* Delete a texture font. Note that this does not delete the glyph from the
* texture atlas.
*
* @param self a valid texture font
*/
void
;
/**
* Request a new glyph from the font. If it has not been created yet, it will
* be.
*
* @param self A valid texture font
* @param codepoint Character codepoint to be loaded in UTF-8 encoding.
*
* @return A pointer on the new glyph or 0 if the texture atlas is not big
* enough
*
*/
texture_glyph_t *
;
/**
* Request a new glyph from the font. If it has not been created yet, it will
* be.
*
* @param self A valid texture font
* @param codepoint Character codepoint to be loaded in UTF-8 encoding.
*
* @return A pointer on the new glyph or 0 if the texture atlas is not big
* enough
*
*/
texture_glyph_t *
;
/**
* Request an already loaded glyph from the font.
*
* @param self A valid texture font
* @param codepoint Character codepoint to be found in UTF-8 encoding.
*
* @return A pointer on the glyph or 0 if the glyph is not loaded
*/
texture_glyph_t *
;
/**
* Request the loading of a given glyph.
*
* @param self A valid texture font
* @param codepoints Character codepoint to be loaded in UTF-8 encoding.
*
* @return One if the glyph could be loaded, zero if not.
*/
int
;
/**
* Request the loading of several glyphs at once.
*
* @param self A valid texture font
* @param codepoints Character codepoints to be loaded in UTF-8 encoding. May
* contain duplicates.
*
* @return Number of missed glyph if the texture is not big enough to hold
* every glyphs.
*/
size_t
;
/*
*Increases the size of a fonts texture atlas
*Invalidates all pointers to font->atlas->data
*Changes the UV Coordinates of existing glyphs in the font
*
*@param self A valid texture font
*@param width_new Width of the texture atlas after resizing (must be bigger or equal to current width)
*@param height_new Height of the texture atlas after resizing (must be bigger or equal to current height)
*/
void
;
/**
* Get the kerning between two horizontal glyphs.
*
* @param self A valid texture glyph
* @param codepoint Character codepoint of the peceding character in UTF-8 encoding.
*
* @return x kerning value
*/
float
;
/**
* Creates a new empty glyph
*
* @return a new empty glyph (not valid)
*/
texture_glyph_t *
;
/** @} */
}
}
/* __TEXTURE_FONT_H__ */