瀏覽代碼

Merge pull request #64744 from bruvzg/fix_mixed_font_color4

[4.x] Fix color modulation of the grayscale glyphs in font with mixed color / grayscale data.
Rémi Verschelde 3 年之前
父節點
當前提交
230225d360
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      modules/text_server_adv/text_server_adv.cpp
  2. 1 1
      modules/text_server_fb/text_server_fb.cpp

+ 1 - 1
modules/text_server_adv/text_server_adv.cpp

@@ -3065,7 +3065,7 @@ void TextServerAdvanced::font_draw_glyph(const RID &p_font_rid, const RID &p_can
 		if (gl.texture_idx != -1) {
 			Color modulate = p_color;
 #ifdef MODULE_FREETYPE_ENABLED
-			if (fd->cache[size]->face && FT_HAS_COLOR(fd->cache[size]->face)) {
+			if (fd->cache[size]->face && fd->cache[size]->textures[gl.texture_idx].format == Image::FORMAT_RGBA8) {
 				modulate.r = modulate.g = modulate.b = 1.0;
 			}
 #endif

+ 1 - 1
modules/text_server_fb/text_server_fb.cpp

@@ -2122,7 +2122,7 @@ void TextServerFallback::font_draw_glyph(const RID &p_font_rid, const RID &p_can
 		if (gl.texture_idx != -1) {
 			Color modulate = p_color;
 #ifdef MODULE_FREETYPE_ENABLED
-			if (fd->cache[size]->face && FT_HAS_COLOR(fd->cache[size]->face)) {
+			if (fd->cache[size]->face && fd->cache[size]->textures[gl.texture_idx].format == Image::FORMAT_RGBA8) {
 				modulate.r = modulate.g = modulate.b = 1.0;
 			}
 #endif