Perfect FreeType-based outlines for DynamicFonts
- Implement outlines based on FreeType Stroker API. This allows artifact-free results, similar to what you will see in Web or any text editing tools. Outline is a part of DynamicFont rather than Label, because outlines have to be baked into the font's atlas. Font has a default outline_color and a Label can specify font_outline_modulator that will be multiplied with the Font's color to get the final result. - draw_char now has to be called twice to fully render a text - first with p_outline == true for each character and then with p_outline == false for each character. - Number of draw-calls is reduced from 5 to 2 per outlined character. - Overall cleanup of DynamicFont code, extracted duplicated code pieces into separate methods. - The change is backward-compatible - Labels still have outline properties that work exactly as they worked before. Closes #16279.
This commit is contained in:
@@ -415,6 +415,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
||||
|
||||
theme->set_color("font_color", "Label", Color(1, 1, 1));
|
||||
theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
|
||||
theme->set_color("font_outline_modulator", "Label", Color(1, 1, 1));
|
||||
|
||||
theme->set_constant("shadow_offset_x", "Label", 1 * scale);
|
||||
theme->set_constant("shadow_offset_y", "Label", 1 * scale);
|
||||
|
||||
Reference in New Issue
Block a user