1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fix fixed size image fonts incorrectly getting oversampling applied if set to native size.

This commit is contained in:
Pāvels Nadtočajevs
2025-04-15 13:39:48 +03:00
parent e5ccaa79e2
commit a3943f8ad4
2 changed files with 44 additions and 36 deletions

View File

@@ -3956,7 +3956,8 @@ void TextServerAdvanced::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
}
Vector2 gpos = fgl.rect.position;
Size2 csize = fgl.rect.size;
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE && size.x != p_size * 64) {
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE) {
if (size.x != p_size * 64) {
if (fd->fixed_size_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
double gl_scale = (double)p_size / (double)fd->fixed_size;
gpos *= gl_scale;
@@ -3966,6 +3967,7 @@ void TextServerAdvanced::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
gpos *= gl_scale;
csize *= gl_scale;
}
}
} else {
gpos /= oversampling_factor;
csize /= oversampling_factor;
@@ -4090,7 +4092,8 @@ void TextServerAdvanced::_font_draw_glyph_outline(const RID &p_font_rid, const R
}
Vector2 gpos = fgl.rect.position;
Size2 csize = fgl.rect.size;
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE && size.x != p_size * 64) {
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE) {
if (size.x != p_size * 64) {
if (fd->fixed_size_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
double gl_scale = (double)p_size / (double)fd->fixed_size;
gpos *= gl_scale;
@@ -4100,6 +4103,7 @@ void TextServerAdvanced::_font_draw_glyph_outline(const RID &p_font_rid, const R
gpos *= gl_scale;
csize *= gl_scale;
}
}
} else {
gpos /= oversampling_factor;
csize /= oversampling_factor;

View File

@@ -2896,7 +2896,8 @@ void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
}
Vector2 gpos = fgl.rect.position;
Size2 csize = fgl.rect.size;
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE && size.x != p_size * 64) {
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE) {
if (size.x != p_size * 64) {
if (fd->fixed_size_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
double gl_scale = (double)p_size / (double)fd->fixed_size;
gpos *= gl_scale;
@@ -2906,6 +2907,7 @@ void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
gpos *= gl_scale;
csize *= gl_scale;
}
}
} else {
gpos /= oversampling_factor;
csize /= oversampling_factor;
@@ -3030,7 +3032,8 @@ void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const R
}
Vector2 gpos = fgl.rect.position;
Size2 csize = fgl.rect.size;
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE && size.x != p_size * 64) {
if (fd->fixed_size > 0 && fd->fixed_size_scale_mode != FIXED_SIZE_SCALE_DISABLE) {
if (size.x != p_size * 64) {
if (fd->fixed_size_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
double gl_scale = (double)p_size / (double)fd->fixed_size;
gpos *= gl_scale;
@@ -3040,6 +3043,7 @@ void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const R
gpos *= gl_scale;
csize *= gl_scale;
}
}
} else {
gpos /= oversampling_factor;
csize /= oversampling_factor;