diff options
author | Diego Borghetti <bdiego@gmail.com> | 2009-06-13 18:58:39 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2009-06-13 18:58:39 +0400 |
commit | 3a9396c47dcc1083baf5bcbb93556f65b84ba5a0 (patch) | |
tree | b02114b4d46619e13cf382750e322a3436dc3fe1 /source/blender/blenfont/intern | |
parent | fa01eef27e1a03aeba438e10ae11230f07ff0fb6 (diff) |
Restore default value for font kerning.
The user value is 0 by default and the font kerning (the value
that come with the font) is enable, like always.
(the last was disable by mistake in a previous commit)
Diffstat (limited to 'source/blender/blenfont/intern')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 23 |
1 files changed, 13 insertions, 10 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; |