2020-06-01 12:56:23 +02:00
|
|
|
#ifndef FONT_RENDERER_H
|
|
|
|
#define FONT_RENDERER_H
|
|
|
|
|
2020-06-02 14:47:06 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-06-01 12:56:23 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-06-02 14:47:06 +02:00
|
|
|
typedef struct {
|
2020-06-01 12:56:23 +02:00
|
|
|
unsigned short x0, y0, x1, y1;
|
|
|
|
float xoff, yoff, xadvance;
|
2020-06-11 18:12:47 +02:00
|
|
|
} FR_Bitmap_Glyph_Metrics;
|
2020-06-01 12:56:23 +02:00
|
|
|
|
2020-06-11 18:12:47 +02:00
|
|
|
typedef struct FR_Bitmap FR_Bitmap;
|
2020-06-11 16:39:11 +02:00
|
|
|
|
2020-06-29 17:01:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
class FR_Renderer;
|
|
|
|
#else
|
|
|
|
struct FR_Renderer;
|
|
|
|
typedef struct FR_Renderer FR_Renderer;
|
|
|
|
#endif
|
2020-06-01 12:56:23 +02:00
|
|
|
|
|
|
|
enum {
|
2020-06-12 16:06:39 +02:00
|
|
|
FR_HINTING = 1 << 0,
|
|
|
|
FR_KERNING = 1 << 1,
|
|
|
|
FR_SUBPIXEL = 1 << 2,
|
|
|
|
FR_PRESCALE_X = 1 << 3,
|
2020-06-01 12:56:23 +02:00
|
|
|
};
|
|
|
|
|
2020-06-02 14:47:06 +02:00
|
|
|
typedef struct {
|
|
|
|
uint8_t r, g, b;
|
2020-06-11 18:12:47 +02:00
|
|
|
} FR_Color;
|
2020-06-02 14:47:06 +02:00
|
|
|
|
2020-06-11 16:39:11 +02:00
|
|
|
typedef struct {
|
|
|
|
int left, top, right, bottom;
|
2020-06-11 18:12:47 +02:00
|
|
|
} FR_Clip_Area;
|
2020-06-11 16:39:11 +02:00
|
|
|
|
2020-06-16 14:43:03 +02:00
|
|
|
FR_Renderer * FR_Renderer_New(unsigned int flags);
|
2020-06-11 23:19:08 +02:00
|
|
|
void FR_Renderer_Free(FR_Renderer *);
|
|
|
|
int FR_Load_Font(FR_Renderer *, const char *filename);
|
|
|
|
FR_Bitmap* FR_Bitmap_New(FR_Renderer *, int width, int height);
|
|
|
|
void FR_Bitmap_Free(FR_Bitmap *image);
|
|
|
|
int FR_Get_Font_Height(FR_Renderer *, float size);
|
2021-02-23 16:15:19 +01:00
|
|
|
FR_Bitmap * FR_Bake_Font_Bitmap(FR_Renderer *, int font_height,
|
2020-06-11 23:11:40 +02:00
|
|
|
int first_char, int num_chars, FR_Bitmap_Glyph_Metrics *glyph_info);
|
2020-06-11 23:19:08 +02:00
|
|
|
void FR_Blend_Glyph(FR_Renderer *font_renderer,
|
2020-06-11 18:12:47 +02:00
|
|
|
FR_Clip_Area *clip, int x, int y,
|
2020-06-11 16:39:11 +02:00
|
|
|
uint8_t *dst, int dst_width,
|
2020-06-11 18:12:47 +02:00
|
|
|
const FR_Bitmap *glyphs_bitmap,
|
|
|
|
const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color);
|
2021-03-03 17:57:23 +01:00
|
|
|
int FR_Subpixel_Scale(FR_Renderer *);
|
|
|
|
|
2020-06-01 12:56:23 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|