Rename FontRenderer to FR_Renderer
This commit is contained in:
parent
93a36617f9
commit
9e996a2d87
|
@ -39,14 +39,14 @@ private:
|
||||||
int m_subpixel;
|
int m_subpixel;
|
||||||
};
|
};
|
||||||
|
|
||||||
FontRenderer *FR_New(unsigned int flags, float gamma) {
|
FR_Renderer *FR_Renderer_New(unsigned int flags, float gamma) {
|
||||||
bool hinting = ((flags & FR_HINTING) != 0);
|
bool hinting = ((flags & FR_HINTING) != 0);
|
||||||
bool kerning = ((flags & FR_KERNING) != 0);
|
bool kerning = ((flags & FR_KERNING) != 0);
|
||||||
bool subpixel = ((flags & FR_SUBPIXEL) != 0);
|
bool subpixel = ((flags & FR_SUBPIXEL) != 0);
|
||||||
return new FR_Impl(hinting, kerning, subpixel, gamma);
|
return new FR_Impl(hinting, kerning, subpixel, gamma);
|
||||||
}
|
}
|
||||||
|
|
||||||
FR_Bitmap* FR_Bitmap_New(FontRenderer *font_renderer, int width, int height) {
|
FR_Bitmap* FR_Bitmap_New(FR_Renderer *font_renderer, int width, int height) {
|
||||||
const int subpixel_scale = font_renderer->subpixel_scale();
|
const int subpixel_scale = font_renderer->subpixel_scale();
|
||||||
FR_Bitmap *image = (FR_Bitmap *) malloc(sizeof(FR_Bitmap) + width * height * subpixel_scale);
|
FR_Bitmap *image = (FR_Bitmap *) malloc(sizeof(FR_Bitmap) + width * height * subpixel_scale);
|
||||||
if (!image) { return NULL; }
|
if (!image) { return NULL; }
|
||||||
|
@ -60,16 +60,16 @@ void FR_Bitmap_Free(FR_Bitmap *image) {
|
||||||
free(image);
|
free(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FR_Free(FontRenderer *font_renderer) {
|
void FR_Renderer_Free(FR_Renderer *font_renderer) {
|
||||||
delete font_renderer;
|
delete font_renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FR_Load_Font(FontRenderer *font_renderer, const char *filename) {
|
int FR_Load_Font(FR_Renderer *font_renderer, const char *filename) {
|
||||||
bool success = font_renderer->renderer_alpha().load_font(filename);
|
bool success = font_renderer->renderer_alpha().load_font(filename);
|
||||||
return (success ? 0 : 1);
|
return (success ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FR_Get_Font_Height(FontRenderer *font_renderer, float size) {
|
int FR_Get_Font_Height(FR_Renderer *font_renderer, float size) {
|
||||||
font_renderer_alpha& renderer_alpha = font_renderer->renderer_alpha();
|
font_renderer_alpha& renderer_alpha = font_renderer->renderer_alpha();
|
||||||
double ascender, descender;
|
double ascender, descender;
|
||||||
renderer_alpha.get_font_vmetrics(ascender, descender);
|
renderer_alpha.get_font_vmetrics(ascender, descender);
|
||||||
|
@ -166,7 +166,7 @@ static int ceil_to_multiple(int n, int p) {
|
||||||
return p * ((n + p - 1) / p);
|
return p * ((n + p - 1) / p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FR_Bake_Font_Bitmap(FontRenderer *font_renderer, int font_height,
|
int FR_Bake_Font_Bitmap(FR_Renderer *font_renderer, int font_height,
|
||||||
FR_Bitmap *image,
|
FR_Bitmap *image,
|
||||||
int first_char, int num_chars, FR_Bitmap_Glyph_Metrics *glyphs)
|
int first_char, int num_chars, FR_Bitmap_Glyph_Metrics *glyphs)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ void blend_solid_hspan_subpixel(agg::rendering_buffer& rbuf, agg::gamma_lut<>& g
|
||||||
|
|
||||||
// destination implicitly BGRA32. Source implictly single-byte renderer_alpha coverage with subpixel scale = 3.
|
// destination implicitly BGRA32. Source implictly single-byte renderer_alpha coverage with subpixel scale = 3.
|
||||||
// FIXME: consider using something like RenColor* instead of uint8_t * for dst.
|
// FIXME: consider using something like RenColor* instead of uint8_t * for dst.
|
||||||
void FR_Blend_Glyph(FontRenderer *font_renderer, FR_Clip_Area *clip, int x, int y, uint8_t *dst, int dst_width, const FR_Bitmap *glyphs_bitmap, const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color) {
|
void FR_Blend_Glyph(FR_Renderer *font_renderer, FR_Clip_Area *clip, int x, int y, uint8_t *dst, int dst_width, const FR_Bitmap *glyphs_bitmap, const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color) {
|
||||||
agg::gamma_lut<>& gamma = font_renderer->gamma();
|
agg::gamma_lut<>& gamma = font_renderer->gamma();
|
||||||
agg::lcd_distribution_lut& lcd_lut = font_renderer->lcd_distribution_lut();
|
agg::lcd_distribution_lut& lcd_lut = font_renderer->lcd_distribution_lut();
|
||||||
const int subpixel_scale = font_renderer->subpixel_scale();
|
const int subpixel_scale = font_renderer->subpixel_scale();
|
||||||
|
|
|
@ -15,7 +15,7 @@ typedef struct {
|
||||||
typedef struct FR_Bitmap FR_Bitmap;
|
typedef struct FR_Bitmap FR_Bitmap;
|
||||||
|
|
||||||
struct FR_Impl;
|
struct FR_Impl;
|
||||||
typedef struct FR_Impl FontRenderer;
|
typedef struct FR_Impl FR_Renderer;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FR_HINTING = 1 << 0,
|
FR_HINTING = 1 << 0,
|
||||||
|
@ -31,22 +31,21 @@ typedef struct {
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
} FR_Clip_Area;
|
} FR_Clip_Area;
|
||||||
|
|
||||||
FontRenderer * FR_New(unsigned int flags, float gamma);
|
FR_Renderer * FR_Renderer_New(unsigned int flags, float gamma);
|
||||||
void FR_Free(FontRenderer *);
|
void FR_Renderer_Free(FR_Renderer *);
|
||||||
FR_Bitmap* FR_Bitmap_New(FontRenderer *, int width, int height);
|
int FR_Load_Font(FR_Renderer *, const char *filename);
|
||||||
int FR_Load_Font(FontRenderer *, const char *filename);
|
FR_Bitmap* FR_Bitmap_New(FR_Renderer *, int width, int height);
|
||||||
int FR_Get_Font_Height(FontRenderer *, float size);
|
void FR_Bitmap_Free(FR_Bitmap *image);
|
||||||
int FR_Bake_Font_Bitmap(FontRenderer *, int font_height,
|
int FR_Get_Font_Height(FR_Renderer *, float size);
|
||||||
|
int FR_Bake_Font_Bitmap(FR_Renderer *, int font_height,
|
||||||
FR_Bitmap *image,
|
FR_Bitmap *image,
|
||||||
int first_char, int num_chars, FR_Bitmap_Glyph_Metrics *glyph_info);
|
int first_char, int num_chars, FR_Bitmap_Glyph_Metrics *glyph_info);
|
||||||
void FR_Blend_Glyph(FontRenderer *font_renderer,
|
void FR_Blend_Glyph(FR_Renderer *font_renderer,
|
||||||
FR_Clip_Area *clip, int x, int y,
|
FR_Clip_Area *clip, int x, int y,
|
||||||
uint8_t *dst, int dst_width,
|
uint8_t *dst, int dst_width,
|
||||||
const FR_Bitmap *glyphs_bitmap,
|
const FR_Bitmap *glyphs_bitmap,
|
||||||
const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color);
|
const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color);
|
||||||
|
|
||||||
void FR_Bitmap_Free(FR_Bitmap *image);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct RenFont {
|
||||||
GlyphSet *sets[MAX_GLYPHSET];
|
GlyphSet *sets[MAX_GLYPHSET];
|
||||||
float size;
|
float size;
|
||||||
int height;
|
int height;
|
||||||
FontRenderer *renderer;
|
FR_Renderer *renderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ RenFont* ren_load_font(const char *filename, float size) {
|
||||||
font->size = size;
|
font->size = size;
|
||||||
|
|
||||||
const float gamma = 1.5;
|
const float gamma = 1.5;
|
||||||
font->renderer = FR_New(FR_HINTING | FR_SUBPIXEL, gamma);
|
font->renderer = FR_Renderer_New(FR_HINTING | FR_SUBPIXEL, gamma);
|
||||||
if (FR_Load_Font(font->renderer, filename)) {
|
if (FR_Load_Font(font->renderer, filename)) {
|
||||||
free(font);
|
free(font);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -173,7 +173,7 @@ void ren_free_font(RenFont *font) {
|
||||||
free(set);
|
free(set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FR_Free(font->renderer);
|
FR_Renderer_Free(font->renderer);
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue