1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-07 17:36:07 +00:00

[TextServer] Fix outline size and image fonts with oversampling.

This commit is contained in:
Pāvels Nadtočajevs
2025-04-28 19:10:56 +03:00
parent 67c96c89cc
commit 6893b2b8e6
2 changed files with 27 additions and 11 deletions

View File

@@ -2805,8 +2805,12 @@ void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
}
}
bool skip_oversampling = fd->msdf || fd->fixed_size > 0;
uint64_t oversampling_level = CLAMP(oversampling_factor, 0.1, 100.0) * 64;
oversampling_factor = double(oversampling_level) / 64.0;
if (skip_oversampling) {
oversampling_factor = 1.0;
} else {
uint64_t oversampling_level = CLAMP(oversampling_factor, 0.1, 100.0) * 64;
oversampling_factor = double(oversampling_level) / 64.0;
}
Vector2i size;
if (skip_oversampling) {
@@ -2945,14 +2949,18 @@ void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const R
}
}
bool skip_oversampling = fd->msdf || fd->fixed_size > 0;
uint64_t oversampling_level = CLAMP(oversampling_factor, 0.1, 100.0) * 64;
oversampling_factor = double(oversampling_level) / 64.0;
if (skip_oversampling) {
oversampling_factor = 1.0;
} else {
uint64_t oversampling_level = CLAMP(oversampling_factor, 0.1, 100.0) * 64;
oversampling_factor = double(oversampling_level) / 64.0;
}
Vector2i size;
if (skip_oversampling) {
size = _get_size_outline(fd, Vector2i(p_size, p_outline_size));
} else {
size = Vector2i(p_size * 64 * oversampling_factor, p_outline_size);
size = Vector2i(p_size * 64 * oversampling_factor, p_outline_size * oversampling_factor);
}
FontForSizeFallback *ffsd = nullptr;