diff options
author | Diego Borghetti <bdiego@gmail.com> | 2009-07-11 00:18:19 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2009-07-11 00:18:19 +0400 |
commit | ad59d04c77a9b096fd4d7454b0d59e9bf30ffca6 (patch) | |
tree | d37ecff1df7bd5e357930aca008994636cc8a6f2 /source/blender/blenfont | |
parent | 2e3e044d27e90dc87bdce6af9cef77d9543e4d89 (diff) |
Yes!! a nice font again!!
Matt, I found the problem in one of my previous commit, so I revert
all my changes and now the font look good again.
Also remove all the options (kerning, overlap and user kerning), I want
to make this a little better.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 6 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 9 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 45 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 12 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_internal_types.h | 3 |
5 files changed, 9 insertions, 66 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index c373fde5693..53f108f87eb 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -90,7 +90,6 @@ void BLF_default_rotation(float angle); void BLF_rotation(float angle); void BLF_clipping(float xmin, float ymin, float xmax, float ymax); void BLF_blur(int size); -void BLF_kerning(float space); void BLF_enable(int option); void BLF_disable(int option); @@ -137,10 +136,7 @@ void BLF_dir_free(char **dirs, int count); /* font->flags. */ #define BLF_ROTATION (1<<0) #define BLF_CLIPPING (1<<1) -#define BLF_FONT_KERNING (1<<2) -#define BLF_USER_KERNING (1<<3) -#define BLF_SHADOW (1<<4) -#define BLF_OVERLAP_CHAR (1<<5) +#define BLF_SHADOW (1<<2) /* font->mode. */ #define BLF_MODE_TEXTURE 0 diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index a7e599fabf9..9a249c2f241 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -505,15 +505,6 @@ void BLF_mode(int mode) font->mode= mode; } -void BLF_kerning(float space) -{ - FontBLF *font; - - font= global_font[global_font_cur]; - if (font) - font->kerning= space; -} - void BLF_shadow(int level, float r, float g, float b, float a) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index a3c5232cc76..989746ca501 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -101,7 +101,7 @@ void blf_font_draw(FontBLF *font, char *str) GlyphBLF *g, *g_prev; FT_Vector delta; FT_UInt glyph_index, g_prev_index; - float pen_x, pen_y, old_pen_x; + int pen_x, pen_y; int i, has_kerning; if (!font->glyph_cache) @@ -139,33 +139,17 @@ void blf_font_draw(FontBLF *font, char *str) else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data)) g= blf_glyph_add(font, glyph_index, c); - if ((font->flags & BLF_FONT_KERNING) && has_kerning && g_prev) { - old_pen_x= pen_x; + if (has_kerning && g_prev) { delta.x= 0; delta.y= 0; if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) { pen_x += delta.x >> 6; - - if (font->flags & BLF_OVERLAP_CHAR) { - if (pen_x < old_pen_x) - pen_x= old_pen_x; - } - } - } - - if (font->flags & BLF_USER_KERNING) { - old_pen_x= pen_x; - pen_x += font->kerning; - - if (font->flags & BLF_OVERLAP_CHAR) { - if (pen_x < old_pen_x) - pen_x= old_pen_x; } } /* do not return this loop if clipped, we want every character tested */ - blf_glyph_render(font, g, pen_x, pen_y); + blf_glyph_render(font, g, (float)pen_x, (float)pen_y); pen_x += g->advance; g_prev= g; @@ -180,7 +164,7 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box) FT_Vector delta; FT_UInt glyph_index, g_prev_index; rctf gbox; - float pen_x, pen_y, old_pen_x; + int pen_x, pen_y; int i, has_kerning; if (!font->glyph_cache) @@ -223,28 +207,12 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box) else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data)) g= blf_glyph_add(font, glyph_index, c); - if ((font->flags & BLF_FONT_KERNING) && has_kerning && g_prev) { - old_pen_x= pen_x; + if (has_kerning && g_prev) { delta.x= 0; delta.y= 0; if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) { pen_x += delta.x >> 6; - - if (font->flags & BLF_OVERLAP_CHAR) { - if (pen_x < old_pen_x) - pen_x= old_pen_x; - } - } - } - - if (font->flags & BLF_USER_KERNING) { - old_pen_x= pen_x; - pen_x += font->kerning; - - if (font->flags & BLF_OVERLAP_CHAR) { - if (pen_x < old_pen_x) - pen_x= old_pen_x; } } @@ -329,10 +297,9 @@ void blf_font_fill(FontBLF *font) font->clip_rec.xmax= 0.0f; font->clip_rec.ymin= 0.0f; font->clip_rec.ymax= 0.0f; - font->flags= BLF_USER_KERNING | BLF_FONT_KERNING; + font->flags= 0; font->dpi= 0; font->size= 0; - font->kerning= 0.0f; font->cache.first= NULL; font->cache.last= NULL; font->glyph_cache= NULL; diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index a637774d7bf..d2767d6ffb1 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -213,11 +213,7 @@ GlyphBLF *blf_glyph_texture_add(FontBLF *font, FT_UInt index, unsigned int c) else do_new= 1; - if (font->flags & BLF_FONT_KERNING) - err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_BITMAP); - else - err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); - + err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); if (err) return(NULL); @@ -332,11 +328,7 @@ GlyphBLF *blf_glyph_bitmap_add(FontBLF *font, FT_UInt index, unsigned int c) else do_new= 1; - if (font->flags & BLF_FONT_KERNING) - err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_BITMAP); - else - err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); - + err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); if (err) return(NULL); diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 5382ac19aae..64d95986867 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -177,9 +177,6 @@ typedef struct FontBLF { /* font size. */ int size; - /* kerning space, user setting. */ - float kerning; - /* max texture size. */ int max_tex_size; |