diff options
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 23 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 8 |
2 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 5a3b3207e29..921f5cac67c 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -29,6 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include <ft2build.h> @@ -143,11 +144,12 @@ void blf_font_draw(FontBLF *font, char *str) delta.x= 0; delta.y= 0; - FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta); - pen_x += delta.x >> 6; + if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) { + pen_x += delta.x >> 6; - if (pen_x < old_pen_x) - pen_x= old_pen_x; + if (pen_x < old_pen_x) + pen_x= old_pen_x; + } } if (font->flags & BLF_USER_KERNING) { @@ -174,7 +176,7 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box) FT_Vector delta; FT_UInt glyph_index, g_prev_index; rctf gbox; - int pen_x, pen_y, old_pen_x; + float pen_x, pen_y, old_pen_x; int i, has_kerning; if (!font->glyph_cache) @@ -222,11 +224,12 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box) delta.x= 0; delta.y= 0; - FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta); - pen_x += delta.x >> 6; + if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) { + pen_x += delta.x >> 6; - if (pen_x < old_pen_x) - old_pen_x= pen_x; + if (pen_x < old_pen_x) + old_pen_x= pen_x; + } } if (font->flags & BLF_USER_KERNING) { @@ -318,7 +321,7 @@ 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; + font->flags= BLF_USER_KERNING | BLF_FONT_KERNING; font->dpi= 0; font->size= 0; font->kerning= 0.0f; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index f1d29ac8688..831a8a5bf6c 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -91,7 +91,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->paneltitle.uifont_id= UIFONT_DEFAULT; style->paneltitle.points= 13; - style->paneltitle.kerning= 0.5; + style->paneltitle.kerning= 0.0; style->paneltitle.shadow= 5; style->paneltitle.shadx= 2; style->paneltitle.shady= -2; @@ -100,7 +100,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->grouplabel.uifont_id= UIFONT_DEFAULT; style->grouplabel.points= 12; - style->grouplabel.kerning= 0.5; + style->grouplabel.kerning= 0.0; style->grouplabel.shadow= 3; style->grouplabel.shadx= 1; style->grouplabel.shady= -1; @@ -108,7 +108,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->widgetlabel.uifont_id= UIFONT_DEFAULT; style->widgetlabel.points= 11; - style->widgetlabel.kerning= 0.5; + style->widgetlabel.kerning= 0.0; style->widgetlabel.shadow= 3; style->widgetlabel.shadx= 1; style->widgetlabel.shady= -1; @@ -117,7 +117,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->widget.uifont_id= UIFONT_DEFAULT; style->widget.points= 11; - style->widget.kerning= 0.5; + style->widget.kerning= 0.0; style->widget.shadowalpha= 0.25f; style->columnspace= 5; |