Skip to content

Commit

Permalink
Merge pull request #79705 from 398utubzyt/gui/snap-charfx-fix
Browse files Browse the repository at this point in the history
GUI: Snap CharFX offset to nearest pixel when setting is enabled
  • Loading branch information
akien-mga committed Aug 2, 2023
2 parents 1cc377b + aac2dfc commit 3e958cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,10 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
}
}

if (is_inside_tree() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) {
fx_offset = fx_offset.round();
}

// Draw glyph outlines.
const Color modulated_outline_color = font_outline_color * Color(1, 1, 1, font_color.a);
const Color modulated_shadow_color = font_shadow_color * Color(1, 1, 1, font_color.a);
Expand Down Expand Up @@ -1329,6 +1333,10 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
}
}

if (is_inside_tree() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) {
fx_offset = fx_offset.round();
}

if (selected && use_selected_font_color) {
font_color = theme_cache.font_selected_color;
}
Expand Down

0 comments on commit 3e958cf

Please sign in to comment.