projects
/
blender.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5861e52
)
UI: Add back ability to select a custom interface font
author
Campbell Barton <ideasman42@gmail.com>
Fri, 13 Jun 2014 16:23:32 +0000
(
02:23
+1000)
committer
Campbell Barton <ideasman42@gmail.com>
Fri, 13 Jun 2014 16:32:38 +0000
(
02:32
+1000)
release/scripts/startup/bl_ui/space_userpref.py
patch
|
blob
|
history
source/blender/blenfont/BLF_api.h
patch
|
blob
|
history
source/blender/blenfont/intern/blf.c
patch
|
blob
|
history
source/blender/blenkernel/intern/blender.c
patch
|
blob
|
history
source/blender/editors/interface/interface_style.c
patch
|
blob
|
history
source/blender/makesdna/DNA_userdef_types.h
patch
|
blob
|
history
source/blender/makesrna/intern/rna_userdef.c
patch
|
blob
|
history
diff --git
a/release/scripts/startup/bl_ui/space_userpref.py
b/release/scripts/startup/bl_ui/space_userpref.py
index bc478ed8713cde504f597ee549530cd205f9408b..31ca972726e4fb493571dc955977bb2577b33b67 100644
(file)
--- a/
release/scripts/startup/bl_ui/space_userpref.py
+++ b/
release/scripts/startup/bl_ui/space_userpref.py
@@
-487,8
+487,10
@@
class USERPREF_PT_system(Panel):
sub.active = system.use_weight_color_range
sub.template_color_ramp(system, "weight_color_range", expand=True)
sub.active = system.use_weight_color_range
sub.template_color_ramp(system, "weight_color_range", expand=True)
+ column.separator()
+ column.prop(system, "font_path_ui")
+
if bpy.app.build_options.international:
if bpy.app.build_options.international:
- column.separator()
column.prop(system, "use_international_fonts")
if system.use_international_fonts:
column.prop(system, "language")
column.prop(system, "use_international_fonts")
if system.use_international_fonts:
column.prop(system, "language")
diff --git
a/source/blender/blenfont/BLF_api.h
b/source/blender/blenfont/BLF_api.h
index fd80e1293ee2d6227b353fc47fe38787a903cacf..206345582b2c4beb00e41019d6bf64eb6fbd7a78 100644
(file)
--- a/
source/blender/blenfont/BLF_api.h
+++ b/
source/blender/blenfont/BLF_api.h
@@
-40,6
+40,7
@@
struct ColorManagedDisplay;
int BLF_init(int points, int dpi);
void BLF_exit(void);
void BLF_default_dpi(int dpi);
int BLF_init(int points, int dpi);
void BLF_exit(void);
void BLF_default_dpi(int dpi);
+void BLF_default_set(int fontid);
void BLF_cache_clear(void);
void BLF_cache_clear(void);
@@
-50,6
+51,7
@@
int BLF_load_unique(const char *name) ATTR_NONNULL();
int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL();
void BLF_unload(const char *name) ATTR_NONNULL();
int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL();
void BLF_unload(const char *name) ATTR_NONNULL();
+void BLF_unload_id(int fontid);
/* Attach a file with metrics information from memory. */
void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size);
/* Attach a file with metrics information from memory. */
void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size);
diff --git
a/source/blender/blenfont/intern/blf.c
b/source/blender/blenfont/intern/blf.c
index 235d8ecbf4644aa31a0cf8b121a609826432c1a6..cdccbe044bba742cb39c10b8177fe7d60eb0c52e 100644
(file)
--- a/
source/blender/blenfont/intern/blf.c
+++ b/
source/blender/blenfont/intern/blf.c
@@
-152,6
+152,14
@@
static int blf_search_available(void)
return -1;
}
return -1;
}
+void BLF_default_set(int fontid)
+{
+ FontBLF *font = blf_get(fontid);
+ if (font || fontid == -1) {
+ global_font_default = fontid;
+ }
+}
+
static int blf_global_font_init(void)
{
if (global_font_default == -1) {
static int blf_global_font_init(void)
{
if (global_font_default == -1) {
@@
-335,6
+343,15
@@
void BLF_unload(const char *name)
}
}
}
}
+void BLF_unload_id(int fontid)
+{
+ FontBLF *font = blf_get(fontid);
+ if (font) {
+ blf_font_free(font);
+ global_font[fontid] = NULL;
+ }
+}
+
void BLF_enable(int fontid, int option)
{
FontBLF *font = blf_get(fontid);
void BLF_enable(int fontid, int option)
{
FontBLF *font = blf_get(fontid);
diff --git
a/source/blender/blenkernel/intern/blender.c
b/source/blender/blenkernel/intern/blender.c
index 8b87f5b0ceab3959baf5bf1032c844a0d4db348d..38a180f85bcac954f150fcee0ff406aad5985cd8 100644
(file)
--- a/
source/blender/blenkernel/intern/blender.c
+++ b/
source/blender/blenkernel/intern/blender.c
@@
-384,6
+384,7
@@
void BKE_userdef_free(void)
wmKeyMapItem *kmi;
wmKeyMapDiffItem *kmdi;
bAddon *addon, *addon_next;
wmKeyMapItem *kmi;
wmKeyMapDiffItem *kmdi;
bAddon *addon, *addon_next;
+ uiFont *font;
for (km = U.user_keymaps.first; km; km = km->next) {
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
for (km = U.user_keymaps.first; km; km = km->next) {
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
@@
-413,6
+414,12
@@
void BKE_userdef_free(void)
MEM_freeN(addon);
}
MEM_freeN(addon);
}
+ for (font = U.uifonts.first; font; font = font->next) {
+ BLF_unload_id(font->blf_id);
+ }
+
+ BLF_default_set(-1);
+
BLI_freelistN(&U.autoexec_paths);
BLI_freelistN(&U.uistyles);
BLI_freelistN(&U.autoexec_paths);
BLI_freelistN(&U.uistyles);
diff --git
a/source/blender/editors/interface/interface_style.c
b/source/blender/editors/interface/interface_style.c
index fa31c20eb747ab435eb52250765adf8a2eba5267..e04f13bd458c9af2c18316e3408ba794d9c9480f 100644
(file)
--- a/
source/blender/editors/interface/interface_style.c
+++ b/
source/blender/editors/interface/interface_style.c
@@
-340,11
+340,23
@@
void uiStyleInit(void)
U.dpi = 72;
CLAMP(U.dpi, 48, 144);
U.dpi = 72;
CLAMP(U.dpi, 48, 144);
+ for (font = U.uifonts.first; font; font = font->next) {
+ BLF_unload_id(font->blf_id);
+ }
+
+ font = U.uifonts.first;
+
/* default builtin */
if (font == NULL) {
font = MEM_callocN(sizeof(uiFont), "ui font");
BLI_addtail(&U.uifonts, font);
/* default builtin */
if (font == NULL) {
font = MEM_callocN(sizeof(uiFont), "ui font");
BLI_addtail(&U.uifonts, font);
-
+ }
+
+ if (U.font_path_ui[0]) {
+ BLI_strncpy(font->filename, U.font_path_ui, sizeof(font->filename));
+ font->uifont_id = UIFONT_CUSTOM1;
+ }
+ else {
BLI_strncpy(font->filename, "default", sizeof(font->filename));
font->uifont_id = UIFONT_DEFAULT;
}
BLI_strncpy(font->filename, "default", sizeof(font->filename));
font->uifont_id = UIFONT_DEFAULT;
}
@@
-381,8
+393,12
@@
void uiStyleInit(void)
}
else {
font->blf_id = BLF_load(font->filename);
}
else {
font->blf_id = BLF_load(font->filename);
- if (font->blf_id == -1)
+ if (font->blf_id == -1)
{
font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+ }
+ else {
+ BLF_default_set(font->blf_id);
+ }
}
if (font->blf_id == -1) {
}
if (font->blf_id == -1) {
diff --git
a/source/blender/makesdna/DNA_userdef_types.h
b/source/blender/makesdna/DNA_userdef_types.h
index 4f5670d16c1786709b01e77cb99dd7e00bfda805..987985f0ba7cb22cd317c679b1072187464097f7 100644
(file)
--- a/
source/blender/makesdna/DNA_userdef_types.h
+++ b/
source/blender/makesdna/DNA_userdef_types.h
@@
-521,6
+521,8
@@
typedef struct UserDef {
char author[80]; /* author name for file formats supporting it */
char author[80]; /* author name for file formats supporting it */
+ char font_path_ui[1024];
+
int compute_device_type;
int compute_device_id;
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 7c101fb19be0bd881af14173f86510547fccc89b..7fa7571c32d919dc85058b37c62e76ed5b3c6534 100644
(file)
--- a/
source/blender/makesrna/intern/rna_userdef.c
+++ b/
source/blender/makesrna/intern/rna_userdef.c
@@
-3707,7
+3707,12
@@
static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_range(prop, 48, 144);
RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
RNA_def_property_range(prop, 48, 144);
RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
+
+ prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
+ 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, "scrollback", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "scrollback");
RNA_def_property_range(prop, 32, 32768);
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);