Merge branch 'blender-v4.0-release'

This commit is contained in:
Harley Acheson
2023-09-29 10:05:47 -07:00
7 changed files with 21 additions and 3 deletions

View File

@@ -235,6 +235,7 @@ class USERPREF_PT_interface_text(InterfacePanel, CenterAlignMixIn, Panel):
flow.prop(view, "use_text_antialiasing", text="Anti-Aliasing")
sub = flow.column()
sub.active = view.use_text_antialiasing
sub.prop(view, "use_text_render_subpixelaa", text="Subpixel Anti-Aliasing")
sub.prop(view, "text_hinting", text="Hinting")
flow.prop(view, "font_path_ui")

View File

@@ -349,6 +349,8 @@ enum {
BLF_BAD_FONT = 1 << 16,
/** This font is managed by the FreeType cache subsystem. */
BLF_CACHED = 1 << 17,
/** At small sizes glyphs are rendered at multiple subpixel positions. */
BLF_RENDER_SUBPIXELAA = 1 << 18,
};
#define BLF_DRAW_STR_DUMMY_MAX 1024

View File

@@ -1121,8 +1121,8 @@ GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode
#ifdef BLF_SUBPIXEL_AA
GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
{
if ((font->flags & (BLF_HINTING_NONE | BLF_MONOCHROME)) != 0) {
/* Not if we are in mono mode (aliased) or if not hinting. */
if (!(font->flags & BLF_RENDER_SUBPIXELAA) || (font->flags & BLF_MONOCHROME)) {
/* Not if we are in mono mode (aliased) or the feature is turned off. */
return g;
}

View File

@@ -881,6 +881,10 @@ void blo_do_versions_userdef(UserDef *userdef)
userdef->animation_flag |= USER_ANIM_SHOW_CHANNEL_GROUP_COLORS;
}
if (!USER_VERSION_ATLEAST(400, 32)) {
userdef->text_render |= USER_TEXT_RENDER_SUBPIXELAA;
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@@ -440,7 +440,7 @@ void uiStyleInit()
/* Set default flags based on UI preferences (not render fonts) */
{
const int flag_disable = (BLF_MONOCHROME | BLF_HINTING_NONE | BLF_HINTING_SLIGHT |
BLF_HINTING_FULL);
BLF_HINTING_FULL | BLF_RENDER_SUBPIXELAA);
int flag_enable = 0;
if (U.text_render & USER_TEXT_HINTING_NONE) {
@@ -456,6 +456,9 @@ void uiStyleInit()
if (U.text_render & USER_TEXT_DISABLE_AA) {
flag_enable |= BLF_MONOCHROME;
}
if (U.text_render & USER_TEXT_RENDER_SUBPIXELAA) {
flag_enable |= BLF_RENDER_SUBPIXELAA;
}
LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
if (font->blf_id != -1) {

View File

@@ -1338,6 +1338,8 @@ typedef enum eText_Draw_Options {
USER_TEXT_HINTING_NONE = (1 << 1),
USER_TEXT_HINTING_SLIGHT = (1 << 2),
USER_TEXT_HINTING_FULL = (1 << 3),
USER_TEXT_RENDER_SUBPIXELAA = (1 << 4),
} eText_Draw_Options;
/**

View File

@@ -5180,6 +5180,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop, "Text Anti-Aliasing", "Smooth jagged edges of user interface text");
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
prop = RNA_def_property(srna, "use_text_render_subpixelaa", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "text_render", USER_TEXT_RENDER_SUBPIXELAA);
RNA_def_property_ui_text(
prop, "Text Subpixel Anti-Aliasing", "Render text for optimal horizontal placement");
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
prop = RNA_def_property(srna, "text_hinting", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "text_render");
RNA_def_property_enum_items(prop, text_hinting_items);