Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
fontstash.h File Reference

Go to the source code of this file.

Classes

struct  FONSvert
 
struct  FONSparams
 
struct  FONSquad
 
struct  FONStextIter
 
struct  FONSsdfSettings
 

Macros

#define FONS_DEF   extern
 
#define FONS_INVALID   -1
 
#define FONS_SCRATCH_BUF_SIZE   64000
 
#define FONS_HASH_LUT_SIZE   256
 
#define FONS_INIT_FONTS   4
 
#define FONS_INIT_GLYPHS   256
 
#define FONS_INIT_ATLAS_NODES   256
 
#define FONS_VERTEX_COUNT   1024
 
#define FONS_MAX_STATES   20
 
#define FONS_MAX_FALLBACKS   20
 

Typedefs

typedef struct FONSparams FONSparams
 
typedef struct FONSquad FONSquad
 
typedef struct FONStextIter FONStextIter
 
typedef struct FONSsdfSettings FONSsdfSettings
 
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 fonsAddFontSdf (FONScontext *s, const char *name, const char *path, FONSsdfSettings sdfSettings)
 
int fonsAddFontSdfMem (FONScontext *s, const char *name, unsigned char *data, int ndata, int freeData, FONSsdfSettings sdfSettings)
 
int fonsGetFontByName (FONScontext *s, const char *name)
 
int fonsAddFallbackFont (FONScontext *stash, int base, int fallback)
 
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)
 
void fonsSetColour (FONScontext *s, unsigned char colourR, unsigned char colourG, unsigned char colourB, unsigned char colourA)
 
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)
 
FONScontextdummyfonsCreate (int width, int height, int flags)
 
void dummyfonsDelete (FONScontext *ctx)
 

Macro Definition Documentation

◆ FONS_DEF

#define FONS_DEF   extern

Definition at line 33 of file fontstash.h.

◆ FONS_HASH_LUT_SIZE

#define FONS_HASH_LUT_SIZE   256

Definition at line 188 of file fontstash.h.

◆ FONS_INIT_ATLAS_NODES

#define FONS_INIT_ATLAS_NODES   256

Definition at line 197 of file fontstash.h.

◆ FONS_INIT_FONTS

#define FONS_INIT_FONTS   4

Definition at line 191 of file fontstash.h.

◆ FONS_INIT_GLYPHS

#define FONS_INIT_GLYPHS   256

Definition at line 194 of file fontstash.h.

◆ FONS_INVALID

#define FONS_INVALID   -1

Definition at line 36 of file fontstash.h.

◆ FONS_MAX_FALLBACKS

#define FONS_MAX_FALLBACKS   20

Definition at line 206 of file fontstash.h.

◆ FONS_MAX_STATES

#define FONS_MAX_STATES   20

Definition at line 203 of file fontstash.h.

◆ FONS_SCRATCH_BUF_SIZE

#define FONS_SCRATCH_BUF_SIZE   64000

Definition at line 185 of file fontstash.h.

◆ FONS_VERTEX_COUNT

#define FONS_VERTEX_COUNT   1024

Definition at line 200 of file fontstash.h.

Typedef Documentation

◆ FONScontext

typedef struct FONScontext FONScontext

Definition at line 119 of file fontstash.h.

◆ FONSparams

typedef struct FONSparams FONSparams

Definition at line 83 of file fontstash.h.

◆ FONSquad

typedef struct FONSquad FONSquad

Definition at line 90 of file fontstash.h.

◆ FONSsdfSettings

Definition at line 116 of file fontstash.h.

◆ FONStextIter

typedef struct FONStextIter FONStextIter

Definition at line 103 of file fontstash.h.

Enumeration Type Documentation

◆ FONSalign

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 43 of file fontstash.h.

◆ FONSerrorCode

Enumerator
FONS_ATLAS_FULL 
FONS_SCRATCH_FULL 
FONS_STATES_OVERFLOW 
FONS_STATES_UNDERFLOW 

Definition at line 62 of file fontstash.h.

◆ FONSflags

enum FONSflags
Enumerator
FONS_ZERO_TOPLEFT 
FONS_ZERO_BOTTOMLEFT 

Definition at line 38 of file fontstash.h.

