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 | |
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.
-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 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 10 |
8 files changed, 9 insertions, 92 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; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index e8fba38f793..9ff1f2d6b29 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -91,8 +91,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->paneltitle.uifont_id= UIFONT_DEFAULT; style->paneltitle.points= 13; - style->paneltitle.kerning= 0.0; - style->paneltitle.overlap= 0; style->paneltitle.shadow= 5; style->paneltitle.shadx= 2; style->paneltitle.shady= -2; @@ -101,8 +99,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->grouplabel.uifont_id= UIFONT_DEFAULT; style->grouplabel.points= 12; - style->grouplabel.kerning= 0.0; - style->grouplabel.overlap= 0; style->grouplabel.shadow= 3; style->grouplabel.shadx= 1; style->grouplabel.shady= -1; @@ -110,8 +106,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->widgetlabel.uifont_id= UIFONT_DEFAULT; style->widgetlabel.points= 11; - style->widgetlabel.kerning= 0.0; - style->widgetlabel.overlap= 0; style->widgetlabel.shadow= 3; style->widgetlabel.shadx= 1; style->widgetlabel.shady= -1; @@ -120,7 +114,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->widget.uifont_id= UIFONT_DEFAULT; style->widget.points= 11; - style->widget.kerning= 0.0; style->widget.shadowalpha= 0.25f; style->columnspace= 5; @@ -174,15 +167,10 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str) BLF_shadow_offset(fs->shadx, fs->shady); } - if (fs->overlap) - BLF_enable(BLF_OVERLAP_CHAR); - BLF_draw(str); BLF_disable(BLF_CLIPPING); if (fs->shadow) BLF_disable(BLF_SHADOW); - if (fs->overlap) - BLF_disable(BLF_OVERLAP_CHAR); } /* ************** helpers ************************ */ @@ -263,6 +251,5 @@ void uiStyleFontSet(uiFontStyle *fs) BLF_set(font->blf_id); BLF_size(fs->points, U.dpi); - BLF_kerning(fs->kerning); } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 771a7e43793..dec3fde8f53 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -66,9 +66,6 @@ typedef struct uiFont { typedef struct uiFontStyle { short uifont_id; /* saved in file, 0 is default */ short points; /* actual size depends on 'global' dpi */ - float kerning; /* kerning space between characters. */ - short overlap; /* check overlaped characters. */ - short pad; short italic, bold; /* style hint */ short shadow; /* value is amount of pixels blur */ short shadx, shady; /* shadow offset in pixels */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 609082144e1..a2bc652ad1a 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -137,16 +137,6 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Points", ""); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "kerning", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, -5.0, 5.0); - RNA_def_property_ui_text(prop, "Kerning", "User kerning value in pixels"); - RNA_def_property_update(prop, NC_WINDOW, NULL); - - prop= RNA_def_property(srna, "overlap", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "overlap", 1); - RNA_def_property_ui_text(prop, "Overlap", "Check for overlap characters"); - RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 5); RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size in pixels (0, 3 and 5 supported)"); |