Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
unifont.h File Reference
#include <stdarg.h>
#include <map>
#include "lib/res/handle.h"
#include "lib/file/vfs/vfs.h"

Go to the source code of this file.

Classes

struct  UnifontGlyphData
 

Functions

Handle unifont_load (const PIVFS &vfs, const VfsPath &pathname, size_t flags=0)
 Load a font. More...
 
Status unifont_unload (Handle &h)
 Release a handle to a previously loaded font (subject to reference counting). More...
 
Status unifont_stringsize (const Handle h, const wchar_t *text, int &width, int &height)
 Determine pixel extents of a string. More...
 
bool unifont_has_rgb (const Handle h)
 
int unifont_height (const Handle h)
 
int unifont_character_width (const Handle h, wchar_t c)
 
int unifont_linespacing (const Handle h)
 
const std::map< u16,
UnifontGlyphData > & 
unifont_get_glyphs (const Handle h)
 
Handle unifont_get_texture (const Handle h)
 

Function Documentation

int unifont_character_width ( const Handle  h,
wchar_t  c 
)
Returns
width [pixels] of a certain character.

Definition at line 237 of file unifont.cpp.

const std::map<u16, UnifontGlyphData>& unifont_get_glyphs ( const Handle  h)
Returns
glyph data for all glyphs in this font.

Definition at line 276 of file unifont.cpp.

Handle unifont_get_texture ( const Handle  h)
Returns
texture handle for this font.

Definition at line 289 of file unifont.cpp.

bool unifont_has_rgb ( const Handle  h)
Returns
whether the font is an RGBA texture, not an ALPHA texture.

Definition at line 228 of file unifont.cpp.

int unifont_height ( const Handle  h)
Returns
height [pixels] of the font.

Definition at line 221 of file unifont.cpp.

int unifont_linespacing ( const Handle  h)
Returns
spacing in pixels from one line of text to the next.

Definition at line 214 of file unifont.cpp.

Handle unifont_load ( const PIVFS vfs,
const VfsPath pathname,
size_t  flags = 0 
)

Load a font.

Parameters
vfs
pathnamepath and basename of the font definition file (.fnt) and its texture (.png)
flags

Definition at line 201 of file unifont.cpp.

Status unifont_stringsize ( const Handle  h,
const wchar_t text,
int &  width,
int &  height 
)

Determine pixel extents of a string.

Parameters
h
textstring in question.
width
heightis roughly the pixel height of a capital letter, for use when aligning text in an aesthetically pleasing way.

note: This is intended for the GUI (hence Unicode).

Definition at line 248 of file unifont.cpp.

Status unifont_unload ( Handle h)

Release a handle to a previously loaded font (subject to reference counting).

Definition at line 207 of file unifont.cpp.