Function Documentation

◆ dummyfonsCreate()

FONScontext * dummyfonsCreate ( int  width,
int  height,
int  flags 
)

◆ dummyfonsDelete()

void dummyfonsDelete ( FONScontext ctx)

◆ fonsAddFallbackFont()

int fonsAddFallbackFont ( FONScontext stash,
int  base,
int  fallback 
)

◆ fonsAddFont()

int fonsAddFont ( FONScontext s,
const char *  name,
const char *  path 
)

◆ fonsAddFontMem()

int fonsAddFontMem ( FONScontext s,
const char *  name,
unsigned char *  data,
int  ndata,
int  freeData 
)

◆ fonsAddFontSdf()

int fonsAddFontSdf ( FONScontext s,
const char *  name,
const char *  path,
FONSsdfSettings  sdfSettings 
)

◆ fonsAddFontSdfMem()

int fonsAddFontSdfMem ( FONScontext s,
const char *  name,
unsigned char *  data,
int  ndata,
int  freeData,
FONSsdfSettings  sdfSettings 
)

◆ fonsClearState()

void fonsClearState ( FONScontext s)

◆ fonsCreateInternal()

FONScontext * fonsCreateInternal ( FONSparams params)

◆ fonsDeleteInternal()

void fonsDeleteInternal ( FONScontext s)

◆ fonsDrawDebug()

void fonsDrawDebug ( FONScontext s,
float  x,
float  y 
)

◆ fonsDrawText()

float fonsDrawText ( FONScontext s,
float  x,
float  y,
const char *  string,
const char *  end 
)

◆ fonsExpandAtlas()

int fonsExpandAtlas ( FONScontext s,
int  width,
int  height 
)

◆ fonsGetAtlasSize()

void fonsGetAtlasSize ( FONScontext s,
int *  width,
int *  height 
)

◆ fonsGetFontByName()

int fonsGetFontByName ( FONScontext s,
const char *  name 
)

◆ fonsGetTextureData()

const unsigned char * fonsGetTextureData ( FONScontext stash,
int *  width,
int *  height 
)

◆ fonsLineBounds()

void fonsLineBounds ( FONScontext s,
float  y,
float *  miny,
float *  maxy 
)

◆ fonsPopState()

void fonsPopState ( FONScontext s)

◆ fonsPushState()

void fonsPushState ( FONScontext s)

◆ fonsResetAtlas()

int fonsResetAtlas ( FONScontext stash,
int  width,
int  height 
)

◆ fonsSetAlign()

void fonsSetAlign ( FONScontext s,
int  align 
)

◆ fonsSetBlur()

void fonsSetBlur ( FONScontext s,
float  blur 
)

◆ fonsSetColor()

void fonsSetColor ( FONScontext s,
unsigned int  color 
)

◆ fonsSetColour()

void fonsSetColour ( FONScontext s,
unsigned char  colourR,
unsigned char  colourG,
unsigned char  colourB,
unsigned char  colourA 
)

◆ fonsSetErrorCallback()

void fonsSetErrorCallback ( FONScontext s,
void(*)(void *uptr, int error, int val)  callback,
void *  uptr 
)

◆ fonsSetFont()

void fonsSetFont ( FONScontext s,
int  font 
)

◆ fonsSetSize()

void fonsSetSize ( FONScontext s,
float  size 
)

◆ fonsSetSpacing()

void fonsSetSpacing ( FONScontext s,
float  spacing 
)

◆ fonsTextBounds()

float fonsTextBounds ( FONScontext s,
float  x,
float  y,
const char *  string,
const char *  end,
float *  bounds 
)

◆ fonsTextIterInit()

int fonsTextIterInit ( FONScontext stash,
FONStextIter iter,
float  x,
float  y,
const char *  str,
const char *  end 
)

◆ fonsTextIterNext()

int fonsTextIterNext ( FONScontext stash,
FONStextIter iter,
struct FONSquad quad 
)

◆ fonsValidateTexture()

int fonsValidateTexture ( FONScontext s,
int *  dirty 
)

◆ fonsVertMetrics()

void fonsVertMetrics ( FONScontext s,
float *  ascender,
float *  descender,
float *  lineh 
)