Fix font sub-pixel AA impacting character spacing when AA is disabled

This commit is contained in:
Campbell Barton
2024-01-17 18:36:54 +11:00
parent 5149aed4ac
commit ae29c8d950
3 changed files with 10 additions and 4 deletions
+5 -1
View File
@@ -375,7 +375,11 @@ 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 sub-pixel positions. */
/**
* At small sizes glyphs are rendered at multiple sub-pixel positions.
*
* \note Can be checked without checking #BLF_MONOSPACED which can be assumed to be disabled.
*/
BLF_RENDER_SUBPIXELAA = 1 << 18,
};
+1 -1
View File
@@ -1322,7 +1322,7 @@ 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_RENDER_SUBPIXELAA) || (font->flags & BLF_MONOCHROME)) {
if (!(font->flags & BLF_RENDER_SUBPIXELAA)) {
/* Not if we are in mono mode (aliased) or the feature is turned off. */
return g;
}
@@ -460,8 +460,10 @@ 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;
else {
if (U.text_render & USER_TEXT_RENDER_SUBPIXELAA) {
flag_enable |= BLF_RENDER_SUBPIXELAA;
}
}
LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {