Made the kerning a float, this give a little more of tweak.

0.5 is the default value now, the range are from -5.0 to 5.0.
Note that we allow negative value, but the current draw code
always check for overlap characters.
This commit is contained in:
2009-06-12 17:18:59 +00:00
parent 0e170f8e56
commit 845e9a0e25
7 changed files with 14 additions and 14 deletions

View File

@@ -85,7 +85,7 @@ float BLF_height_default(char *str);
void BLF_rotation(float angle);
void BLF_clipping(float xmin, float ymin, float xmax, float ymax);
void BLF_blur(int size);
void BLF_kerning(int space);
void BLF_kerning(float space);
void BLF_enable(int option);
void BLF_disable(int option);

View File

@@ -492,7 +492,7 @@ void BLF_mode(int mode)
font->mode= mode;
}
void BLF_kerning(int space)
void BLF_kerning(float space)
{
FontBLF *font;

View File

@@ -100,7 +100,7 @@ void blf_font_draw(FontBLF *font, char *str)
GlyphBLF *g, *g_prev;
FT_Vector delta;
FT_UInt glyph_index, g_prev_index;
int pen_x, pen_y, old_pen_x;
float pen_x, pen_y, old_pen_x;
int i, has_kerning;
if (!font->glyph_cache)
@@ -159,7 +159,7 @@ void blf_font_draw(FontBLF *font, char *str)
}
/* do not return this loop if clipped, we want every character tested */
blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
blf_glyph_render(font, g, pen_x, pen_y);
pen_x += g->advance;
g_prev= g;
@@ -321,7 +321,7 @@ void blf_font_fill(FontBLF *font)
font->flags= BLF_USER_KERNING;
font->dpi= 0;
font->size= 0;
font->kerning= 0;
font->kerning= 0.0f;
font->cache.first= NULL;
font->cache.last= NULL;
font->glyph_cache= NULL;

View File

@@ -168,7 +168,7 @@ typedef struct FontBLF {
int size;
/* kerning space, user setting. */
int kerning;
float kerning;
/* max texture size. */
int max_tex_size;

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= 1;
style->paneltitle.kerning= 0.5;
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= 1;
style->grouplabel.kerning= 0.5;
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= 1;
style->widgetlabel.kerning= 0.5;
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= 1;
style->widget.kerning= 0.5;
style->widget.shadowalpha= 0.25f;
style->columnspace= 5;

View File

@@ -66,8 +66,8 @@ typedef struct uiFont {
typedef struct uiFontStyle {
short uifont_id; /* saved in file, 0 is default */
short points; /* actual size depends on 'global' dpi */
short kerning; /* kerning space between characters. */
char pad[6];
float kerning; /* kerning space between characters. */
float pad;
short italic, bold; /* style hint */
short shadow; /* value is amount of pixels blur */
short shadx, shady; /* shadow offset in pixels */

View File

@@ -137,8 +137,8 @@ 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_INT, PROP_NONE);
RNA_def_property_range(prop, -5, 5);
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", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);