UI: use text hinting (now user preference)
D3201 by @ambient w/ edits not to impact fonts used for rendering (only change display for UI text).
This commit is contained in:
@@ -539,6 +539,8 @@ class USERPREF_PT_system(Panel):
|
||||
|
||||
col.label(text="Text Draw Options:")
|
||||
col.prop(system, "use_text_antialiasing")
|
||||
if system.use_text_antialiasing:
|
||||
col.prop(system, "use_text_hinting")
|
||||
|
||||
col.separator()
|
||||
|
||||
|
@@ -521,6 +521,28 @@ void uiStyleInit(void)
|
||||
|
||||
BLF_size(blf_mono_font, 12 * U.pixelsize, 72);
|
||||
|
||||
/* Set default flags based on UI preferences (not render fonts) */
|
||||
{
|
||||
int flag_enable = 0, flag_disable = 0;
|
||||
if ((U.text_render & USER_TEXT_DISABLE_HINTING) == 0) {
|
||||
flag_enable |= BLF_HINTING;
|
||||
}
|
||||
else {
|
||||
flag_disable |= BLF_HINTING;
|
||||
}
|
||||
|
||||
for (font = U.uifonts.first; font; font = font->next) {
|
||||
if (font->blf_id != -1) {
|
||||
BLF_enable(font->blf_id, flag_enable);
|
||||
BLF_disable(font->blf_id, flag_disable);
|
||||
}
|
||||
}
|
||||
if (blf_mono_font != -1) {
|
||||
BLF_enable(blf_mono_font, flag_enable);
|
||||
BLF_disable(blf_mono_font, flag_disable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Second for rendering else we get threading problems,
|
||||
*
|
||||
|
@@ -804,7 +804,8 @@ typedef enum eWM_DrawMethod {
|
||||
/* text draw options
|
||||
* UserDef.text_render */
|
||||
typedef enum eText_Draw_Options {
|
||||
USER_TEXT_DISABLE_AA = (1 << 0),
|
||||
USER_TEXT_DISABLE_AA = (1 << 0),
|
||||
USER_TEXT_DISABLE_HINTING = (1 << 1),
|
||||
} eText_Draw_Options;
|
||||
|
||||
/* tw_flag (transform widget) */
|
||||
|
@@ -447,6 +447,7 @@ static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
|
||||
static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
BLF_cache_clear();
|
||||
UI_reinit_font();
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
}
|
||||
|
||||
@@ -4212,6 +4213,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_text_antialiasing_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_text_hinting", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_HINTING);
|
||||
RNA_def_property_ui_text(prop, "Text Hinting", "Draw user interface text with hinting");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
|
||||
|
||||
prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method");
|
||||
RNA_def_property_enum_items(prop, gpu_select_method_items);
|
||||
|
Reference in New Issue
Block a user