BRL-CAD
fontstash.h File Reference
#include "common.h"
#include "bu/str.h"
Include dependency graph for fontstash.h:

Go to the source code of this file.

Data Structures

struct  FONSparams
 
struct  FONSquad
 
struct  FONStextIter
 

Macros

#define FONS_INVALID   -1
 

Typedefs

typedef struct FONSparams FONSparams
 
typedef struct FONSquad FONSquad
 
typedef struct FONStextIter FONStextIter
 
typedef struct FONScontext FONScontext
 

Enumerations

enum  FONSflags { FONS_ZERO_TOPLEFT = 1, FONS_ZERO_BOTTOMLEFT = 2 }
 
enum  FONSalign {
  FONS_ALIGN_LEFT = 1<<0, FONS_ALIGN_CENTER = 1<<1, FONS_ALIGN_RIGHT = 1<<2, FONS_ALIGN_TOP = 1<<3,
  FONS_ALIGN_MIDDLE = 1<<4, FONS_ALIGN_BOTTOM = 1<<5, FONS_ALIGN_BASELINE = 1<<6
}
 
enum  FONSerrorCode { FONS_ATLAS_FULL = 1, FONS_SCRATCH_FULL = 2, FONS_STATES_OVERFLOW = 3, FONS_STATES_UNDERFLOW = 4 }
 

Functions

FONScontextfonsCreateInternal (FONSparams *params)
 
void fonsDeleteInternal (FONScontext *s)
 
void fonsSetErrorCallback (FONScontext *s, void(*callback)(void *uptr, int error, int val), void *uptr)
 
void fonsGetAtlasSize (FONScontext *s, int *width, int *height)
 
int fonsExpandAtlas (FONScontext *s, int width, int height)
 
int fonsResetAtlas (FONScontext *stash, int width, int height)
 
int fonsAddFont (FONScontext *s, const char *name, const char *path)
 
int fonsAddFontMem (FONScontext *s, const char *name, unsigned char *data, int ndata, int freeData)
 
int fonsGetFontByName (FONScontext *s, const char *name)
 
void fonsPushState (FONScontext *s)
 
void fonsPopState (FONScontext *s)
 
void fonsClearState (FONScontext *s)
 
void fonsSetSize (FONScontext *s, float size)
 
void fonsSetColor (FONScontext *s, unsigned int color)
 
void fonsSetSpacing (FONScontext *s, float spacing)
 
void fonsSetBlur (FONScontext *s, float blur)
 
void fonsSetAlign (FONScontext *s, int align)
 
void fonsSetFont (FONScontext *s, int font)
 
float fonsDrawText (FONScontext *s, float x, float y, const char *string, const char *end)
 
float fonsTextBounds (FONScontext *s, float x, float y, const char *string, const char *end, float *bounds)
 
void fonsLineBounds (FONScontext *s, float y, float *miny, float *maxy)
 
void fonsVertMetrics (FONScontext *s, float *ascender, float *descender, float *lineh)
 
int fonsTextIterInit (FONScontext *stash, FONStextIter *iter, float x, float y, const char *str, const char *end)
 
int fonsTextIterNext (FONScontext *stash, FONStextIter *iter, struct FONSquad *quad)
 
const unsigned char * fonsGetTextureData (FONScontext *stash, int *width, int *height)
 
int fonsValidateTexture (FONScontext *s, int *dirty)
 
void fonsDrawDebug (FONScontext *s, float x, float y)
 

Macro Definition Documentation

#define FONS_INVALID   -1

Definition at line 25 of file fontstash.h.

Typedef Documentation

typedef struct FONSparams FONSparams

Definition at line 67 of file fontstash.h.

typedef struct FONSquad FONSquad

Definition at line 74 of file fontstash.h.

typedef struct FONStextIter FONStextIter

Definition at line 87 of file fontstash.h.

typedef struct FONScontext FONScontext

Definition at line 89 of file fontstash.h.

Enumeration Type Documentation

enum FONSflags
Enumerator
FONS_ZERO_TOPLEFT 
FONS_ZERO_BOTTOMLEFT 

Definition at line 27 of file fontstash.h.

enum FONSalign
Enumerator
FONS_ALIGN_LEFT 
FONS_ALIGN_CENTER 
FONS_ALIGN_RIGHT 
FONS_ALIGN_TOP 
FONS_ALIGN_MIDDLE 
FONS_ALIGN_BOTTOM 
FONS_ALIGN_BASELINE 

Definition at line 32 of file fontstash.h.

Enumerator
FONS_ATLAS_FULL 
FONS_SCRATCH_FULL 
FONS_STATES_OVERFLOW 
FONS_STATES_UNDERFLOW 

Definition at line 44 of file fontstash.h.

Function Documentation

FONScontext* fonsCreateInternal ( FONSparams params)
void fonsDeleteInternal ( FONScontext s)
void fonsSetErrorCallback ( FONScontext s,
void(*)(void *uptr, int error, int val callback,
void *  uptr 
)
void fonsGetAtlasSize ( FONScontext s,
int *  width,
int *  height 
)
int fonsExpandAtlas ( FONScontext s,
int  width,
int  height 
)
int fonsResetAtlas ( FONScontext stash,
int  width,
int  height 
)
int fonsAddFont ( FONScontext s,
const char *  name,
const char *  path 
)
int fonsAddFontMem ( FONScontext s,
const char *  name,
unsigned char *  data,
int  ndata,
int  freeData 
)
int fonsGetFontByName ( FONScontext s,
const char *  name 
)
void fonsPushState ( FONScontext s)
void fonsPopState ( FONScontext s)
void fonsClearState ( FONScontext s)
void fonsSetSize ( FONScontext s,
float  size 
)
void fonsSetColor ( FONScontext s,
unsigned int  color 
)
void fonsSetSpacing ( FONScontext s,
float  spacing 
)
void fonsSetBlur ( FONScontext s,
float  blur 
)
void fonsSetAlign ( FONScontext s,
int  align 
)
void fonsSetFont ( FONScontext s,
int  font 
)
float fonsDrawText ( FONScontext s,
float  x,
float  y,
const char *  string,
const char *  end 
)
float fonsTextBounds ( FONScontext s,
float  x,
float  y,
const char *  string,
const char *  end,
float *  bounds 
)
void fonsLineBounds ( FONScontext s,
float  y,
float *  miny,
float *  maxy 
)
void fonsVertMetrics ( FONScontext s,
float *  ascender,
float *  descender,
float *  lineh 
)
int fonsTextIterInit ( FONScontext stash,
FONStextIter iter,
float  x,
float  y,
const char *  str,
const char *  end 
)
int fonsTextIterNext ( FONScontext stash,
FONStextIter iter,
struct FONSquad quad 
)
const unsigned char* fonsGetTextureData ( FONScontext stash,
int *  width,
int *  height 
)
int fonsValidateTexture ( FONScontext s,
int *  dirty 
)
void fonsDrawDebug ( FONScontext s,
float  x,
float  y 
)