mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #105412 from bruvzg/fix_fixedsize_img_fonts
Fix fixed size image fonts incorrectly getting oversampling applied if set to native size.
This commit is contained in:
commit
146e405c48
2 changed files with 44 additions and 36 deletions
|
@ -3956,15 +3956,17 @@ 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_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
|
||||
double gl_scale = (double)p_size / (double)fd->fixed_size;
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
} else {
|
||||
double gl_scale = Math::round((double)p_size / (double)fd->fixed_size);
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
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;
|
||||
csize *= gl_scale;
|
||||
} else {
|
||||
double gl_scale = Math::round((double)p_size / (double)fd->fixed_size);
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gpos /= oversampling_factor;
|
||||
|
@ -4090,15 +4092,17 @@ 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_scale_mode == FIXED_SIZE_SCALE_ENABLED) {
|
||||
double gl_scale = (double)p_size / (double)fd->fixed_size;
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
} else {
|
||||
double gl_scale = Math::round((double)p_size / (double)fd->fixed_size);
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
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;
|
||||
csize *= gl_scale;
|
||||
} else {
|
||||
double gl_scale = Math::round((double)p_size / (double)fd->fixed_size);
|
||||
gpos *= gl_scale;
|
||||
csize *= gl_scale;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gpos /= oversampling_factor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue