[Bf-blender-cvs] [6783c67] master: UI: mono-space font user preference
Campbell Barton
noreply at git.blender.org
Tue Dec 1 07:06:04 CET 2015
Commit: 6783c673e6457399ef2cb0c5ee65fcfe8a1d07f0
Author: Campbell Barton
Date: Tue Dec 1 16:57:52 2015 +1100
Branches: master
https://developer.blender.org/rB6783c673e6457399ef2cb0c5ee65fcfe8a1d07f0
UI: mono-space font user preference
===================================================================
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/editors/interface/interface_style.c
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index d8b033b..70cfec9 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -527,6 +527,7 @@ class USERPREF_PT_system(Panel):
column.separator()
column.prop(system, "font_path_ui")
+ column.prop(system, "font_path_ui_mono")
if bpy.app.build_options.international:
column.prop(system, "use_international_fonts")
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 25a187c..6ce2924 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -410,6 +410,11 @@ void uiStyleInit(void)
BLF_unload_id(font->blf_id);
}
+ if (blf_mono_font != -1) {
+ BLF_unload_id(blf_mono_font);
+ blf_mono_font = -1;
+ }
+
font = U.uifonts.first;
/* default builtin */
@@ -498,14 +503,17 @@ void uiStyleInit(void)
}
/* reload */
- BLF_unload("monospace");
- blf_mono_font = -1;
blf_mono_font_render = -1;
#endif
/* XXX, this should be moved into a style, but for now best only load the monospaced font once. */
- if (blf_mono_font == -1)
+ BLI_assert(blf_mono_font == -1);
+ if (U.font_path_ui_mono[0]) {
+ blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
+ }
+ if (blf_mono_font == -1) {
blf_mono_font = BLF_load_mem_unique("monospace", monofont_ttf, monofont_size);
+ }
BLF_size(blf_mono_font, 12 * U.pixelsize, 72);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 4beeaa8..f0b8e04 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -545,6 +545,7 @@ typedef struct UserDef {
char author[80]; /* author name for file formats supporting it */
char font_path_ui[1024];
+ char font_path_ui_mono[1024];
int compute_device_type;
int compute_device_id;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 90202a6..34768cf 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4000,6 +4000,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font");
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+ prop = RNA_def_property(srna, "font_path_ui_mono", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "font_path_ui_mono");
+ RNA_def_property_ui_text(prop, "Monospace Font", "Path to interface monospace Font");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+
prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "scrollback");
RNA_def_property_range(prop, 32, 32768);
More information about the Bf-blender-cvs
mailing list