Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2009-06-23 22:26:01 +0400
committerDiego Borghetti <bdiego@gmail.com>2009-06-23 22:26:01 +0400
commit483e9479f73dca77fd3b6db7ede72849b1552859 (patch)
treecc16d905377eb8f036933a93a15ee17b88a38cfb /source/blender/blenfont
parent30d769e2cda8851cbd45ca5ebf074d90b7f9cbc1 (diff)
New Style option: Overlap
If this option is enable, the blenfont check for overlap characters, like one of my previous commit but now it's optional and disable by default. (This fix the "Fi" or other case when the characters are too close) Enable/disable from: Outliner -> User Preferences -> Styles -> Panel Font -> Overlap (also for other styles, Group Label, Widget, Widget Label)
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h1
-rw-r--r--source/blender/blenfont/intern/blf_font.c36
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c2
3 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index cb64615d64c..2ee31a17fa6 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -135,6 +135,7 @@ void BLF_dir_free(char **dirs, int count);
#define BLF_FONT_KERNING (1<<2)
#define BLF_USER_KERNING (1<<3)
#define BLF_SHADOW (1<<4)
+#define BLF_OVERLAP_CHAR (1<<5)
/* font->mode. */
#define BLF_MODE_TEXTURE 0
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index ee4ba0ee71a..a3c5232cc76 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -146,20 +146,22 @@ void blf_font_draw(FontBLF *font, char *str)
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 (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 (pen_x < old_pen_x)
- pen_x= old_pen_x;
-*/
+
+ 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 */
@@ -228,20 +230,22 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
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 (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 (pen_x < old_pen_x)
- old_pen_x= pen_x;
-*/
+
+ if (font->flags & BLF_OVERLAP_CHAR) {
+ if (pen_x < old_pen_x)
+ pen_x= old_pen_x;
+ }
}
gbox.xmin= g->box.xmin + pen_x;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 5e0868ea680..a637774d7bf 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -500,6 +500,8 @@ int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
float color[4];
gt= g->tex_data;
+ xo= 0.0f;
+ yo= 0.0f;
if (font->flags & BLF_SHADOW) {
xo= x;