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)
This commit is contained in:
2009-06-13 14:58:39 +00:00
parent fa01eef27e
commit 3a9396c47d
2 changed files with 17 additions and 14 deletions

View File

@@ -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;

View File

@@ -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;