Move font renderer in a separate folder as a library

This commit is contained in:
Francesco Abbate
2020-06-04 18:52:01 +02:00
parent 2171ea17fb
commit c5575de058
11 changed files with 27 additions and 14 deletions
+57
View File
@@ -0,0 +1,57 @@
#ifndef FONT_RENDERER_H
#define FONT_RENDERER_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// Mirrors stbtt_bakedchar.
typedef struct {
unsigned short x0, y0, x1, y1;
float xoff, yoff, xadvance;
} GlyphBitmapInfo;
struct FontRendererImpl;
typedef struct FontRendererImpl FontRenderer;
enum {
FONT_RENDERER_HINTING = 1 << 0,
FONT_RENDERER_KERNING = 1 << 1,
};
typedef struct {
uint8_t r, g, b;
} FontRendererColor;
FontRenderer * FontRendererNew(unsigned int flags, float gamma);
void FontRendererFree(FontRenderer *);
int FontRendererLoadFont(FontRenderer *, const char *filename);
int FontRendererGetFontHeight(FontRenderer *, float size);
int FontRendererBakeFontBitmap(FontRenderer *, int font_height,
void *pixels, int pixels_width, int pixels_height,
int first_char, int num_chars, GlyphBitmapInfo *glyph_info,
int subpixel_scale);
void FontRendererBlendGamma(FontRenderer *,
uint8_t *dst, int dst_stride,
uint8_t *src, int src_stride,
int region_width, int region_height,
FontRendererColor color);
void FontRendererBlendGammaSubpixel(FontRenderer *,
uint8_t *dst, int dst_stride,
uint8_t *src, int src_stride,
int region_width, int region_height,
FontRendererColor color);
#ifdef __cplusplus
}
#endif
#endif