citro2d
Functions
Font functions

Functions

C2D_Font C2D_FontLoad (const char *filename)
 Load a font from a file. More...
 
C2D_Font C2D_FontLoadFromMem (const void *data, size_t size)
 Load a font from memory. More...
 
C2D_Font C2D_FontLoadFromFD (int fd)
 Load a font from file descriptor. More...
 
C2D_Font C2D_FontLoadFromHandle (FILE *f)
 Load font from stdio file handle. More...
 
C2D_Font C2D_FontLoadSystem (CFG_Region region)
 Load corresponding font from system archive. More...
 
void C2D_FontFree (C2D_Font font)
 Free a font. More...
 
void C2D_FontSetFilter (C2D_Font font, GPU_TEXTURE_FILTER_PARAM magFilter, GPU_TEXTURE_FILTER_PARAM minFilter)
 Set a font's texture filter. More...
 
int C2D_FontGlyphIndexFromCodePoint (C2D_Font font, u32 codepoint)
 Find the glyph index of a codepoint, or returns the default. More...
 
charWidthInfo_s * C2D_FontGetCharWidthInfo (C2D_Font font, int glyphIndex)
 Get character width info for a given index. More...
 
void C2D_FontCalcGlyphPos (C2D_Font font, fontGlyphPos_s *out, int glyphIndex, u32 flags, float scaleX, float scaleY)
 Calculate glyph position of given index. More...
 
FINF_s * C2D_FontGetInfo (C2D_Font font)
 Get the font info structure associated with the font. More...
 

Detailed Description

Function Documentation

void C2D_FontCalcGlyphPos ( C2D_Font  font,
fontGlyphPos_s *  out,
int  glyphIndex,
u32  flags,
float  scaleX,
float  scaleY 
)

Calculate glyph position of given index.

Parameters
[in]fontFont to read from, or NULL for system font
[out]outGlyph position
[in]glyphIndexIndex to get position of
[in]flagsMisc flags
[in]scaleXSize to scale in X
[in]scaleYSize to scale in Y
void C2D_FontFree ( C2D_Font  font)

Free a font.

Parameters
[in]fontFont handle
charWidthInfo_s* C2D_FontGetCharWidthInfo ( C2D_Font  font,
int  glyphIndex 
)

Get character width info for a given index.

Parameters
[in]fontFont to read from, or NULL for system font
[in]glyphIndexIndex to get the width of
Returns
Width info for glyph
FINF_s* C2D_FontGetInfo ( C2D_Font  font)

Get the font info structure associated with the font.

Parameters
[in]fontFont to read from, or NULL for the system font
Returns
FINF associated with the font
int C2D_FontGlyphIndexFromCodePoint ( C2D_Font  font,
u32  codepoint 
)

Find the glyph index of a codepoint, or returns the default.

Parameters
[in]fontFont to search, or NULL for system font
[in]codepointCodepoint to search for
Returns
Glyph index
Return values
font->cfnt->finf.alterCharIndexThe codepoint does not exist in the font
C2D_Font C2D_FontLoad ( const char *  filename)

Load a font from a file.

Parameters
[in]filenameName of the font file (.bcfnt)
Returns
Font handle
Return values
NULLError
C2D_Font C2D_FontLoadFromFD ( int  fd)

Load a font from file descriptor.

Parameters
[in]fdFile descriptor used to load data
Returns
Font handle
Return values
NULLError
C2D_Font C2D_FontLoadFromHandle ( FILE *  f)

Load font from stdio file handle.

Parameters
[in]fFile handle used to load data
Returns
Font handle
Return values
NULLError
C2D_Font C2D_FontLoadFromMem ( const void *  data,
size_t  size 
)

Load a font from memory.

Parameters
[in]dataData to load
[in]sizeSize of the data to load
Returns
Font handle
Return values
NULLError
C2D_Font C2D_FontLoadSystem ( CFG_Region  region)

Load corresponding font from system archive.

Parameters
[in]regionRegion to get font from
Returns
Font handle
Return values
NULLError
Remarks
JPN, USA, EUR, and AUS all use the same font.
void C2D_FontSetFilter ( C2D_Font  font,
GPU_TEXTURE_FILTER_PARAM  magFilter,
GPU_TEXTURE_FILTER_PARAM  minFilter 
)

Set a font's texture filter.

Parameters
[in]fontFont handle
[in]magFilterthe magnification filter
[in]minFilterthe minification filter