[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21114] branches/blender2.5/blender/source /blender: New Style option: Overlap

Diego Borghetti bdiego at gmail.com
Tue Jun 23 20:26:02 CEST 2009


Revision: 21114
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21114
Author:   bdiego
Date:     2009-06-23 20:26:01 +0200 (Tue, 23 Jun 2009)

Log Message:
-----------
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)

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenfont/BLF_api.h
    branches/blender2.5/blender/source/blender/blenfont/intern/blf_font.c
    branches/blender2.5/blender/source/blender/blenfont/intern/blf_glyph.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_style.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: branches/blender2.5/blender/source/blender/blenfont/BLF_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenfont/BLF_api.h	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/blenfont/BLF_api.h	2009-06-23 18:26:01 UTC (rev 21114)
@@ -135,6 +135,7 @@
 #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

Modified: branches/blender2.5/blender/source/blender/blenfont/intern/blf_font.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenfont/intern/blf_font.c	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/blenfont/intern/blf_font.c	2009-06-23 18:26:01 UTC (rev 21114)
@@ -146,20 +146,22 @@
 
 			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 @@
 
 			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;

Modified: branches/blender2.5/blender/source/blender/blenfont/intern/blf_glyph.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenfont/intern/blf_glyph.c	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/blenfont/intern/blf_glyph.c	2009-06-23 18:26:01 UTC (rev 21114)
@@ -500,6 +500,8 @@
 	float color[4];
 
 	gt= g->tex_data;
+	xo= 0.0f;
+	yo= 0.0f;
 
 	if (font->flags & BLF_SHADOW) {
 		xo= x;

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_style.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_style.c	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_style.c	2009-06-23 18:26:01 UTC (rev 21114)
@@ -92,6 +92,7 @@
 	style->paneltitle.uifont_id= UIFONT_DEFAULT;
 	style->paneltitle.points= 13;
 	style->paneltitle.kerning= 0.0;
+	style->paneltitle.overlap= 0;
 	style->paneltitle.shadow= 5;
 	style->paneltitle.shadx= 2;
 	style->paneltitle.shady= -2;
@@ -101,6 +102,7 @@
 	style->grouplabel.uifont_id= UIFONT_DEFAULT;
 	style->grouplabel.points= 12;
 	style->grouplabel.kerning= 0.0;
+	style->grouplabel.overlap= 0;
 	style->grouplabel.shadow= 3;
 	style->grouplabel.shadx= 1;
 	style->grouplabel.shady= -1;
@@ -109,6 +111,7 @@
 	style->widgetlabel.uifont_id= UIFONT_DEFAULT;
 	style->widgetlabel.points= 11;
 	style->widgetlabel.kerning= 0.0;
+	style->widgetlabel.overlap= 0;
 	style->widgetlabel.shadow= 3;
 	style->widgetlabel.shadx= 1;
 	style->widgetlabel.shady= -1;
@@ -171,10 +174,15 @@
 		BLF_shadow_offset(fs->shadx, fs->shady);
 	}
 
+	if (fs->overlap)
+		BLF_enable(BLF_OVERLAP_CHAR);
+
 	BLF_draw(str);
 	BLF_disable(BLF_CLIPPING);
 	if (fs->shadow)
 		BLF_disable(BLF_SHADOW);
+	if (fs->overlap)
+		BLF_disable(BLF_OVERLAP_CHAR);
 }
 
 /* ************** helpers ************************ */

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h	2009-06-23 18:26:01 UTC (rev 21114)
@@ -67,7 +67,8 @@
 	short uifont_id;		/* saved in file, 0 is default */
 	short points;			/* actual size depends on 'global' dpi */
 	float kerning;			/* kerning space between characters. */
-	float pad;
+	short overlap;			/* check overlaped characters. */
+	short pad;
 	short italic, bold;		/* style hint */
 	short shadow;			/* value is amount of pixels blur */
 	short shadx, shady;		/* shadow offset in pixels */

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c	2009-06-23 17:52:58 UTC (rev 21113)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c	2009-06-23 18:26:01 UTC (rev 21114)
@@ -139,9 +139,14 @@
 
 	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_ui_text(prop, "Kerning", "User kerning value in pixels");
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
+	prop= RNA_def_property(srna, "overlap", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "overlap", 1);
+	RNA_def_property_ui_text(prop, "Overlap", "Check for overlap characters");
+	RNA_def_property_update(prop, NC_WINDOW, NULL);
+
 	prop= RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 5);
 	RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size in pixels (0, 3 and 5 supported)");





More information about the Bf-blender-cvs mailing list