35 lines
859 B
Plaintext
35 lines
859 B
Plaintext
|
stbtt_InitFont
|
||
|
|
||
|
stbtt_ScaleForMappingEmToPixels x 3
|
||
|
stbtt_ScaleForPixelHeight
|
||
|
stbtt_BakeFontBitmap
|
||
|
stbtt_GetFontVMetrics x 2
|
||
|
|
||
|
struct RenImage {
|
||
|
RenColor *pixels;
|
||
|
int width, height;
|
||
|
};
|
||
|
|
||
|
typedef struct {
|
||
|
RenImage *image;
|
||
|
stbtt_bakedchar glyphs[256];
|
||
|
} GlyphSet;
|
||
|
|
||
|
struct RenFont {
|
||
|
void *data;
|
||
|
stbtt_fontinfo stbfont;
|
||
|
GlyphSet *sets[MAX_GLYPHSET];
|
||
|
float size;
|
||
|
int height;
|
||
|
};
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned short x0, y0, x1, y1; // coordinates of bbox in bitmap
|
||
|
float xoff, yoff, xadvance;
|
||
|
} stbtt_bakedchar;
|
||
|
|
||
|
The function stbtt_BakeFontBitmap is used to write bitmap data into set->image->pixels (where set is a GlyphSet).
|
||
|
Note that set->image->pixels need data in RGB format. After stbtt_BakeFontBitmap call the bitmap data are converted into RGB.
|
||
|
With a single call many glyphs corresponding to a range of codepoints, all in a
|
||
|
single image.
|