diff options
Diffstat (limited to 'scene/resources')
25 files changed, 2180 insertions, 2089 deletions
diff --git a/scene/resources/default_theme/arrow_left.png b/scene/resources/default_theme/arrow_left.png Binary files differnew file mode 100644 index 0000000000..4163059dd3 --- /dev/null +++ b/scene/resources/default_theme/arrow_left.png diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index f65f78b332..1d92ed4830 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -38,6 +38,8 @@ #include "font_hidpi.inc" #include "font_lodpi.inc" +#include "servers/text_server.h" + typedef Map<const void *, Ref<ImageTexture>> TexCacheMap; static TexCacheMap *tex_cache; @@ -95,40 +97,6 @@ static Ref<Texture2D> make_icon(T p_src) { return texture; } -static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_charcount, const int *p_char_rects, int p_kerning_count, const int *p_kernings, int p_w, int p_h, const unsigned char *p_img) { - Ref<BitmapFont> font(memnew(BitmapFont)); - - Ref<Image> image = memnew(Image(p_img)); - Ref<ImageTexture> tex = memnew(ImageTexture); - tex->create_from_image(image); - - font->add_texture(tex); - - for (int i = 0; i < p_charcount; i++) { - const int *c = &p_char_rects[i * 8]; - - int chr = c[0]; - Rect2 frect; - frect.position.x = c[1]; - frect.position.y = c[2]; - frect.size.x = c[3]; - frect.size.y = c[4]; - Point2 align(c[6], c[5]); - int advance = c[7]; - - font->add_char(chr, 0, frect, align, advance); - } - - for (int i = 0; i < p_kerning_count; i++) { - font->add_kerning_pair(p_kernings[i * 3 + 0], p_kernings[i * 3 + 1], p_kernings[i * 3 + 2]); - } - - font->set_height(p_height); - font->set_ascent(p_ascent); - - return font; -} - static Ref<StyleBox> make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1) { Ref<StyleBox> style(memnew(StyleBoxEmpty)); @@ -182,11 +150,14 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("focus", "Button", sb_button_focus); theme->set_font("font", "Button", Ref<Font>()); + theme->set_font_size("font_size", "Button", -1); + theme->set_constant("outline_size", "Button", 0 * scale); theme->set_color("font_color", "Button", control_font_color); theme->set_color("font_color_pressed", "Button", control_font_color_pressed); theme->set_color("font_color_hover", "Button", control_font_color_hover); theme->set_color("font_color_disabled", "Button", control_font_color_disabled); + theme->set_color("font_outline_modulate", "Button", Color(1, 1, 1)); theme->set_constant("hseparation", "Button", 2 * scale); @@ -195,6 +166,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("focus", "LinkButton", focus); theme->set_font("font", "LinkButton", Ref<Font>()); + theme->set_font_size("font_size", "LinkButton", -1); theme->set_color("font_color", "LinkButton", control_font_color); theme->set_color("font_color_pressed", "LinkButton", control_font_color_pressed); @@ -211,6 +183,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("focus", "ColorPickerButton", sb_button_focus); theme->set_font("font", "ColorPickerButton", Ref<Font>()); + theme->set_font_size("font_size", "ColorPickerButton", -1); theme->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1)); theme->set_color("font_color_pressed", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1)); @@ -221,21 +194,33 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // OptionButton + Ref<StyleBox> sb_optbutton_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); + theme->set_stylebox("focus", "OptionButton", sb_optbutton_focus); + Ref<StyleBox> sb_optbutton_normal = sb_expand(make_stylebox(option_button_normal_png, 4, 4, 21, 4, 6, 3, 9, 3), 2, 2, 2, 2); Ref<StyleBox> sb_optbutton_pressed = sb_expand(make_stylebox(option_button_pressed_png, 4, 4, 21, 4, 6, 3, 9, 3), 2, 2, 2, 2); Ref<StyleBox> sb_optbutton_hover = sb_expand(make_stylebox(option_button_hover_png, 4, 4, 21, 4, 6, 2, 9, 2), 2, 2, 2, 2); Ref<StyleBox> sb_optbutton_disabled = sb_expand(make_stylebox(option_button_disabled_png, 4, 4, 21, 4, 6, 2, 9, 2), 2, 2, 2, 2); - Ref<StyleBox> sb_optbutton_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); theme->set_stylebox("normal", "OptionButton", sb_optbutton_normal); theme->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed); theme->set_stylebox("hover", "OptionButton", sb_optbutton_hover); theme->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled); - theme->set_stylebox("focus", "OptionButton", sb_optbutton_focus); + + Ref<StyleBox> sb_optbutton_normal_mirrored = sb_expand(make_stylebox(option_button_normal_mirrored_png, 21, 4, 4, 4, 9, 3, 6, 3), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_pressed_mirrored = sb_expand(make_stylebox(option_button_pressed_mirrored_png, 21, 4, 4, 4, 9, 3, 6, 3), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_hover_mirrored = sb_expand(make_stylebox(option_button_hover_mirrored_png, 21, 4, 4, 4, 9, 2, 6, 2), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_disabled_mirrored = sb_expand(make_stylebox(option_button_disabled_mirrored_png, 21, 4, 4, 4, 9, 2, 6, 2), 2, 2, 2, 2); + + theme->set_stylebox("normal_mirrored", "OptionButton", sb_optbutton_normal_mirrored); + theme->set_stylebox("pressed_mirrored", "OptionButton", sb_optbutton_pressed_mirrored); + theme->set_stylebox("hover_mirrored", "OptionButton", sb_optbutton_hover_mirrored); + theme->set_stylebox("disabled_mirrored", "OptionButton", sb_optbutton_disabled_mirrored); theme->set_icon("arrow", "OptionButton", make_icon(option_arrow_png)); theme->set_font("font", "OptionButton", Ref<Font>()); + theme->set_font_size("font_size", "OptionButton", -1); theme->set_color("font_color", "OptionButton", control_font_color); theme->set_color("font_color_pressed", "OptionButton", control_font_color_pressed); @@ -254,6 +239,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("focus", "MenuButton", sb_button_focus); theme->set_font("font", "MenuButton", Ref<Font>()); + theme->set_font_size("font_size", "MenuButton", -1); theme->set_color("font_color", "MenuButton", control_font_color); theme->set_color("font_color_pressed", "MenuButton", control_font_color_pressed); @@ -288,6 +274,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png)); theme->set_font("font", "CheckBox", Ref<Font>()); + theme->set_font_size("font_size", "CheckBox", -1); theme->set_color("font_color", "CheckBox", control_font_color); theme->set_color("font_color_pressed", "CheckBox", control_font_color_pressed); @@ -318,7 +305,13 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("off", "CheckButton", make_icon(toggle_off_png)); theme->set_icon("off_disabled", "CheckButton", make_icon(toggle_off_disabled_png)); + theme->set_icon("on_mirrored", "CheckButton", make_icon(toggle_on_mirrored_png)); + theme->set_icon("on_disabled_mirrored", "CheckButton", make_icon(toggle_on_disabled_mirrored_png)); + theme->set_icon("off_mirrored", "CheckButton", make_icon(toggle_off_mirrored_png)); + theme->set_icon("off_disabled_mirrored", "CheckButton", make_icon(toggle_off_disabled_mirrored_png)); + theme->set_font("font", "CheckButton", Ref<Font>()); + theme->set_font_size("font_size", "CheckButton", -1); theme->set_color("font_color", "CheckButton", control_font_color); theme->set_color("font_color_pressed", "CheckButton", control_font_color_pressed); @@ -333,6 +326,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("normal", "Label", memnew(StyleBoxEmpty)); theme->set_font("font", "Label", Ref<Font>()); + theme->set_font_size("font_size", "Label", -1); theme->set_color("font_color", "Label", Color(1, 1, 1)); theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0)); @@ -340,7 +334,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_constant("shadow_offset_x", "Label", 1 * scale); theme->set_constant("shadow_offset_y", "Label", 1 * scale); - theme->set_constant("shadow_as_outline", "Label", 0 * scale); + theme->set_constant("outline_size", "Label", 0 * scale); + theme->set_constant("shadow_outline_size", "Label", 1 * scale); theme->set_constant("line_spacing", "Label", 3 * scale); // LineEdit @@ -350,6 +345,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("read_only", "LineEdit", make_stylebox(line_edit_disabled_png, 6, 6, 6, 6)); theme->set_font("font", "LineEdit", Ref<Font>()); + theme->set_font_size("font_size", "LineEdit", -1); theme->set_color("font_color", "LineEdit", control_font_color); theme->set_color("font_color_selected", "LineEdit", Color(0, 0, 0)); @@ -369,6 +365,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("fg", "ProgressBar", make_stylebox(progress_fill_png, 6, 6, 6, 6, 2, 1, 2, 1)); theme->set_font("font", "ProgressBar", Ref<Font>()); + theme->set_font_size("font_size", "ProgressBar", -1); theme->set_color("font_color", "ProgressBar", control_font_color_hover); theme->set_color("font_color_shadow", "ProgressBar", Color(0, 0, 0)); @@ -384,6 +381,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("space", "TextEdit", make_icon(space_png)); theme->set_font("font", "TextEdit", Ref<Font>()); + theme->set_font_size("font_size", "TextEdit", -1); theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0)); theme->set_color("completion_background_color", "TextEdit", Color(0.17, 0.16, 0.2)); @@ -423,6 +421,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("folded", "CodeEdit", make_icon(arrow_right_png)); theme->set_font("font", "CodeEdit", Ref<Font>()); + theme->set_font_size("font_size", "CodeEdit", -1); theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0)); theme->set_color("completion_background_color", "CodeEdit", Color(0.17, 0.16, 0.2)); @@ -563,8 +562,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("radio_checked", "PopupMenu", make_icon(radio_checked_png)); theme->set_icon("radio_unchecked", "PopupMenu", make_icon(radio_unchecked_png)); theme->set_icon("submenu", "PopupMenu", make_icon(submenu_png)); + theme->set_icon("submenu_mirrored", "PopupMenu", make_icon(submenu_mirrored_png)); theme->set_font("font", "PopupMenu", Ref<Font>()); + theme->set_font_size("font_size", "PopupMenu", -1); theme->set_color("font_color", "PopupMenu", control_font_color); theme->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8)); @@ -632,9 +633,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("select_arrow", "Tree", make_icon(dropdown_png)); theme->set_icon("arrow", "Tree", make_icon(arrow_down_png)); theme->set_icon("arrow_collapsed", "Tree", make_icon(arrow_right_png)); + theme->set_icon("arrow_collapsed_mirrored", "Tree", make_icon(arrow_left_png)); theme->set_font("title_button_font", "Tree", Ref<Font>()); theme->set_font("font", "Tree", Ref<Font>()); + theme->set_font_size("font_size", "Tree", -1); theme->set_color("title_button_color", "Tree", control_font_color); theme->set_color("font_color", "Tree", control_font_color_low); @@ -663,7 +666,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_constant("vseparation", "ItemList", 2); theme->set_constant("icon_margin", "ItemList", 4); theme->set_constant("line_separation", "ItemList", 2 * scale); + theme->set_font("font", "ItemList", Ref<Font>()); + theme->set_font_size("font_size", "ItemList", -1); + theme->set_color("font_color", "ItemList", control_font_color_lower); theme->set_color("font_color_selected", "ItemList", control_font_color_pressed); theme->set_color("guide_color", "ItemList", Color(0, 0, 0, 0.1)); @@ -692,6 +698,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("menu_highlight", "TabContainer", make_icon(tab_menu_hl_png)); theme->set_font("font", "TabContainer", Ref<Font>()); + theme->set_font_size("font_size", "TabContainer", -1); theme->set_color("font_color_fg", "TabContainer", control_font_color_hover); theme->set_color("font_color_bg", "TabContainer", control_font_color_low); @@ -716,6 +723,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("close", "Tabs", make_icon(tab_close_png)); theme->set_font("font", "Tabs", Ref<Font>()); + theme->set_font_size("font_size", "Tabs", -1); theme->set_color("font_color_fg", "Tabs", control_font_color_hover); theme->set_color("font_color_bg", "Tabs", control_font_color_low); @@ -775,6 +783,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("panel", "TooltipPanel", style_tt); theme->set_font("font", "TooltipLabel", Ref<Font>()); + theme->set_font_size("font_size", "TooltipLabel", -1); theme->set_color("font_color", "TooltipLabel", Color(0, 0, 0)); theme->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0.1)); @@ -863,12 +872,47 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) { Ref<StyleBox> default_style; Ref<Texture2D> default_icon; Ref<Font> default_font; + int default_font_size = 16; if (p_font.is_valid()) { default_font = p_font; } else if (p_hidpi) { - default_font = make_font(_hidpi_font_height, _hidpi_font_ascent, _hidpi_font_charcount, &_hidpi_font_charrects[0][0], _hidpi_font_kerning_pair_count, &_hidpi_font_kerning_pairs[0][0], _hidpi_font_img_width, _hidpi_font_img_height, _hidpi_font_img_data); + TextServer::BitmapFontData data; + data.height = _hidpi_font_height; + data.ascent = _hidpi_font_ascent; + data.charcount = _hidpi_font_charcount; + data.char_rects = &_hidpi_font_charrects[0][0]; + data.kerning_count = _hidpi_font_kerning_pair_count; + data.kernings = &_hidpi_font_kerning_pairs[0][0]; + data.w = _hidpi_font_img_width; + data.h = _hidpi_font_img_height; + data.img = _hidpi_font_img_data; + + Ref<FontData> font_data; + font_data.instance(); + font_data->load_memory((const uint8_t *)&data, sizeof(data), "fnt"); + default_font_size = font_data->get_base_size(); + + default_font.instance(); + default_font->add_data(font_data); } else { - default_font = make_font(_lodpi_font_height, _lodpi_font_ascent, _lodpi_font_charcount, &_lodpi_font_charrects[0][0], _lodpi_font_kerning_pair_count, &_lodpi_font_kerning_pairs[0][0], _lodpi_font_img_width, _lodpi_font_img_height, _lodpi_font_img_data); + TextServer::BitmapFontData data; + data.height = _lodpi_font_height; + data.ascent = _lodpi_font_ascent; + data.charcount = _lodpi_font_charcount; + data.char_rects = &_lodpi_font_charrects[0][0]; + data.kerning_count = _lodpi_font_kerning_pair_count; + data.kernings = &_lodpi_font_kerning_pairs[0][0]; + data.w = _lodpi_font_img_width; + data.h = _lodpi_font_img_height; + data.img = _lodpi_font_img_data; + + Ref<FontData> font_data; + font_data.instance(); + font_data->load_memory((const uint8_t *)&data, sizeof(data), "fnt"); + default_font_size = font_data->get_base_size(); + + default_font.instance(); + default_font->add_data(font_data); } Ref<Font> large_font = default_font; fill_default_theme(t, default_font, large_font, default_icon, default_style, p_hidpi ? 2.0 : 1.0); @@ -877,6 +921,7 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) { Theme::set_default_icon(default_icon); Theme::set_default_style(default_style); Theme::set_default_font(default_font); + Theme::set_default_font_size(default_font_size); } void clear_default_theme() { diff --git a/scene/resources/default_theme/font_lodpi.inc b/scene/resources/default_theme/font_lodpi.inc index 959e2c1d7b..d2f5851224 100644 --- a/scene/resources/default_theme/font_lodpi.inc +++ b/scene/resources/default_theme/font_lodpi.inc @@ -8,7 +8,7 @@ static const int _lodpi_font_charrects[191][8]={ {224,85,180,5,11,0,1,7}, {192,32,16,11,13,-2,-1,9}, {96,2,216,3,2,0,3,8}, -{160,1734439808,0,0,0,11,0,4}, +{160,0,0,0,0,11,0,4}, {32,0,0,0,0,11,0,4}, {33,65,234,2,10,1,1,4}, {225,112,169,5,11,0,1,7}, diff --git a/scene/resources/default_theme/option_button_disabled_mirrored.png b/scene/resources/default_theme/option_button_disabled_mirrored.png Binary files differnew file mode 100644 index 0000000000..9d149a35ca --- /dev/null +++ b/scene/resources/default_theme/option_button_disabled_mirrored.png diff --git a/scene/resources/default_theme/option_button_hover_mirrored.png b/scene/resources/default_theme/option_button_hover_mirrored.png Binary files differnew file mode 100644 index 0000000000..d49c165645 --- /dev/null +++ b/scene/resources/default_theme/option_button_hover_mirrored.png diff --git a/scene/resources/default_theme/option_button_normal_mirrored.png b/scene/resources/default_theme/option_button_normal_mirrored.png Binary files differnew file mode 100644 index 0000000000..feec848f33 --- /dev/null +++ b/scene/resources/default_theme/option_button_normal_mirrored.png diff --git a/scene/resources/default_theme/option_button_pressed_mirrored.png b/scene/resources/default_theme/option_button_pressed_mirrored.png Binary files differnew file mode 100644 index 0000000000..94cabb18d6 --- /dev/null +++ b/scene/resources/default_theme/option_button_pressed_mirrored.png diff --git a/scene/resources/default_theme/submenu_mirrored.png b/scene/resources/default_theme/submenu_mirrored.png Binary files differnew file mode 100644 index 0000000000..1142b9ba9f --- /dev/null +++ b/scene/resources/default_theme/submenu_mirrored.png diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index a15efb593a..7765348f80 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -6,6 +6,10 @@ static const unsigned char arrow_down_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x4, 0x0, 0x0, 0x0, 0xfc, 0x7c, 0x94, 0x6c, 0x0, 0x0, 0x0, 0x34, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0xa0, 0x32, 0x78, 0xf0, 0x1f, 0x15, 0x52, 0x20, 0xf1, 0x30, 0xee, 0xc1, 0x17, 0xb8, 0xf0, 0xb7, 0x87, 0x69, 0x48, 0xb6, 0xdc, 0xd7, 0xb8, 0x7f, 0x9, 0x2c, 0x7c, 0xfd, 0xb1, 0x2e, 0x9a, 0x3, 0x5e, 0x70, 0x3f, 0x9c, 0xff, 0x70, 0xfe, 0xb, 0x6e, 0x6, 0xea, 0x3, 0x0, 0xfb, 0x81, 0x48, 0xb8, 0x4d, 0xe4, 0x75, 0xd9, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char arrow_left_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x4, 0x0, 0x0, 0x0, 0xfc, 0x7c, 0x94, 0x6c, 0x0, 0x0, 0x0, 0x1, 0x6f, 0x72, 0x4e, 0x54, 0x1, 0xcf, 0xa2, 0x77, 0x9a, 0x0, 0x0, 0x0, 0x59, 0x49, 0x44, 0x41, 0x54, 0x18, 0xd3, 0x63, 0x60, 0xa0, 0x0, 0xdc, 0x4f, 0x78, 0xf0, 0xff, 0xc1, 0xff, 0x7, 0xff, 0x21, 0x3c, 0x46, 0x98, 0xf0, 0x43, 0xed, 0xff, 0x27, 0x19, 0xb8, 0x19, 0x18, 0x18, 0x18, 0x14, 0x18, 0x19, 0x18, 0x18, 0x18, 0x98, 0x20, 0xc2, 0x2f, 0xb8, 0xff, 0xaf, 0x82, 0x8, 0xc3, 0x0, 0x54, 0xe2, 0xe7, 0x14, 0x6, 0x2d, 0x54, 0x83, 0x99, 0x70, 0xd9, 0x8, 0x95, 0x60, 0xcf, 0x61, 0xb8, 0x86, 0x55, 0x42, 0xe2, 0x2b, 0x63, 0x18, 0xc3, 0x57, 0xac, 0x46, 0xc9, 0x5f, 0xfd, 0x9f, 0x43, 0x89, 0x67, 0x19, 0x18, 0x0, 0xf4, 0x30, 0x14, 0x49, 0xef, 0xe6, 0x74, 0x60, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char arrow_right_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x4, 0x0, 0x0, 0x0, 0xfc, 0x7c, 0x94, 0x6c, 0x0, 0x0, 0x0, 0x2e, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x20, 0x17, 0x3c, 0xf8, 0xf, 0x82, 0xf7, 0x13, 0x70, 0x48, 0x3c, 0xf8, 0xf2, 0x50, 0x1b, 0x43, 0x2, 0xa, 0xaf, 0xbe, 0xe0, 0xc6, 0x2e, 0xf1, 0xff, 0xe1, 0x7c, 0x12, 0x24, 0x10, 0x46, 0x11, 0xb6, 0x1c, 0xe1, 0x5c, 0xa, 0x0, 0x0, 0xe0, 0x14, 0x48, 0xb1, 0x3d, 0x1b, 0x7a, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; @@ -214,18 +218,34 @@ static const unsigned char option_button_disabled_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x40, 0xde, 0x8d, 0x6b, 0x0, 0x0, 0x1, 0x2f, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 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, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char option_button_disabled_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x40, 0xde, 0x8d, 0x6b, 0x0, 0x0, 0x1, 0x2f, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2d, 0x2d, 0x34, 0x2b, 0x2b, 0x31, 0x5a, 0x5a, 0x5a, 0x3e, 0x3e, 0x3e, 0x2a, 0x2a, 0x30, 0x59, 0x59, 0x59, 0x22, 0x22, 0x27, 0x4b, 0x4b, 0x4b, 0x22, 0x22, 0x29, 0x24, 0x24, 0x28, 0x4a, 0x4a, 0x4a, 0x36, 0x36, 0x36, 0x2a, 0x2a, 0x30, 0x2c, 0x2c, 0x32, 0x2d, 0x2d, 0x34, 0x2e, 0x2e, 0x35, 0x2f, 0x2f, 0x36, 0x2a, 0x2a, 0x31, 0x62, 0x62, 0x62, 0x56, 0x56, 0x56, 0x23, 0x23, 0x28, 0x25, 0x25, 0x2b, 0x27, 0x27, 0x2d, 0x28, 0x28, 0x2e, 0x29, 0x29, 0x2f, 0x24, 0x24, 0x28, 0x26, 0x26, 0x2b, 0x54, 0x54, 0x54, 0x43, 0x43, 0x43, 0x44, 0x44, 0x44, 0x48, 0x48, 0x48, 0x22, 0x22, 0x26, 0x25, 0x25, 0x2a, 0x2a, 0x2a, 0x2f, 0x2b, 0x2b, 0x31, 0x26, 0x26, 0x2c, 0x22, 0x22, 0x27, 0x2d, 0x2d, 0x33, 0x52, 0x52, 0x52, 0x42, 0x42, 0x42, 0x27, 0x27, 0x2b, 0x29, 0x29, 0x2e, 0x2c, 0x2c, 0x31, 0x2e, 0x2e, 0x34, 0x51, 0x51, 0x51, 0x40, 0x40, 0x40, 0x4f, 0x4f, 0x4f, 0x3f, 0x3f, 0x3f, 0x20, 0x20, 0x25, 0x24, 0x24, 0x29, 0x24, 0x24, 0x2a, 0x4d, 0x4d, 0x4d, 0x3e, 0x3e, 0x3e, 0x20, 0x20, 0x23, 0x29, 0x29, 0x2d, 0x2b, 0x2b, 0x30, 0x28, 0x28, 0x2d, 0x4c, 0x4c, 0x4c, 0x3d, 0x3d, 0x3d, 0x1e, 0x1e, 0x22, 0x27, 0x27, 0x2c, 0x22, 0x22, 0x28, 0x4a, 0x4a, 0x4a, 0x3b, 0x3b, 0x3b, 0x1d, 0x1d, 0x21, 0x20, 0x20, 0x24, 0x23, 0x23, 0x27, 0x21, 0x21, 0x25, 0x21, 0x21, 0x26, 0x3a, 0x3a, 0x3a, 0x49, 0x49, 0x49, 0x1e, 0x1e, 0x21, 0x1f, 0x1f, 0x23, 0x1f, 0x1f, 0x24, 0x47, 0x47, 0x47, 0x39, 0x39, 0x39, 0x46, 0x46, 0x46, 0xda, 0x9d, 0x96, 0x5c, 0x0, 0x0, 0x0, 0x24, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x2, 0x7, 0xd, 0x16, 0x1d, 0x22, 0x24, 0x1f, 0x19, 0x11, 0xa, 0x4, 0x1b, 0x2d, 0x3a, 0x43,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 0x57, 0x49, 0x88, 0x24, 0x70, 0xc, 0x70, 0xcf, 0xcb, 0x17, 0x8c, 0x5, 0x8e, 0x77, 0xc9, 0x79, 0xf1, 0x20, 0x9, 0x80, 0x4, 0xd6, 0x64, 0x50, 0xbb, 0xe2, 0x6a, 0xd2, 0x30, 0xc0, 0xd7, 0xf5, 0x89, 0x19, 0xb4, 0x46, 0xbe, 0x79, 0xc3, 0x35, 0x69, 0x80, 0x6e, 0x15, 0xb8, 0x33, 0xef, 0x99, 0x7, 0x84, 0x5a, 0x6d, 0xae, 0x45, 0x8f, 0xb0, 0x1f, 0xed, 0x86, 0x3f, 0xbe, 0xa6, 0x6f, 0x3f, 0x75, 0x9e, 0xb9, 0xe, 0x1d, 0xd2, 0x78, 0x79, 0xed, 0x62, 0xf0, 0x19, 0xdc, 0xeb, 0x17, 0xdf, 0xb8, 0x77, 0x7a, 0xcd, 0xed, 0x8f, 0xcf, 0x5e, 0xb7, 0x8e, 0x19, 0xe5, 0xab, 0x3f, 0xf8, 0x66, 0xda, 0x3b, 0xf4, 0xa1, 0x76, 0xf7, 0x90, 0xe3, 0x8e, 0x67, 0x70, 0x1, 0xbc, 0x9f, 0x91, 0xc1, 0xfe, 0x1, 0x7d, 0xea, 0x7f, 0x3f, 0xeb, 0xef, 0xef, 0xfe, 0x5, 0xd6, 0xe3, 0x56, 0x89, 0xd8, 0x62, 0xb6, 0x83, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char option_button_hover_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x40, 0xde, 0x8d, 0x6b, 0x0, 0x0, 0x1, 0x41, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x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 0x27, 0x58, 0x54, 0x64, 0x46, 0x43, 0x50, 0x27, 0x27, 0x2b, 0x2e, 0x2e, 0x34, 0x2c, 0x2c, 0x31, 0x29, 0x29, 0x2e, 0x56, 0x53, 0x63, 0x45, 0x42, 0x4f, 0x56, 0x53, 0x62, 0x45, 0x42, 0x4e, 0x24, 0x24, 0x2a, 0x24, 0x24, 0x29, 0x20, 0x20, 0x25, 0x55, 0x51, 0x62, 0x44, 0x41, 0x4e, 0x28, 0x28, 0x2d, 0x2b, 0x2b, 0x30, 0x29, 0x29, 0x2d, 0x20, 0x20, 0x23, 0x55, 0x51, 0x60, 0x44, 0x41, 0x4d, 0x22, 0x22, 0x28, 0x27, 0x27, 0x2c, 0x1e, 0x1e, 0x22, 0x43, 0x40, 0x4c, 0x54, 0x50, 0x5f, 0x21, 0x21, 0x26, 0x21, 0x21, 0x25, 0x23, 0x23, 0x27, 0x20, 0x20, 0x24, 0x1d, 0x1d, 0x21, 0x47, 0x43, 0x51, 0x43, 0x3f, 0x4d, 0x42, 0x3f, 0x4c, 0x53, 0x4f, 0x5f, 0x1f, 0x1f, 0x24, 0x1f, 0x1f, 0x23, 0x1e, 0x1e, 0x21, 0x53, 0x50, 0x5f, 0x53, 0x4f, 0x5e, 0x5f, 0x5a, 0x6c, 0xd3, 0x26, 0x54, 0x35, 0x0, 0x0, 0x0, 0x24, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x4, 0xa, 0x11, 0x19, 0x1f, 0x22, 0x24, 0x1d, 0x16, 0xd, 0x7, 0x2, 0x15, 0x25, 0x34, 0x3f, 0x46, 0x47, 0x48, 0x43, 0x3a, 0x2d, 0x1b, 0x77, 0xef, 0xe6, 0x49, 0xef, 0xe6, 0xef, 0xe7, 0x77, 0xef, 0xe4, 0x4a, 0xba, 0xea, 0xc1, 0xeb, 0x0, 0x0, 0x0, 0xe5, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x85, 0x91, 0x43, 0x62, 0xc5, 0x60, 0x18, 0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, 0x53, 0x63, 0x3e, 0x3c, 0x47, 0x2a, 0x2a, 0x30, 0x2c, 0x2c, 0x32, 0x2d, 0x2d, 0x34, 0x2e, 0x2e, 0x35, 0x2f, 0x2f, 0x36, 0x2a, 0x2a, 0x31, 0x67, 0x63, 0x76, 0x5a, 0x56, 0x67, 0x5b, 0x57, 0x68, 0x23, 0x23, 0x28, 0x25, 0x25, 0x2b, 0x27, 0x27, 0x2d, 0x28, 0x28, 0x2e, 0x29, 0x29, 0x2f, 0x24, 0x24, 0x28, 0x26, 0x26, 0x2b, 0x5a, 0x56, 0x65, 0x48, 0x45, 0x51, 0x49, 0x46, 0x52, 0x4d, 0x4a, 0x57, 0x22, 0x22, 0x26, 0x25, 0x25, 0x2a, 0x2a, 0x2a, 0x2f, 0x2b, 0x2b, 0x31, 0x26, 0x26, 0x2c, 0x5b, 0x57, 0x66, 0x22, 0x22, 0x27, 0x2d, 0x2d, 0x33, 0x59, 0x55, 0x64, 0x47, 0x44, 0x50, 0x27, 0x27, 0x2b, 0x29, 0x29, 0x2e, 0x2c, 0x2c, 0x31, 0x2e, 0x2e, 0x34, 0x58, 0x54, 0x64, 0x46, 0x43, 0x50, 0x56, 0x53, 0x63, 0x45, 0x42, 0x4f, 0x20, 0x20, 0x25, 0x24, 0x24, 0x29, 0x24, 0x24, 0x2a, 0x56, 0x53, 0x62, 0x45, 0x42, 0x4e, 0x20, 0x20, 0x23, 0x29, 0x29, 0x2d, 0x2b, 0x2b, 0x30, 0x28, 0x28, 0x2d, 0x55, 0x51, 0x62, 0x44, 0x41, 0x4e, 0x1e, 0x1e, 0x22, 0x27, 0x27, 0x2c, 0x22, 0x22, 0x28, 0x55, 0x51, 0x60, 0x44, 0x41, 0x4d, 0x1d, 0x1d, 0x21, 0x20, 0x20, 0x24, 0x23, 0x23, 0x27, 0x21, 0x21, 0x25, 0x21, 0x21, 0x26, 0x54, 0x50, 0x5f, 0x43, 0x40, 0x4c, 0x1e, 0x1e, 0x21, 0x1f, 0x1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4e, 0x42, 0x3e, 0x4a, 0x41, 0x3e, 0x49, 0x51, 0x4e, 0x5b, 0x26, 0x26, 0x2b, 0x24, 0x24, 0x28, 0x27, 0x27, 0x2d, 0x29, 0x29, 0x2f, 0x28, 0x28, 0x2e, 0x25, 0x25, 0x2b, 0x23, 0x23, 0x28, 0x40, 0x3e, 0x48, 0x50, 0x4e, 0x5a, 0x26, 0x26, 0x2c, 0x25, 0x25, 0x2a, 0x2a, 0x2a, 0x2f, 0x2b, 0x2b, 0x31, 0x22, 0x22, 0x26, 0x4f, 0x4c, 0x59, 0x3f, 0x3d, 0x47, 0x2d, 0x2d, 0x33, 0x22, 0x22, 0x27, 0x4e, 0x4a, 0x58, 0x3e, 0x3b, 0x46, 0x27, 0x27, 0x2b, 0x2e, 0x2e, 0x34, 0x2c, 0x2c, 0x31, 0x29, 0x29, 0x2e, 0x4b, 0x49, 0x55, 0x3c, 0x3a, 0x44, 0x4a, 0x47, 0x54, 0x3b, 0x39, 0x43, 0x24, 0x24, 0x2a, 0x24, 0x24, 0x29, 0x20, 0x20, 0x25, 0x49, 0x46, 0x53, 0x3a, 0x38, 0x42, 0x28, 0x28, 0x2d, 0x2b, 0x2b, 0x30, 0x29, 0x29, 0x2d, 0x20, 0x20, 0x23, 0x47, 0x45, 0x50, 0x39, 0x37, 0x40, 0x22, 0x22, 0x28, 0x27, 0x27, 0x2c, 0x1e, 0x1e, 0x22, 0x47, 0x43, 0x50, 0x38, 0x35, 0x3f, 0x46, 0x42, 0x4f, 0x21, 0x21, 0x26, 0x21, 0x21, 0x25, 0x23, 0x23, 0x27, 0x20, 0x20, 0x24, 0x1d, 0x1d, 0x21, 0x36, 0x34, 0x3e, 0x44, 0x41, 0x4e, 0x1f, 0x1f, 0x24, 0x1f, 0x1f, 0x23, 0x1e, 0x1e, 0x21, 0x44, 0x42, 0x4d, 0x44, 0x41, 0x4c, 0x4e, 0x4b, 0x58, 0x8, 0xd9, 0x10, 0xcb, 0x0, 0x0, 0x0, 0x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d0, 0x7b, 0x86, 0xcc, 0x36, 0xbb, 0x11, 0x90, 0x66, 0x1f, 0x88, 0xef, 0xbd, 0x64, 0x92, 0x5a, 0x7b, 0x4e, 0xed, 0x34, 0x42, 0x20, 0xa5, 0xd5, 0x7, 0x27, 0x69, 0xfb, 0x51, 0x8d, 0x69, 0x6e, 0xd5, 0xcc, 0xb9, 0x18, 0xf4, 0xaf, 0x40, 0x6e, 0x3f, 0x1d, 0xab, 0xf1, 0xdd, 0xc7, 0xf1, 0x12, 0x45, 0xc, 0xce, 0x4f, 0x17, 0x12, 0xd0, 0xb6, 0xc4, 0x87, 0x1a, 0x6f, 0x2f, 0x48, 0x8b, 0xef, 0x31, 0xd0, 0x6e, 0xce, 0xa8, 0xc0, 0x25, 0x56, 0x7d, 0x5, 0x52, 0xed, 0x6e, 0xae, 0x68, 0x0, 0xd4, 0x86, 0x7f, 0x56, 0x43, 0x62, 0x38, 0xc, 0x46, 0x28, 0xba, 0x1, 0x7a, 0xad, 0x4f, 0x59, 0x90, 0xab, 0xbf, 0xa4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char option_button_normal_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x40, 0xde, 0x8d, 0x6b, 0x0, 0x0, 0x1, 0x41, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0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, 0x24, 0x24, 0x29, 0x24, 0x24, 0x2a, 0x4a, 0x47, 0x54, 0x3b, 0x39, 0x43, 0x20, 0x20, 0x23, 0x29, 0x29, 0x2d, 0x2b, 0x2b, 0x30, 0x28, 0x28, 0x2d, 0x49, 0x46, 0x53, 0x3a, 0x38, 0x42, 0x1e, 0x1e, 0x22, 0x27, 0x27, 0x2c, 0x22, 0x22, 0x28, 0x47, 0x45, 0x50, 0x39, 0x37, 0x40, 0x1d, 0x1d, 0x21, 0x20, 0x20, 0x24, 0x23, 0x23, 0x27, 0x21, 0x21, 0x25, 0x21, 0x21, 0x26, 0x46, 0x42, 0x4f, 0x38, 0x35, 0x3f, 0x47, 0x43, 0x50, 0x1e, 0x1e, 0x21, 0x1f, 0x1f, 0x23, 0x1f, 0x1f, 0x24, 0x44, 0x41, 0x4e, 0x36, 0x34, 0x3e, 0x4e, 0x4b, 0x58, 0x44, 0x41, 0x4c, 0x44, 0x42, 0x4d, 0x7d, 0x2e, 0xcf, 0xc5, 0x0, 0x0, 0x0, 0x24, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x2, 0x7, 0xd, 0x16, 0x1d, 0x22, 0x24, 0x1f, 0x19, 0x11, 0xa, 0x4, 0x1b, 0x2d, 0x3a, 0x43, 0x48, 0x47, 0x46, 0x3f, 0x34, 0x25, 0x15, 0x49, 0xe6, 0xef, 0x77, 0xe6, 0xef, 0xe7, 0xef, 0x4a, 0xe4, 0xef, 0x77, 0x7e, 0xb9, 0x59, 0x66, 0x0, 0x0, 0x0, 0x1, 0x6f, 0x72, 0x4e, 0x54, 0x1, 0xcf, 0xa2, 0x77, 0x9a, 0x0, 0x0, 0x1, 0x13, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x85, 0xd1, 0xd9, 0x52, 0xc2, 0x30, 0x14, 0x80, 0xe1, 0x2a, 0x5a, 0x56, 0x97, 0xb2, 0xb9, 0x8b, 0xb, 0x54, 0x51, 0x4b, 0x6d, 0xf, 0x68, 0xd3,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31, 0x2f, 0x37, 0x46, 0x43, 0x4f, 0x2b, 0x2b, 0x31, 0x2e, 0x2e, 0x34, 0x47, 0x44, 0x50, 0x2a, 0x2a, 0x30, 0x55, 0x52, 0x5f, 0x22, 0x22, 0x27, 0x3d, 0x3a, 0x45, 0x56, 0x52, 0x60, 0x24, 0x24, 0x28, 0x24, 0x24, 0x29, 0x43, 0x40, 0x4c, 0x42, 0x40, 0x4b, 0x4c, 0x49, 0x56, 0x2a, 0x2a, 0x31, 0x2a, 0x2a, 0x30, 0x2d, 0x2d, 0x34, 0x2f, 0x2f, 0x36, 0x2e, 0x2e, 0x35, 0x2c, 0x2c, 0x32, 0x3a, 0x38, 0x41, 0x36, 0x34, 0x3d, 0x44, 0x41, 0x4c, 0x26, 0x26, 0x2b, 0x24, 0x24, 0x28, 0x27, 0x27, 0x2d, 0x29, 0x29, 0x2f, 0x28, 0x28, 0x2e, 0x25, 0x25, 0x2b, 0x23, 0x23, 0x28, 0x44, 0x42, 0x4e, 0x36, 0x34, 0x3e, 0x44, 0x41, 0x4e, 0x26, 0x26, 0x2c, 0x25, 0x25, 0x2a, 0x2a, 0x2a, 0x2f, 0x2b, 0x2b, 0x31, 0x22, 0x22, 0x26, 0x46, 0x42, 0x4f, 0x38, 0x35, 0x3f, 0x2d, 0x2d, 0x33, 0x22, 0x22, 0x27, 0x47, 0x45, 0x50, 0x39, 0x37, 0x40, 0x27, 0x27, 0x2b, 0x2e, 0x2e, 0x34, 0x2c, 0x2c, 0x31, 0x29, 0x29, 0x2e, 0x49, 0x46, 0x53, 0x3a, 0x38, 0x42, 0x4a, 0x47, 0x54, 0x3b, 0x39, 0x43, 0x24, 0x24, 0x2a, 0x24, 0x24, 0x29, 0x20, 0x20, 0x25, 0x4b, 0x49, 0x55, 0x3c, 0x3a, 0x44, 0x28, 0x28, 0x2d, 0x2b, 0x2b, 0x30, 0x29, 0x29, 0x2d, 0x20, 0x20, 0x23, 0x4e, 0x4a, 0x58, 0x3e, 0x3b, 0x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d7, 0xb0, 0x48, 0x6b, 0x98, 0xe8, 0x9, 0x38, 0x70, 0x8b, 0xa, 0xcc, 0x12, 0x1a, 0xf0, 0x4d, 0xac, 0x87, 0xf3, 0x96, 0x6f, 0x8e, 0x5f, 0x56, 0xc0, 0x53, 0x20, 0x8f, 0xbf, 0xdb, 0x86, 0x58, 0x5b, 0x9, 0xbf, 0x47, 0x80, 0xa, 0x58, 0x1a, 0x38, 0xad, 0x9, 0x5f, 0xac, 0xe3, 0x20, 0xbc, 0x4b, 0x46, 0x4b, 0x0, 0x3a, 0x1a, 0x24, 0xd0, 0x69, 0x85, 0xc0, 0x63, 0x5, 0x60, 0x68, 0xf0, 0x36, 0x7f, 0xf3, 0xaa, 0xbe, 0xe1, 0x61, 0x81, 0x69, 0x5, 0x72, 0x5b, 0x83, 0xe4, 0x6a, 0x59, 0x16, 0xf7, 0x53, 0x47, 0x77, 0x8b, 0xad, 0x12, 0xe4, 0xb9, 0xa3, 0xc1, 0xe6, 0x83, 0x7b, 0x20, 0xd6, 0xb4, 0xe7, 0xbf, 0xed, 0xe1, 0x1a, 0xd8, 0xfa, 0xdf, 0xb9, 0x70, 0xb8, 0x21, 0xd6, 0xbb, 0x17, 0x1b, 0xe3, 0x4c, 0x6a, 0xb0, 0xbd, 0x25, 0x5, 0x3b, 0x5e, 0x7c, 0x21, 0xc0, 0xc2, 0x68, 0xee, 0xf1, 0xbc, 0x6, 0x46, 0xb1, 0xbd, 0x5e, 0x30, 0x5, 0x27, 0x19, 0x24, 0xb8, 0x61, 0x6e, 0xf8, 0xf5, 0xf7, 0xcd, 0x47, 0x16, 0xa0, 0x18, 0x13, 0x6a, 0x64, 0x7d, 0xff, 0x8f, 0x1e, 0x59, 0x84, 0xa2, 0x1b, 0x0, 0xe5, 0xe0, 0x4e, 0x46, 0x1d, 0x98, 0x92, 0x5c, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char option_button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x26, 0x26, 0x2b, 0x44, 0x41, 0x4c, 0x36, 0x34, 0x3d, 0x3a, 0x38, 0x41, 0x22, 0x22, 0x26, 0x25, 0x25, 0x2a, 0x2a, 0x2a, 0x2f, 0x2b, 0x2b, 0x31, 0x26, 0x26, 0x2c, 0x44, 0x41, 0x4e, 0x36, 0x34, 0x3e, 0x44, 0x42, 0x4e, 0x22, 0x22, 0x27, 0x2d, 0x2d, 0x33, 0x46, 0x42, 0x4f, 0x38, 0x35, 0x3f, 0x27, 0x27, 0x2b, 0x29, 0x29, 0x2e, 0x2c, 0x2c, 0x31, 0x2e, 0x2e, 0x34, 0x47, 0x45, 0x50, 0x39, 0x37, 0x40, 0x49, 0x46, 0x53, 0x3a, 0x38, 0x42, 0x20, 0x20, 0x25, 0x24, 0x24, 0x29, 0x24, 0x24, 0x2a, 0x4a, 0x47, 0x54, 0x3b, 0x39, 0x43, 0x20, 0x20, 0x23, 0x29, 0x29, 0x2d, 0x2b, 0x2b, 0x30, 0x28, 0x28, 0x2d, 0x4b, 0x49, 0x55, 0x3c, 0x3a, 0x44, 0x1e, 0x1e, 0x22, 0x27, 0x27, 0x2c, 0x22, 0x22, 0x28, 0x4e, 0x4a, 0x58, 0x3e, 0x3b, 0x46, 0x1d, 0x1d, 0x21, 0x20, 0x20, 0x24, 0x23, 0x23, 0x27, 0x21, 0x21, 0x25, 0x21, 0x21, 0x26, 0x4f, 0x4c, 0x59, 0x3f, 0x3d, 0x47, 0x3f, 0x3d, 0x48, 0x50, 0x4d, 0x5a, 0x1e, 0x1e, 0x21, 0x1f, 0x1f, 0x23, 0x1f, 0x1f, 0x24, 0x50, 0x4e, 0x5a, 0x40, 0x3e, 0x48, 0x41, 0x3e, 0x49, 0x45, 0x42, 0x4d, 0x5d, 0x59, 0x69, 0x51, 0x4e, 0x5b, 0x52, 0x4e, 0x5c, 0x49, 0x7e, 0x80, 0x9, 0x0, 0x0, 0x0, 0x24, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x2, 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 0x2b, 0x63, 0x67, 0x77, 0xf, 0x18, 0x70, 0x17, 0x62, 0x7, 0x2a, 0x30, 0x6, 0x2a, 0xb0, 0x42, 0x56, 0xe0, 0xe9, 0x5, 0x3, 0x9e, 0x82, 0x20, 0x5, 0x16, 0xde, 0x3e, 0x48, 0x6e, 0x30, 0xf4, 0xd5, 0xf3, 0xf3, 0x87, 0x1, 0x3f, 0xb0, 0x2, 0xa3, 0x0, 0x5d, 0xe3, 0x40, 0xcb, 0x20, 0x28, 0x8, 0x36, 0x32, 0xa, 0x9, 0x85, 0x81, 0x10, 0xb0, 0x15, 0xf6, 0x61, 0xf6, 0xbe, 0xe1, 0x70, 0x6f, 0x86, 0xdb, 0x47, 0x44, 0x46, 0xc1, 0x40, 0x24, 0xd8, 0x91, 0xe6, 0xd1, 0x31, 0xb1, 0x16, 0xc6, 0xe1, 0x50, 0x60, 0x11, 0x17, 0x9f, 0x90, 0x8, 0x5, 0x49, 0xc9, 0x60, 0x6f, 0xca, 0xa5, 0xa4, 0xc6, 0xc5, 0xfa, 0x58, 0x40, 0x81, 0x6e, 0x5a, 0x7c, 0x7a, 0x6, 0x4, 0x64, 0x66, 0xc9, 0x83, 0x3, 0x4a, 0x41, 0xd1, 0xc8, 0xd9, 0x5, 0xee, 0x6, 0x17, 0x63, 0xe3, 0xec, 0x1c, 0x8, 0xc8, 0x55, 0x52, 0x6, 0x7, 0x35, 0xc1, 0xc8, 0xc2, 0x1f, 0xdd, 0x0, 0xa5, 0xe, 0x59, 0xe5, 0x7f, 0xe9, 0xa4, 0x40, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char overbright_indicator_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x4, 0x3, 0x0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x82 }; @@ -314,6 +334,10 @@ static const unsigned char submenu_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x4, 0x0, 0x0, 0x0, 0x6e, 0x6, 0x76, 0x0, 0x0, 0x0, 0x0, 0x2e, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x78, 0xc0, 0xf0, 0xe0, 0x3f, 0x8, 0xde, 0x4f, 0x60, 0x0, 0x3, 0xb8, 0xc0, 0x83, 0x2f, 0xf, 0xb5, 0xe1, 0x2, 0x50, 0x78, 0xf5, 0x5, 0x37, 0xaa, 0xc0, 0xff, 0x87, 0xf3, 0x31, 0x4, 0x30, 0xb5, 0x60, 0x1a, 0x8a, 0x61, 0x2d, 0x0, 0xa6, 0x55, 0x4f, 0xb1, 0x91, 0xd6, 0xa7, 0xae, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char submenu_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x4, 0x0, 0x0, 0x0, 0x6e, 0x6, 0x76, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6f, 0x72, 0x4e, 0x54, 0x1, 0xcf, 0xa2, 0x77, 0x9a, 0x0, 0x0, 0x0, 0x57, 0x49, 0x44, 0x41, 0x54, 0x8, 0xd7, 0x55, 0xcb, 0xa1, 0x11, 0x83, 0x40, 0x14, 0x45, 0xd1, 0xb3, 0x6b, 0x10, 0x34, 0x10, 0x47, 0x34, 0xf4, 0x13, 0x9d, 0x2, 0x28, 0x87, 0x2a, 0xe8, 0x84, 0x2, 0x82, 0x65, 0x71, 0x69, 0x0, 0x11, 0xf5, 0x11, 0x4c, 0x66, 0xd8, 0xe7, 0xee, 0x99, 0x79, 0x80, 0xed, 0x5d, 0xa2, 0x44, 0x9, 0x12, 0xec, 0x43, 0x2c, 0x5a, 0x78, 0xa6, 0xcc, 0xb7, 0x8d, 0xf9, 0x4a, 0xc8, 0xfc, 0x26, 0x3d, 0x37, 0xa8, 0x97, 0x69, 0x46, 0x6b, 0x5, 0x8f, 0x23, 0xbd, 0x1c, 0xd5, 0xa5, 0xfb, 0xc4, 0xf8, 0x87, 0x13, 0xd2, 0x2f, 0x14, 0x49, 0x6f, 0xb1, 0x11, 0xe1, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char tab_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x4, 0x0, 0x0, 0x0, 0x6e, 0x6, 0x76, 0x0, 0x0, 0x0, 0x0, 0x19, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0xc0, 0x2, 0xfe, 0x47, 0xfe, 0x17, 0x1, 0xc2, 0x48, 0xd2, 0x84, 0x10, 0x2, 0x84, 0xb9, 0x98, 0x0, 0x0, 0xbf, 0x67, 0x1d, 0x5, 0x89, 0x9b, 0x48, 0x90, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; @@ -354,6 +378,14 @@ static const unsigned char toggle_off_disabled_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x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, 0x40, 0x25, 0xd2, 0x5e, 0x18, 0x7c, 0x7b, 0x2f, 0x3c, 0xd2, 0x5e, 0xf8, 0x72, 0x37, 0x16, 0xbe, 0xdc, 0x8d, 0x6c, 0x1e, 0x3c, 0x3d, 0xd7, 0x40, 0xdb, 0x32, 0xf, 0xbc, 0xec, 0x9f, 0x5f, 0xf6, 0xf3, 0x80, 0x4d, 0x24, 0x2d, 0xf8, 0xfa, 0x6, 0xea, 0x80, 0xd, 0x24, 0x68, 0x0, 0x6c, 0x5f, 0x8e, 0xf6, 0xd5, 0xd7, 0xa0, 0x56, 0x34, 0xcf, 0xb4, 0x86, 0x92, 0xc, 0xa5, 0x33, 0x17, 0xf9, 0xc2, 0x17, 0x91, 0xbf, 0xc8, 0xa4, 0x43, 0x49, 0xa5, 0xc1, 0x5b, 0xa7, 0x72, 0x47, 0xd, 0xac, 0x47, 0xd7, 0xef, 0xb1, 0x2f, 0xe0, 0xfd, 0x7a, 0xb4, 0xe, 0xa8, 0x1d, 0x91, 0xb3, 0x6f, 0x95, 0xb1, 0xb4, 0xf9, 0x28, 0x7d, 0x79, 0x2f, 0x94, 0x3e, 0x36, 0xd2, 0x98, 0xe7, 0x5c, 0x36, 0x93, 0xf8, 0x15, 0xa0, 0x9b, 0xe9, 0xff, 0xc2, 0x67, 0x14, 0xf4, 0xa5, 0xb3, 0x35, 0x5e, 0x63, 0x97, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char toggle_off_disabled_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x3, 0x0, 0x0, 0x0, 0x95, 0x43, 0x8e, 0xb6, 0x0, 0x0, 0x0, 0x9c, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0xd, 0xd, 0xf, 0x1a, 0x1a, 0x1e, 0x20, 0x20, 0x24, 0x22, 0x22, 0x27, 0x24, 0x24, 0x29, 0x25, 0x25, 0x2a, 0x1d, 0x1d, 0x21, 0x11, 0x11, 0x14, 0x23, 0x23, 0x28, 0x2e, 0x2e, 0x2e, 0x46, 0x46, 0x46, 0x57, 0x57, 0x57, 0x60, 0x60, 0x60, 0x62, 0x62, 0x62, 0x5e, 0x5e, 0x5e, 0x4a, 0x4a, 0x4a, 0x12, 0x12, 0x15, 0x25, 0x27, 0x2d, 0x42, 0x42, 0x42, 0x59, 0x59, 0x59, 0x32, 0x32, 0x32, 0x25, 0x26, 0x2d, 0x25, 0x25, 0x2b, 0x25, 0x26, 0x2c, 0x39, 0x39, 0x39, 0x49, 0x49, 0x49, 0x5a, 0x5a, 0x5a, 0x48, 0x48, 0x48, 0x54, 0x54, 0x54, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0x1e, 0x1e, 0x22, 0x25, 0x26, 0x2b, 0x3f, 0x3f, 0x3f, 0xe, 0xe, 0x10, 0x2c, 0x2c, 0x2c, 0x58, 0x58, 0x58, 0x5d, 0x5d, 0x5f, 0x80, 0x80, 0x80, 0x79, 0x79, 0x79, 0x40, 0x40, 0x44, 0x32, 0x32, 0x37, 0x41, 0x41, 0x41, 0x1a, 0x1a, 0x1d, 0x6a, 0x6a, 0x6d, 0x52, 0x52, 0x52, 0x3a, 0x3a, 0x3a, 0x5b, 0x5b, 0x5b, 0x2f, 0x2f, 0x2f, 0x50, 0x50, 0x51, 0x13, 0x13, 0x15, 0x2b, 0xcd, 0x4, 0x96, 0x0, 0x0, 0x0, 0x1, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x40, 0xe6, 0xd8, 0x66, 0x0, 0x0, 0x1, 0x29, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xed, 0x94, 0xdb, 0x76, 0x83, 0x20, 0x10, 0x45, 0x8d, 0xe8, 0x24, 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, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x25, 0x25, 0x2a, 0x24, 0x24, 0x29, 0x25, 0x25, 0x28, 0x25, 0x25, 0x29, 0x24, 0x24, 0x28, 0x2d, 0x26, 0x2c, 0x51, 0x2c, 0x39, 0x6c, 0x31, 0x42, 0x71, 0x32, 0x44, 0x6e, 0x31, 0x43, 0x63, 0x2f, 0x3f, 0x4d, 0x2b, 0x37, 0x27, 0x25, 0x2a, 0x47, 0x2a, 0x35, 0x68, 0x30, 0x40, 0x52, 0x2c, 0x39, 0x3c, 0x28, 0x31, 0x2e, 0x25, 0x2c, 0x26, 0x25, 0x2a, 0x32, 0x26, 0x2e, 0x4d, 0x2b, 0x38, 0x66, 0x30, 0x40, 0x50, 0x2c, 0x38, 0x5e, 0x2e, 0x3d, 0x38, 0x27, 0x30, 0x35, 0x27, 0x2f, 0x5f, 0x2e, 0x3d, 0x44, 0x2a, 0x34, 0x5f, 0x2f, 0x3e, 0x2f, 0x25, 0x2c, 0x43, 0x2a, 0x34, 0x2c, 0x26, 0x2c, 0x66, 0x2f, 0x40, 0x37, 0x27, 0x30, 0x36, 0x27, 0x30, 0x64, 0x2f, 0x3f, 0x2b, 0x26, 0x2c, 0x40, 0x40, 0x44, 0xad, 0xad, 0xaf, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0x77, 0x77, 0x7a, 0x5b, 0x5b, 0x5f, 0x32, 0x32, 0x37, 0x46, 0x2a, 0x35, 0x53, 0x2c, 0x39, 0xc9, 0xc9, 0xca, 0xbb, 0xbb, 0xbd, 0x69, 0x69, 0x6c, 0x5d, 0x2e, 0x3d, 0x3e, 0x29, 0x32, 0x84, 0x84, 0x87, 0xd6, 0xd6, 0xd7, 0x69, 0x30, 0x41, 0x2f, 0x26, 0x2d, 0x92, 0x92, 0x94, 0xa0, 0xa0, 0xa2, 0x4e, 0x4e, 0x52, 0x48, 0x2b, 0x36, 0x2c, 0x26, 0x2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13, 0x61, 0x2d, 0x5c, 0xfc, 0xf3, 0x5a, 0xb8, 0xb4, 0x53, 0xb, 0xbf, 0x51, 0x8d, 0xdf, 0x43, 0xab, 0x11, 0xf6, 0x83, 0xc9, 0xcb, 0xa1, 0x3e, 0xd4, 0xf7, 0x83, 0x1f, 0x40, 0xbd, 0x32, 0x59, 0xd3, 0xf, 0x60, 0x47, 0xe2, 0x84, 0xab, 0xd7, 0x82, 0xc8, 0x76, 0x47, 0x72, 0x9a, 0x92, 0xd5, 0x91, 0x7e, 0x82, 0xeb, 0x37, 0x4, 0x2e, 0x51, 0xdf, 0xd3, 0x92, 0x4c, 0x5c, 0xec, 0xea, 0x9e, 0x18, 0x91, 0x23, 0x91, 0xb9, 0x39, 0x30, 0x28, 0xc6, 0x99, 0xa4, 0xa7, 0x31, 0x63, 0x64, 0x8a, 0xe5, 0xd3, 0x53, 0xd3, 0x33, 0x6d, 0x11, 0x98, 0x99, 0x9e, 0x4a, 0xf3, 0x6c, 0x8a, 0xf4, 0xcd, 0x6, 0xc, 0x9f, 0xa5, 0xe6, 0xe6, 0xa5, 0xe8, 0xb9, 0x20, 0xcd, 0xcf, 0x51, 0xb3, 0x8d, 0x67, 0x8b, 0x35, 0x99, 0xa2, 0x7, 0x93, 0x35, 0x9a, 0x2, 0x26, 0xd3, 0xff, 0x8b, 0x5f, 0x3d, 0xdc, 0x7c, 0xb4, 0x8c, 0xb2, 0xd8, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char toggle_on_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x3, 0x0, 0x0, 0x0, 0x95, 0x43, 0x8e, 0xb6, 0x0, 0x0, 0x1, 0x74, 0x50, 0x4c,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24, 0x29, 0x25, 0x2c, 0x36, 0x27, 0x49, 0x65, 0x29, 0x5d, 0x85, 0x2a, 0x66, 0x95, 0x2a, 0x68, 0x99, 0x29, 0x64, 0x92, 0x28, 0x4c, 0x6b, 0x25, 0x27, 0x2d, 0x27, 0x43, 0x5c, 0x29, 0x5f, 0x89, 0x27, 0x49, 0x66, 0x25, 0x30, 0x3e, 0x25, 0x26, 0x2d, 0x25, 0x25, 0x2b, 0x25, 0x26, 0x2c, 0x25, 0x2d, 0x38, 0x25, 0x3a, 0x4c, 0x27, 0x4d, 0x6b, 0x29, 0x60, 0x8c, 0x27, 0x44, 0x5c, 0x27, 0x4b, 0x69, 0x28, 0x59, 0x7f, 0x25, 0x34, 0x43, 0x25, 0x35, 0x45, 0x28, 0x58, 0x7f, 0x25, 0x26, 0x2b, 0x27, 0x40, 0x57, 0x27, 0x41, 0x57, 0x25, 0x2a, 0x33, 0x29, 0x5d, 0x87, 0x25, 0x34, 0x44, 0x25, 0x2b, 0x34, 0x40, 0x40, 0x44, 0xad, 0xad, 0xaf, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0x77, 0x77, 0x7a, 0x5b, 0x5b, 0x5f, 0x4e, 0x4e, 0x52, 0xc9, 0xc9, 0xca, 0x27, 0x43, 0x5b, 0x27, 0x4d, 0x6c, 0x27, 0x4e, 0x6d, 0xbb, 0xbb, 0xbd, 0x69, 0x69, 0x6c, 0x28, 0x56, 0x7b, 0x26, 0x3b, 0x4e, 0x26, 0x3a, 0x4e, 0x32, 0x32, 0x37, 0x84, 0x84, 0x87, 0xd6, 0xd6, 0xd7, 0x29, 0x61, 0x8d, 0x25, 0x2e, 0x39, 0x92, 0x92, 0x94, 0xa0, 0xa0, 0xa2, 0xe4, 0xe4, 0xe5, 0x27, 0x44, 0x5d, 0xdd, 0xc9, 0xf2, 0x7e, 0x0, 0x0, 0x0, 0x41, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9, 0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0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x14, 0x23, 0x23, 0x28, 0x2e, 0x2e, 0x2e, 0x46, 0x46, 0x46, 0x57, 0x57, 0x57, 0x60, 0x60, 0x60, 0x62, 0x62, 0x62, 0x5e, 0x5e, 0x5e, 0x4a, 0x4a, 0x4a, 0x12, 0x12, 0x15, 0x25, 0x27, 0x2d, 0x42, 0x42, 0x42, 0x59, 0x59, 0x59, 0x32, 0x32, 0x32, 0x25, 0x26, 0x2d, 0x25, 0x25, 0x2b, 0x25, 0x26, 0x2c, 0x39, 0x39, 0x39, 0x49, 0x49, 0x49, 0x5a, 0x5a, 0x5a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xb, 0xd, 0x23, 0x23, 0x28, 0x48, 0x48, 0x48, 0x54, 0x54, 0x54, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0xb, 0xb, 0xd, 0x1e, 0x1e, 0x22, 0x25, 0x26, 0x2b, 0x3f, 0x3f, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0xe, 0x10, 0x2c, 0x2c, 0x2c, 0x58, 0x58, 0x58, 0x1a, 0x1a, 0x1e, 0x40, 0x40, 0x44, 0x56, 0x56, 0x58, 0x80, 0x80, 0x80, 0x79, 0x79, 0x79, 0x3c, 0x3c, 0x3d, 0x2e, 0x2e, 0x30, 0x27, 0x27, 0x29, 0x64, 0x64, 0x66, 0x41, 0x41, 0x41, 0x1a, 0x1a, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5d, 0x5d, 0x5f, 0x34, 0x34, 0x36, 0x52, 0x52, 0x52, 0x3a, 0x3a, 0x3a, 0x20, 0x20, 0x24, 0x0, 0x0, 0x0, 0x32, 0x32, 0x37, 0x42, 0x42, 0x44, 0x6a, 0x6a, 0x6d, 0x5b, 0x5b, 0x5b, 0x2f, 0x2f, 0x2f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x49, 0x49, 0x4a, 0x0, 0x0, 0x0, 0x50, 0x50, 0x51, 0x70, 0x70, 0x74, 0xe, 0xe, 0x10, 0xb, 0xb, 0xd, 0x0, 0x0, 0x0, 0x13, 0x13, 0x15, 0x0, 0x0, 0x0, 0xb, 0xb, 0xc, 0x1d, 0x1d, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbd, 0xb, 0x85, 0x35, 0x0, 0x0, 0x0, 0x71, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9, 0xe, 0x13, 0x16, 0x18, 0x19, 0xa, 0x26, 0x36, 0x44, 0x4d, 0x52, 0x54, 0x55, 0x6, 0x12, 0x27, 0x43, 0x80, 0xc5, 0xe7, 0xf5, 0xfe, 0xff, 0x8, 0x17, 0x35, 0x73, 0xd9, 0xff, 0x7, 0x3a, 0x96, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb, 0x28, 0x76, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x77, 0xde, 0xff, 0xff, 0x45, 0x5, 0x82, 0xff, 0xff, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc6, 0x37, 0xf, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0x4f, 0xff, 0x50, 0xff, 0xff, 0x83, 0x78, 0x3b, 0x9c, 0x3c, 0x74, 0xda, 0x53, 0x14, 0x49, 0x96, 0x6e, 0xf, 0x0, 0x0, 0x1, 0xfa, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x62, 0x18, 0x5e, 0x0, 0xd0, 0x5c, 0x39, 0x28, 0x49, 0x12, 0xc0, 0x60, 0xb8, 0xda, 0xdd, 0xcb, 0x31, 0x33, 0xb6, 0x6d, 0xdb, 0x5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e, 0x79, 0x12, 0xfb, 0xbb, 0x90, 0x59, 0x7d, 0x17, 0x1e, 0xd9, 0x5d, 0xf8, 0xd5, 0x6d, 0xec, 0xdf, 0x83, 0xa7, 0xe7, 0xf8, 0x2a, 0xf7, 0x20, 0xfe, 0xfc, 0xc2, 0xde, 0x83, 0xfe, 0x45, 0x62, 0x36, 0x5f, 0xdf, 0x60, 0x69, 0xde, 0x5e, 0x37, 0x19, 0xc5, 0xe8, 0x4d, 0xd3, 0x51, 0xc2, 0x2d, 0xb1, 0xe4, 0xd8, 0x8, 0xb, 0x31, 0x1e, 0x4b, 0xc4, 0x5b, 0x42, 0x4a, 0x87, 0x8e, 0x5f, 0xe5, 0x8, 0xbd, 0xb1, 0x5b, 0xb8, 0x7a, 0xe7, 0x2d, 0xe0, 0xfd, 0xaa, 0xb0, 0xbb, 0x41, 0x47, 0x70, 0x64, 0xf2, 0xab, 0x14, 0x89, 0xbd, 0xf, 0xe5, 0xe2, 0xbf, 0xa0, 0xfc, 0xd8, 0x23, 0x8a, 0x28, 0x32, 0xe3, 0x33, 0xe1, 0x4b, 0xc0, 0x7e, 0xa6, 0xff, 0x87, 0xcf, 0xb, 0x94, 0xb9, 0x37, 0x3c, 0xc6, 0xd8, 0xcd, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char toggle_on_disabled_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x20, 0x8, 0x3, 0x0, 0x0, 0x0, 0x95, 0x43, 0x8e, 0xb6, 0x0, 0x0, 0x0, 0x69, 0x50, 0x4c, 0x54, 0x45, 0x93, 0x7f, 0x2b, 0x14, 0x14, 0x17, 0x20, 0x20, 0x25, 0x24, 0x24, 0x28, 0x24, 0x24, 0x29, 0x25, 0x25, 0x2a, 0x10, 0x10, 0x13, 0x22, 0x22, 0x27, 0x25, 0x25, 0x28, 0x25, 0x25, 0x29, 0x25, 0x25, 0x27, 0x19, 0x19, 0x1c, 0x2b, 0x26, 0x2c, 0x40, 0x40, 0x44, 0x4e, 0x4e, 0x52, 0x1a, 0x1a, 0x1d, 0x32, 0x32, 0x37, 0x2c, 0x26, 0x2c, 0x26, 0x25, 0x2a, 0x27, 0x25, 0x2a, 0x11, 0x11, 0x14, 0x2f, 0x26, 0x2d, 0x12, 0x12, 0x14, 0x23, 0x23, 0x27, 0x15, 0x15, 0x18, 0x5b, 0x5b, 0x5f, 0x84, 0x84, 0x87, 0x77, 0x77, 0x7a, 0x69, 0x69, 0x6c, 0x20, 0x20, 0x24, 0x24, 0x24, 0x27, 0x23, 0x23, 0x28, 0x1a, 0x1a, 0x1e, 0x11, 0x11, 0x13, 0x22, 0x22, 0x26, 0xd7, 0x77, 0xc6, 0x92, 0x0, 0x0, 0x0, 0x1, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x40, 0xe6, 0xd8, 0x66, 0x0, 0x0, 0x1, 0x35, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xed, 0x94, 0xd1, 0x72, 0x83, 0x20, 0x10, 0x45, 0x4d, 0x90, 0xb8, 0x18, 0x96, 0x6c, 0xb5, 0x24, 0x41, 0x68, 0x9b, 0xf4, 0xff, 0x3f, 0xb2, 0x84, 0xb4, 0x8a, 0xa, 0x3a, 0x9d, 0x74, 0xa6, 0x2f, 0xb9, 0xbe, 0x38, 0xca, 0x3d, 0x5c, 0x16, 0xd8, 0xa2, 0x78, 0xea, 0x2f, 0xb5, 0xd9, 0xb2, 0xb2, 0xe4, 0x2b, 0x2a, 0x4b, 0xb6, 0xdd, 0x24, 0xed, 0xbb, 0x8a, 0x1, 0x8, 0x21, 0xee, 0xe3, 0xc4, 0x4d, 0x20, 0x6a, 0x91, 0x84, 0x54, 0xbb, 0xb9, 0x7f, 0xcf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x25, 0x25, 0x2b, 0x25, 0x26, 0x2d, 0x25, 0x30, 0x3e, 0x27, 0x49, 0x66, 0x29, 0x5f, 0x89, 0x27, 0x43, 0x5c, 0x27, 0x4b, 0x69, 0x28, 0x58, 0x7f, 0x25, 0x35, 0x45, 0x25, 0x34, 0x43, 0x28, 0x59, 0x7f, 0x25, 0x26, 0x2b, 0x27, 0x41, 0x57, 0x27, 0x40, 0x57, 0x25, 0x2b, 0x34, 0x25, 0x34, 0x44, 0x29, 0x5d, 0x87, 0x25, 0x2a, 0x33, 0x27, 0x43, 0x5b, 0x27, 0x4e, 0x6d, 0x27, 0x4d, 0x6c, 0x40, 0x40, 0x44, 0xad, 0xad, 0xaf, 0xff, 0xff, 0xff, 0xf2, 0xf2, 0xf2, 0x77, 0x77, 0x7a, 0x5b, 0x5b, 0x5f, 0x4e, 0x4e, 0x52, 0xc9, 0xc9, 0xca, 0x28, 0x56, 0x7b, 0x26, 0x3a, 0x4e, 0x26, 0x3b, 0x4e, 0xbb, 0xbb, 0xbd, 0x69, 0x69, 0x6c, 0x29, 0x61, 0x8d, 0x25, 0x2e, 0x39, 0x32, 0x32, 0x37, 0x84, 0x84, 0x87, 0xd6, 0xd6, 0xd7, 0x92, 0x92, 0x94, 0xa0, 0xa0, 0xa2, 0x27, 0x44, 0x5d, 0xa6, 0xa2, 0x25, 0x5b, 0x0, 0x0, 0x0, 0x4c, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9, 0xe, 0x13, 0x16, 0x18, 0x19, 0xa, 0x26, 0x36, 0x44, 0x4d, 0x52, 0x54, 0x55, 0x6, 0x12, 0x27, 0x43, 0x80, 0xc5, 0xe7, 0xf5, 0xfe, 0xfa, 0xe5, 0x98, 0x8, 0x17, 0x35, 0x73, 0xd9, 0xf3, 0x86, 0x7, 0x3a, 0x96, 0xf9, 0xb4, 0x9a, 0xb9, 0xb, 0x28, 0x77, 0xfb, 0x8b, 0x5, 0x45, 0xde, 0xf6, 0x82, 0x9b, 0xf, 0x37, 0xc6, 0xe6, 0xe9, 0xfb, 0x4e, 0x50, 0x83, 0x9c, 0x78, 0x8c, 0x3c, 0x9c, 0xbb, 0x74, 0xda, 0x87, 0x53, 0x14, 0xd0, 0x92, 0x4e, 0x2c, 0x0, 0x0, 0x2, 0x35, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0x44, 0x80, 0x91, 0x89, 0x99, 0x99, 0x85, 0x20, 0x60, 0x66, 0x66, 0x62, 0xc4, 0xaa, 0x9d, 0x89, 0x85, 0x95, 0x8d, 0x9d, 0x83, 0x93, 0x8b, 0x0, 0xe0, 0xe4, 0x60, 0x67, 0x63, 0x65, 0x61, 0xc2, 0xb4, 0x9d, 0x85, 0x9b, 0x83, 0x87, 0x97, 0x8f, 0x5f, 0x40, 0x50, 0x8, 0x2f, 0x10, 0x14, 0xe0, 0xe7, 0xe3, 0xe5, 0xe1, 0xe0, 0x66, 0x41, 0x73, 0x5, 0x93, 0xb0, 0x88, 0xa8, 0x98, 0xb8, 0x84, 0xa4, 0x94, 0xb4, 0xf, 0x1, 0xe0, 0x2b, 0x2d, 0x23, 0x2b, 0x27, 0x26, 0x2a, 0x22, 0x8c, 0xe2, 0x8, 0x26, 0x79, 0x5, 0x45, 0x25, 0x65, 0x5f, 0xc, 0xd5, 0x7e, 0xfe, 0x7e, 0x58, 0xd, 0x51, 0x51, 0x55, 0x54, 0x90, 0x47, 0x32, 0x81, 0x51, 0x8d, 0x53, 0x5d, 0x43, 0xd3, 0x27, 0x20, 0x30, 0x28, 0x18, 0x2, 0x42, 0x42, 0xc3, 0x2, 0x20, 0x6, 0x84, 0xe3, 0x70, 0x87, 0x96, 0x3a, 0xa7, 0x1a, 0x23, 0xc2, 0xff, 0xec, 0xbc, 0xda, 0xd2, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x20, 0x90, 0x90, 0x98, 0x94, 0x9c, 0x12, 0x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, 0xe, 0x20, 0x28, 0xb, 0x64, 0xd0, 0x5c, 0x7d, 0x17, 0x8, 0x76, 0x4d, 0x62, 0x70, 0x7f, 0x7f, 0x6, 0x8, 0xfe, 0x95, 0x30, 0x78, 0xdc, 0x1, 0x31, 0xce, 0xb6, 0x50, 0xc8, 0x80, 0x1b, 0x8, 0xb7, 0x2, 0x6e, 0x29, 0xdc, 0x19, 0x0, 0xcf, 0x24, 0x4d, 0xb3, 0xd0, 0x4d, 0xb9, 0x40, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; @@ -426,4 +466,8 @@ static const unsigned char window_resizer_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0xb5, 0xfa, 0x37, 0xea, 0x0, 0x0, 0x0, 0x1e, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x18, 0xbc, 0xe0, 0x45, 0x3f, 0x1, 0xe9, 0xec, 0xfe, 0x81, 0x94, 0x86, 0xb1, 0x70, 0x48, 0x23, 0x58, 0x84, 0xa4, 0x7, 0x15, 0x0, 0x0, 0xed, 0x9f, 0x18, 0xe8, 0xcd, 0x91, 0xd8, 0xe, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char window_resizer_mirrored_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0xb5, 0xfa, 0x37, 0xea, 0x0, 0x0, 0x0, 0x1, 0x6f, 0x72, 0x4e, 0x54, 0x1, 0xcf, 0xa2, 0x77, 0x9a, 0x0, 0x0, 0x0, 0x27, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x63, 0x60, 0x18, 0x44, 0xe0, 0x45, 0x3f, 0x76, 0x71, 0x26, 0x18, 0xa3, 0x19, 0xa7, 0x12, 0x38, 0xc8, 0xee, 0xa7, 0xb1, 0x12, 0x98, 0x4, 0x4e, 0x25, 0x8, 0x9, 0x4a, 0x94, 0xc, 0x10, 0x0, 0x0, 0x9d, 0x84, 0x18, 0x73, 0x33, 0x1c, 0x96, 0xd6, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + // shaders block diff --git a/scene/resources/default_theme/toggle_off_disabled_mirrored.png b/scene/resources/default_theme/toggle_off_disabled_mirrored.png Binary files differnew file mode 100644 index 0000000000..799b63c098 --- /dev/null +++ b/scene/resources/default_theme/toggle_off_disabled_mirrored.png diff --git a/scene/resources/default_theme/toggle_off_mirrored.png b/scene/resources/default_theme/toggle_off_mirrored.png Binary files differnew file mode 100644 index 0000000000..3487605d58 --- /dev/null +++ b/scene/resources/default_theme/toggle_off_mirrored.png diff --git a/scene/resources/default_theme/toggle_on_disabled_mirrored.png b/scene/resources/default_theme/toggle_on_disabled_mirrored.png Binary files differnew file mode 100644 index 0000000000..0758babd4f --- /dev/null +++ b/scene/resources/default_theme/toggle_on_disabled_mirrored.png diff --git a/scene/resources/default_theme/toggle_on_mirrored.png b/scene/resources/default_theme/toggle_on_mirrored.png Binary files differnew file mode 100644 index 0000000000..3fd953c8e2 --- /dev/null +++ b/scene/resources/default_theme/toggle_on_mirrored.png diff --git a/scene/resources/default_theme/window_resizer_mirrored.png b/scene/resources/default_theme/window_resizer_mirrored.png Binary files differnew file mode 100644 index 0000000000..bbce5f1406 --- /dev/null +++ b/scene/resources/default_theme/window_resizer_mirrored.png diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp deleted file mode 100644 index d76d364737..0000000000 --- a/scene/resources/dynamic_font.cpp +++ /dev/null @@ -1,1156 +0,0 @@ -/*************************************************************************/ -/* dynamic_font.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "modules/modules_enabled.gen.h" -#ifdef MODULE_FREETYPE_ENABLED - -#include "dynamic_font.h" - -#include "core/os/file_access.h" -#include "core/os/os.h" - -#include FT_STROKER_H - -#define __STDC_LIMIT_MACROS -#include <stdint.h> - -bool DynamicFontData::CacheID::operator<(CacheID right) const { - return key < right.key; -} - -Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_cache_id) { - if (size_cache.has(p_cache_id)) { - return Ref<DynamicFontAtSize>(size_cache[p_cache_id]); - } - - Ref<DynamicFontAtSize> dfas; - - dfas.instance(); - - dfas->font = Ref<DynamicFontData>(this); - - size_cache[p_cache_id] = dfas.ptr(); - dfas->id = p_cache_id; - dfas->_load(); - - return dfas; -} - -void DynamicFontData::set_font_ptr(const uint8_t *p_font_mem, int p_font_mem_size) { - font_mem = p_font_mem; - font_mem_size = p_font_mem_size; -} - -void DynamicFontData::set_font_path(const String &p_path) { - font_path = p_path; -} - -String DynamicFontData::get_font_path() const { - return font_path; -} - -void DynamicFontData::set_force_autohinter(bool p_force) { - force_autohinter = p_force; -} - -void DynamicFontData::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_antialiased", "antialiased"), &DynamicFontData::set_antialiased); - ClassDB::bind_method(D_METHOD("is_antialiased"), &DynamicFontData::is_antialiased); - ClassDB::bind_method(D_METHOD("set_font_path", "path"), &DynamicFontData::set_font_path); - ClassDB::bind_method(D_METHOD("get_font_path"), &DynamicFontData::get_font_path); - ClassDB::bind_method(D_METHOD("set_hinting", "mode"), &DynamicFontData::set_hinting); - ClassDB::bind_method(D_METHOD("get_hinting"), &DynamicFontData::get_hinting); - - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased"), "set_antialiased", "is_antialiased"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting"); - - BIND_ENUM_CONSTANT(HINTING_NONE); - BIND_ENUM_CONSTANT(HINTING_LIGHT); - BIND_ENUM_CONSTANT(HINTING_NORMAL); - - ADD_PROPERTY(PropertyInfo(Variant::STRING, "font_path", PROPERTY_HINT_FILE, "*.ttf,*.otf"), "set_font_path", "get_font_path"); -} - -DynamicFontData::DynamicFontData() { - antialiased = true; - force_autohinter = false; - hinting = DynamicFontData::HINTING_NORMAL; - font_mem = nullptr; - font_mem_size = 0; -} - -DynamicFontData::~DynamicFontData() { -} - -//////////////////// -HashMap<String, Vector<uint8_t>> DynamicFontAtSize::_fontdata; - -Error DynamicFontAtSize::_load() { - int error = FT_Init_FreeType(&library); - - ERR_FAIL_COND_V_MSG(error != 0, ERR_CANT_CREATE, "Error initializing FreeType."); - - // FT_OPEN_STREAM is extremely slow only on Android. - if (OS::get_singleton()->get_name() == "Android" && font->font_mem == nullptr && font->font_path != String()) { - // cache font only once for each font->font_path - if (_fontdata.has(font->font_path)) { - font->set_font_ptr(_fontdata[font->font_path].ptr(), _fontdata[font->font_path].size()); - - } else { - FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ); - if (!f) { - FT_Done_FreeType(library); - ERR_FAIL_V_MSG(ERR_CANT_OPEN, "Cannot open font file '" + font->font_path + "'."); - } - - size_t len = f->get_len(); - _fontdata[font->font_path] = Vector<uint8_t>(); - Vector<uint8_t> &fontdata = _fontdata[font->font_path]; - fontdata.resize(len); - f->get_buffer(fontdata.ptrw(), len); - font->set_font_ptr(fontdata.ptr(), len); - f->close(); - } - } - - if (font->font_mem == nullptr && font->font_path != String()) { - FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ); - if (!f) { - FT_Done_FreeType(library); - ERR_FAIL_V_MSG(ERR_CANT_OPEN, "Cannot open font file '" + font->font_path + "'."); - } - - memset(&stream, 0, sizeof(FT_StreamRec)); - stream.base = nullptr; - stream.size = f->get_len(); - stream.pos = 0; - stream.descriptor.pointer = f; - stream.read = _ft_stream_io; - stream.close = _ft_stream_close; - - FT_Open_Args fargs; - memset(&fargs, 0, sizeof(FT_Open_Args)); - fargs.flags = FT_OPEN_STREAM; - fargs.stream = &stream; - error = FT_Open_Face(library, &fargs, 0, &face); - } else if (font->font_mem) { - memset(&stream, 0, sizeof(FT_StreamRec)); - stream.base = (unsigned char *)font->font_mem; - stream.size = font->font_mem_size; - stream.pos = 0; - - FT_Open_Args fargs; - memset(&fargs, 0, sizeof(FT_Open_Args)); - fargs.memory_base = (unsigned char *)font->font_mem; - fargs.memory_size = font->font_mem_size; - fargs.flags = FT_OPEN_MEMORY; - fargs.stream = &stream; - error = FT_Open_Face(library, &fargs, 0, &face); - - } else { - FT_Done_FreeType(library); - ERR_FAIL_V_MSG(ERR_UNCONFIGURED, "DynamicFont uninitialized."); - } - - //error = FT_New_Face( library, src_path.utf8().get_data(),0,&face ); - - if (error == FT_Err_Unknown_File_Format) { - FT_Done_FreeType(library); - ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, "Unknown font format."); - - } else if (error) { - FT_Done_FreeType(library); - ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, "Error loading font."); - } - - if (FT_HAS_COLOR(face) && face->num_fixed_sizes > 0) { - int best_match = 0; - int diff = ABS(id.size - ((int64_t)face->available_sizes[0].width)); - scale_color_font = float(id.size * oversampling) / face->available_sizes[0].width; - for (int i = 1; i < face->num_fixed_sizes; i++) { - int ndiff = ABS(id.size - ((int64_t)face->available_sizes[i].width)); - if (ndiff < diff) { - best_match = i; - diff = ndiff; - scale_color_font = float(id.size * oversampling) / face->available_sizes[i].width; - } - } - FT_Select_Size(face, best_match); - } else { - FT_Set_Pixel_Sizes(face, 0, id.size * oversampling); - } - - ascent = (face->size->metrics.ascender / 64.0) / oversampling * scale_color_font; - descent = (-face->size->metrics.descender / 64.0) / oversampling * scale_color_font; - underline_position = -face->underline_position / 64.0 / oversampling * scale_color_font; - underline_thickness = face->underline_thickness / 64.0 / oversampling * scale_color_font; - linegap = 0; - - valid = true; - return OK; -} - -float DynamicFontAtSize::font_oversampling = 1.0; - -float DynamicFontAtSize::get_height() const { - return ascent + descent; -} - -float DynamicFontAtSize::get_ascent() const { - return ascent; -} - -float DynamicFontAtSize::get_descent() const { - return descent; -} - -float DynamicFontAtSize::get_underline_position() const { - return underline_position; -} - -float DynamicFontAtSize::get_underline_thickness() const { - return underline_thickness; -} - -const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFontAtSize::_find_char_with_font(char32_t p_char, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const { - const Character *chr = char_map.getptr(p_char); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); - - if (!chr->found) { - //not found, try in fallbacks - for (int i = 0; i < p_fallbacks.size(); i++) { - DynamicFontAtSize *fb = const_cast<DynamicFontAtSize *>(p_fallbacks[i].ptr()); - if (!fb->valid) { - continue; - } - - fb->_update_char(p_char); - const Character *fallback_chr = fb->char_map.getptr(p_char); - ERR_CONTINUE(!fallback_chr); - - if (!fallback_chr->found) { - continue; - } - - return Pair<const Character *, DynamicFontAtSize *>(fallback_chr, fb); - } - - //not found, try 0xFFFD to display 'not found'. - const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD); - chr = char_map.getptr(0xFFFD); - ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr))); - } - - return Pair<const Character *, DynamicFontAtSize *>(chr, const_cast<DynamicFontAtSize *>(this)); -} - -Size2 DynamicFontAtSize::get_char_size(char32_t p_char, char32_t p_next, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const { - if (!valid) { - return Size2(1, 1); - } - const_cast<DynamicFontAtSize *>(this)->_update_char(p_char); - - Pair<const Character *, DynamicFontAtSize *> char_pair_with_font = _find_char_with_font(p_char, p_fallbacks); - const Character *ch = char_pair_with_font.first; - ERR_FAIL_COND_V(!ch, Size2()); - - Size2 ret(0, get_height()); - - if (ch->found) { - ret.x = ch->advance; - } - - return ret; -} - -String DynamicFontAtSize::get_available_chars() const { - String chars; - - FT_UInt gindex; - FT_ULong charcode = FT_Get_First_Char(face, &gindex); - while (gindex != 0) { - if (charcode != 0) { - chars += char32_t(charcode); - } - charcode = FT_Get_Next_Char(face, charcode, &gindex); - } - - return chars; -} - -float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks, bool p_advance_only, bool p_outline) const { - if (!valid) { - return 0; - } - - const_cast<DynamicFontAtSize *>(this)->_update_char(p_char); - - Pair<const Character *, DynamicFontAtSize *> char_pair_with_font = _find_char_with_font(p_char, p_fallbacks); - const Character *ch = char_pair_with_font.first; - DynamicFontAtSize *font = char_pair_with_font.second; - - ERR_FAIL_COND_V(!ch, 0.0); - - float advance = 0.0; - - // use normal character size if there's no outline character - if (p_outline && !ch->found) { - FT_GlyphSlot slot = face->glyph; - int error = FT_Load_Char(face, p_char, FT_HAS_COLOR(face) ? FT_LOAD_COLOR : FT_LOAD_DEFAULT); - if (!error) { - error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL); - if (!error) { - Character character = Character::not_found(); - character = const_cast<DynamicFontAtSize *>(this)->_bitmap_to_character(slot->bitmap, slot->bitmap_top, slot->bitmap_left, slot->advance.x / 64.0); - advance = character.advance; - } - } - } - - if (ch->found) { - ERR_FAIL_COND_V(ch->texture_idx < -1 || ch->texture_idx >= font->textures.size(), 0); - - if (!p_advance_only && ch->texture_idx != -1) { - Point2 cpos = p_pos; - cpos.x += ch->h_align; - cpos.y -= font->get_ascent(); - cpos.y += ch->v_align; - Color modulate = p_modulate; - if (FT_HAS_COLOR(face)) { - modulate.r = modulate.g = modulate.b = 1.0; - } - RID texture = font->textures[ch->texture_idx].texture->get_rid(); - RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, false); - } - - advance = ch->advance; - } - - return advance; -} - -unsigned long DynamicFontAtSize::_ft_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count) { - FileAccess *f = (FileAccess *)stream->descriptor.pointer; - - if (f->get_position() != offset) { - f->seek(offset); - } - - if (count == 0) { - return 0; - } - - return f->get_buffer(buffer, count); -} - -void DynamicFontAtSize::_ft_stream_close(FT_Stream stream) { - FileAccess *f = (FileAccess *)stream->descriptor.pointer; - f->close(); - memdelete(f); -} - -DynamicFontAtSize::Character DynamicFontAtSize::Character::not_found() { - Character ch; - ch.texture_idx = -1; - ch.advance = 0; - ch.h_align = 0; - ch.v_align = 0; - ch.found = false; - return ch; -} - -DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyph(int p_color_size, Image::Format p_image_format, int p_width, int p_height) { - TexturePosition ret; - ret.index = -1; - ret.x = 0; - ret.y = 0; - - int mw = p_width; - int mh = p_height; - - for (int i = 0; i < textures.size(); i++) { - const CharTexture &ct = textures[i]; - - if (ct.texture->get_format() != p_image_format) { - continue; - } - - if (mw > ct.texture_size || mh > ct.texture_size) { //too big for this texture - continue; - } - - ret.y = 0x7FFFFFFF; - ret.x = 0; - - for (int j = 0; j < ct.texture_size - mw; j++) { - int max_y = 0; - - for (int k = j; k < j + mw; k++) { - int y = ct.offsets[k]; - if (y > max_y) { - max_y = y; - } - } - - if (max_y < ret.y) { - ret.y = max_y; - ret.x = j; - } - } - - if (ret.y == 0x7FFFFFFF || ret.y + mh > ct.texture_size) { - continue; //fail, could not fit it here - } - - ret.index = i; - break; - } - - if (ret.index == -1) { - //could not find texture to fit, create one - ret.x = 0; - ret.y = 0; - - int texsize = MAX(id.size * oversampling * 8, 256); - if (mw > texsize) { - texsize = mw; //special case, adapt to it? - } - if (mh > texsize) { - texsize = mh; //special case, adapt to it? - } - - texsize = next_power_of_2(texsize); - - texsize = MIN(texsize, 4096); - - CharTexture tex; - tex.texture_size = texsize; - tex.imgdata.resize(texsize * texsize * p_color_size); //grayscale alpha - - { - //zero texture - uint8_t *w = tex.imgdata.ptrw(); - ERR_FAIL_COND_V(texsize * texsize * p_color_size > tex.imgdata.size(), ret); - - // Initialize the texture to all-white pixels to prevent artifacts when the - // font is displayed at a non-default scale with filtering enabled. - if (p_color_size == 2) { - for (int i = 0; i < texsize * texsize * p_color_size; i += 2) { - w[i + 0] = 255; - w[i + 1] = 0; - } - } else { - for (int i = 0; i < texsize * texsize * p_color_size; i += 4) { - w[i + 0] = 255; - w[i + 1] = 255; - w[i + 2] = 255; - w[i + 3] = 0; - } - } - } - tex.offsets.resize(texsize); - for (int i = 0; i < texsize; i++) { //zero offsets - tex.offsets.write[i] = 0; - } - - textures.push_back(tex); - ret.index = textures.size() - 1; - } - - return ret; -} - -DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap bitmap, int yofs, int xofs, float advance) { - int w = bitmap.width; - int h = bitmap.rows; - - int mw = w + rect_margin * 2; - int mh = h + rect_margin * 2; - - ERR_FAIL_COND_V(mw > 4096, Character::not_found()); - ERR_FAIL_COND_V(mh > 4096, Character::not_found()); - - int color_size = bitmap.pixel_mode == FT_PIXEL_MODE_BGRA ? 4 : 2; - Image::Format require_format = color_size == 4 ? Image::FORMAT_RGBA8 : Image::FORMAT_LA8; - - TexturePosition tex_pos = _find_texture_pos_for_glyph(color_size, require_format, mw, mh); - ERR_FAIL_COND_V(tex_pos.index < 0, Character::not_found()); - - //fit character in char texture - - CharTexture &tex = textures.write[tex_pos.index]; - - { - uint8_t *wr = tex.imgdata.ptrw(); - - for (int i = 0; i < h; i++) { - for (int j = 0; j < w; j++) { - int ofs = ((i + tex_pos.y + rect_margin) * tex.texture_size + j + tex_pos.x + rect_margin) * color_size; - ERR_FAIL_COND_V(ofs >= tex.imgdata.size(), Character::not_found()); - switch (bitmap.pixel_mode) { - case FT_PIXEL_MODE_MONO: { - int byte = i * bitmap.pitch + (j >> 3); - int bit = 1 << (7 - (j % 8)); - wr[ofs + 0] = 255; //grayscale as 1 - wr[ofs + 1] = (bitmap.buffer[byte] & bit) ? 255 : 0; - } break; - case FT_PIXEL_MODE_GRAY: - wr[ofs + 0] = 255; //grayscale as 1 - wr[ofs + 1] = bitmap.buffer[i * bitmap.pitch + j]; - break; - case FT_PIXEL_MODE_BGRA: { - int ofs_color = i * bitmap.pitch + (j << 2); - wr[ofs + 2] = bitmap.buffer[ofs_color + 0]; - wr[ofs + 1] = bitmap.buffer[ofs_color + 1]; - wr[ofs + 0] = bitmap.buffer[ofs_color + 2]; - wr[ofs + 3] = bitmap.buffer[ofs_color + 3]; - } break; - // TODO: FT_PIXEL_MODE_LCD - default: - ERR_FAIL_V_MSG(Character::not_found(), "Font uses unsupported pixel format: " + itos(bitmap.pixel_mode) + "."); - break; - } - } - } - } - - //blit to image and texture - { - Ref<Image> img = memnew(Image(tex.texture_size, tex.texture_size, 0, require_format, tex.imgdata)); - - if (tex.texture.is_null()) { - tex.texture.instance(); - tex.texture->create_from_image(img); - } else { - tex.texture->update(img); //update - } - } - - // update height array - - for (int k = tex_pos.x; k < tex_pos.x + mw; k++) { - tex.offsets.write[k] = tex_pos.y + mh; - } - - Character chr; - chr.h_align = xofs * scale_color_font / oversampling; - chr.v_align = ascent - (yofs * scale_color_font / oversampling); // + ascent - descent; - chr.advance = advance * scale_color_font / oversampling; - chr.texture_idx = tex_pos.index; - chr.found = true; - - chr.rect_uv = Rect2(tex_pos.x + rect_margin, tex_pos.y + rect_margin, w, h); - chr.rect = chr.rect_uv; - chr.rect.position /= oversampling; - chr.rect.size = chr.rect.size * scale_color_font / oversampling; - return chr; -} - -DynamicFontAtSize::Character DynamicFontAtSize::_make_outline_char(char32_t p_char) { - Character ret = Character::not_found(); - - if (FT_Load_Char(face, p_char, FT_LOAD_NO_BITMAP | (font->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)) != 0) { - return ret; - } - - FT_Stroker stroker; - if (FT_Stroker_New(library, &stroker) != 0) { - return ret; - } - - FT_Stroker_Set(stroker, (int)(id.outline_size * oversampling * 64.0), FT_STROKER_LINECAP_BUTT, FT_STROKER_LINEJOIN_ROUND, 0); - FT_Glyph glyph; - FT_BitmapGlyph glyph_bitmap; - - if (FT_Get_Glyph(face->glyph, &glyph) != 0) { - goto cleanup_stroker; - } - if (FT_Glyph_Stroke(&glyph, stroker, 1) != 0) { - goto cleanup_glyph; - } - if (FT_Glyph_To_Bitmap(&glyph, font->antialiased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO, nullptr, 1) != 0) { - goto cleanup_glyph; - } - - glyph_bitmap = (FT_BitmapGlyph)glyph; - ret = _bitmap_to_character(glyph_bitmap->bitmap, glyph_bitmap->top, glyph_bitmap->left, glyph->advance.x / 65536.0); - -cleanup_glyph: - FT_Done_Glyph(glyph); -cleanup_stroker: - FT_Stroker_Done(stroker); - return ret; -} - -void DynamicFontAtSize::_update_char(char32_t p_char) { - if (char_map.has(p_char)) { - return; - } - - _THREAD_SAFE_METHOD_ - - Character character = Character::not_found(); - - FT_GlyphSlot slot = face->glyph; - - if (FT_Get_Char_Index(face, p_char) == 0) { - char_map[p_char] = character; - return; - } - - int ft_hinting; - - switch (font->hinting) { - case DynamicFontData::HINTING_NONE: - ft_hinting = FT_LOAD_NO_HINTING; - break; - case DynamicFontData::HINTING_LIGHT: - ft_hinting = FT_LOAD_TARGET_LIGHT; - break; - default: - ft_hinting = FT_LOAD_TARGET_NORMAL; - break; - } - - int error = FT_Load_Char(face, p_char, FT_HAS_COLOR(face) ? FT_LOAD_COLOR : FT_LOAD_DEFAULT | (font->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0) | ft_hinting); - if (error) { - char_map[p_char] = character; - return; - } - - if (id.outline_size > 0) { - character = _make_outline_char(p_char); - } else { - error = FT_Render_Glyph(face->glyph, font->antialiased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO); - if (!error) { - character = _bitmap_to_character(slot->bitmap, slot->bitmap_top, slot->bitmap_left, slot->advance.x / 64.0); - } - } - - char_map[p_char] = character; -} - -void DynamicFontAtSize::update_oversampling() { - if (oversampling == font_oversampling || !valid) { - return; - } - - FT_Done_FreeType(library); - textures.clear(); - char_map.clear(); - oversampling = font_oversampling; - valid = false; - _load(); -} - -DynamicFontAtSize::DynamicFontAtSize() { - valid = false; - rect_margin = 1; - ascent = 1; - descent = 1; - linegap = 1; - oversampling = font_oversampling; - scale_color_font = 1; -} - -DynamicFontAtSize::~DynamicFontAtSize() { - if (valid) { - FT_Done_FreeType(library); - } - font->size_cache.erase(id); - font.unref(); -} - -///////////////////////// - -void DynamicFont::_reload_cache() { - ERR_FAIL_COND(cache_id.size < 1); - if (!data.is_valid()) { - data_at_size.unref(); - outline_data_at_size.unref(); - fallbacks.resize(0); - fallback_data_at_size.resize(0); - fallback_outline_data_at_size.resize(0); - return; - } - - data_at_size = data->_get_dynamic_font_at_size(cache_id); - if (outline_cache_id.outline_size > 0) { - outline_data_at_size = data->_get_dynamic_font_at_size(outline_cache_id); - fallback_outline_data_at_size.resize(fallback_data_at_size.size()); - } else { - outline_data_at_size.unref(); - fallback_outline_data_at_size.resize(0); - } - - for (int i = 0; i < fallbacks.size(); i++) { - fallback_data_at_size.write[i] = fallbacks.write[i]->_get_dynamic_font_at_size(cache_id); - if (outline_cache_id.outline_size > 0) { - fallback_outline_data_at_size.write[i] = fallbacks.write[i]->_get_dynamic_font_at_size(outline_cache_id); - } - } - - emit_changed(); - _change_notify(); -} - -void DynamicFont::set_font_data(const Ref<DynamicFontData> &p_data) { - data = p_data; - _reload_cache(); - - emit_changed(); - _change_notify(); -} - -Ref<DynamicFontData> DynamicFont::get_font_data() const { - return data; -} - -void DynamicFont::set_size(int p_size) { - if (cache_id.size == p_size) { - return; - } - cache_id.size = p_size; - outline_cache_id.size = p_size; - _reload_cache(); -} - -int DynamicFont::get_size() const { - return cache_id.size; -} - -void DynamicFont::set_outline_size(int p_size) { - if (outline_cache_id.outline_size == p_size) { - return; - } - ERR_FAIL_COND(p_size < 0 || p_size > UINT8_MAX); - outline_cache_id.outline_size = p_size; - _reload_cache(); -} - -int DynamicFont::get_outline_size() const { - return outline_cache_id.outline_size; -} - -void DynamicFont::set_outline_color(Color p_color) { - if (p_color != outline_color) { - outline_color = p_color; - emit_changed(); - _change_notify(); - } -} - -Color DynamicFont::get_outline_color() const { - return outline_color; -} - -bool DynamicFontData::is_antialiased() const { - return antialiased; -} - -void DynamicFontData::set_antialiased(bool p_antialiased) { - if (antialiased == p_antialiased) { - return; - } - antialiased = p_antialiased; -} - -DynamicFontData::Hinting DynamicFontData::get_hinting() const { - return hinting; -} - -void DynamicFontData::set_hinting(Hinting p_hinting) { - if (hinting == p_hinting) { - return; - } - hinting = p_hinting; -} - -int DynamicFont::get_spacing(int p_type) const { - if (p_type == SPACING_TOP) { - return spacing_top; - } else if (p_type == SPACING_BOTTOM) { - return spacing_bottom; - } else if (p_type == SPACING_CHAR) { - return spacing_char; - } else if (p_type == SPACING_SPACE) { - return spacing_space; - } - - return 0; -} - -void DynamicFont::set_spacing(int p_type, int p_value) { - if (p_type == SPACING_TOP) { - spacing_top = p_value; - } else if (p_type == SPACING_BOTTOM) { - spacing_bottom = p_value; - } else if (p_type == SPACING_CHAR) { - spacing_char = p_value; - } else if (p_type == SPACING_SPACE) { - spacing_space = p_value; - } - - emit_changed(); - _change_notify(); -} - -float DynamicFont::get_height() const { - if (!data_at_size.is_valid()) { - return 1; - } - - return data_at_size->get_height() + spacing_top + spacing_bottom; -} - -float DynamicFont::get_ascent() const { - if (!data_at_size.is_valid()) { - return 1; - } - - return data_at_size->get_ascent() + spacing_top; -} - -float DynamicFont::get_descent() const { - if (!data_at_size.is_valid()) { - return 1; - } - - return data_at_size->get_descent() + spacing_bottom; -} - -float DynamicFont::get_underline_position() const { - if (!data_at_size.is_valid()) { - return 2; - } - - return data_at_size->get_underline_position(); -} - -float DynamicFont::get_underline_thickness() const { - if (!data_at_size.is_valid()) { - return 1; - } - - return data_at_size->get_underline_thickness(); -} - -Size2 DynamicFont::get_char_size(char32_t p_char, char32_t p_next) const { - if (!data_at_size.is_valid()) { - return Size2(1, 1); - } - - Size2 ret = data_at_size->get_char_size(p_char, p_next, fallback_data_at_size); - if (p_char == ' ') { - ret.width += spacing_space + spacing_char; - } else if (p_next) { - ret.width += spacing_char; - } - - return ret; -} - -String DynamicFont::get_available_chars() const { - if (!data_at_size.is_valid()) { - return ""; - } - - String chars = data_at_size->get_available_chars(); - - for (int i = 0; i < fallback_data_at_size.size(); i++) { - String fallback_chars = fallback_data_at_size[i]->get_available_chars(); - for (int j = 0; j < fallback_chars.length(); j++) { - if (chars.find_char(fallback_chars[j]) == -1) { - chars += fallback_chars[j]; - } - } - } - - return chars; -} - -bool DynamicFont::is_distance_field_hint() const { - return false; -} - -bool DynamicFont::has_outline() const { - return outline_cache_id.outline_size > 0; -} - -float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next, const Color &p_modulate, bool p_outline) const { - const Ref<DynamicFontAtSize> &font_at_size = p_outline && outline_cache_id.outline_size > 0 ? outline_data_at_size : data_at_size; - - if (!font_at_size.is_valid()) { - return 0; - } - - const Vector<Ref<DynamicFontAtSize>> &fallbacks = p_outline && outline_cache_id.outline_size > 0 ? fallback_outline_data_at_size : fallback_data_at_size; - Color color = p_outline && outline_cache_id.outline_size > 0 ? p_modulate * outline_color : p_modulate; - - // If requested outline draw, but no outline is present, simply return advance without drawing anything - bool advance_only = p_outline && outline_cache_id.outline_size == 0; - return font_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, color, fallbacks, advance_only, p_outline) + spacing_char; -} - -void DynamicFont::set_fallback(int p_idx, const Ref<DynamicFontData> &p_data) { - ERR_FAIL_COND(p_data.is_null()); - ERR_FAIL_INDEX(p_idx, fallbacks.size()); - fallbacks.write[p_idx] = p_data; - fallback_data_at_size.write[p_idx] = fallbacks.write[p_idx]->_get_dynamic_font_at_size(cache_id); -} - -void DynamicFont::add_fallback(const Ref<DynamicFontData> &p_data) { - ERR_FAIL_COND(p_data.is_null()); - fallbacks.push_back(p_data); - fallback_data_at_size.push_back(fallbacks.write[fallbacks.size() - 1]->_get_dynamic_font_at_size(cache_id)); //const.. - if (outline_cache_id.outline_size > 0) { - fallback_outline_data_at_size.push_back(fallbacks.write[fallbacks.size() - 1]->_get_dynamic_font_at_size(outline_cache_id)); - } - - _change_notify(); - emit_changed(); - _change_notify(); -} - -int DynamicFont::get_fallback_count() const { - return fallbacks.size(); -} - -Ref<DynamicFontData> DynamicFont::get_fallback(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, fallbacks.size(), Ref<DynamicFontData>()); - - return fallbacks[p_idx]; -} - -void DynamicFont::remove_fallback(int p_idx) { - ERR_FAIL_INDEX(p_idx, fallbacks.size()); - fallbacks.remove(p_idx); - fallback_data_at_size.remove(p_idx); - emit_changed(); - _change_notify(); -} - -bool DynamicFont::_set(const StringName &p_name, const Variant &p_value) { - String str = p_name; - if (str.begins_with("fallback/")) { - int idx = str.get_slicec('/', 1).to_int(); - Ref<DynamicFontData> fd = p_value; - - if (fd.is_valid()) { - if (idx == fallbacks.size()) { - add_fallback(fd); - return true; - } else if (idx >= 0 && idx < fallbacks.size()) { - set_fallback(idx, fd); - return true; - } else { - return false; - } - } else if (idx >= 0 && idx < fallbacks.size()) { - remove_fallback(idx); - return true; - } - } - - return false; -} - -bool DynamicFont::_get(const StringName &p_name, Variant &r_ret) const { - String str = p_name; - if (str.begins_with("fallback/")) { - int idx = str.get_slicec('/', 1).to_int(); - - if (idx == fallbacks.size()) { - r_ret = Ref<DynamicFontData>(); - return true; - } else if (idx >= 0 && idx < fallbacks.size()) { - r_ret = get_fallback(idx); - return true; - } - } - - return false; -} - -void DynamicFont::_get_property_list(List<PropertyInfo> *p_list) const { - for (int i = 0; i < fallbacks.size(); i++) { - p_list->push_back(PropertyInfo(Variant::OBJECT, "fallback/" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "DynamicFontData")); - } - - p_list->push_back(PropertyInfo(Variant::OBJECT, "fallback/" + itos(fallbacks.size()), PROPERTY_HINT_RESOURCE_TYPE, "DynamicFontData")); -} - -void DynamicFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); - ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); - - ClassDB::bind_method(D_METHOD("get_available_chars"), &DynamicFont::get_available_chars); - - ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); - ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); - - ClassDB::bind_method(D_METHOD("set_outline_size", "size"), &DynamicFont::set_outline_size); - ClassDB::bind_method(D_METHOD("get_outline_size"), &DynamicFont::get_outline_size); - - ClassDB::bind_method(D_METHOD("set_outline_color", "color"), &DynamicFont::set_outline_color); - ClassDB::bind_method(D_METHOD("get_outline_color"), &DynamicFont::get_outline_color); - - ClassDB::bind_method(D_METHOD("set_spacing", "type", "value"), &DynamicFont::set_spacing); - ClassDB::bind_method(D_METHOD("get_spacing", "type"), &DynamicFont::get_spacing); - - ClassDB::bind_method(D_METHOD("add_fallback", "data"), &DynamicFont::add_fallback); - ClassDB::bind_method(D_METHOD("set_fallback", "idx", "data"), &DynamicFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback", "idx"), &DynamicFont::get_fallback); - ClassDB::bind_method(D_METHOD("remove_fallback", "idx"), &DynamicFont::remove_fallback); - ClassDB::bind_method(D_METHOD("get_fallback_count"), &DynamicFont::get_fallback_count); - - ADD_GROUP("Settings", ""); - ADD_PROPERTY(PropertyInfo(Variant::INT, "size", PROPERTY_HINT_RANGE, "1,1024,1"), "set_size", "get_size"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size", PROPERTY_HINT_RANGE, "0,1024,1"), "set_outline_size", "get_outline_size"); - ADD_PROPERTY(PropertyInfo(Variant::COLOR, "outline_color"), "set_outline_color", "get_outline_color"); - ADD_GROUP("Extra Spacing", "extra_spacing"); - ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_top"), "set_spacing", "get_spacing", SPACING_TOP); - ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_bottom"), "set_spacing", "get_spacing", SPACING_BOTTOM); - ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_char"), "set_spacing", "get_spacing", SPACING_CHAR); - ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_space"), "set_spacing", "get_spacing", SPACING_SPACE); - ADD_GROUP("Font", ""); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "font_data", PROPERTY_HINT_RESOURCE_TYPE, "DynamicFontData"), "set_font_data", "get_font_data"); - - BIND_ENUM_CONSTANT(SPACING_TOP); - BIND_ENUM_CONSTANT(SPACING_BOTTOM); - BIND_ENUM_CONSTANT(SPACING_CHAR); - BIND_ENUM_CONSTANT(SPACING_SPACE); -} - -Mutex DynamicFont::dynamic_font_mutex; - -SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = nullptr; - -DynamicFont::DynamicFont() : - font_list(this) { - valid = false; - cache_id.size = 16; - outline_cache_id.size = 16; - spacing_top = 0; - spacing_bottom = 0; - spacing_char = 0; - spacing_space = 0; - outline_color = Color(1, 1, 1); - - MutexLock lock(dynamic_font_mutex); - dynamic_fonts->add(&font_list); -} - -DynamicFont::~DynamicFont() { - MutexLock lock(dynamic_font_mutex); - dynamic_fonts->remove(&font_list); -} - -void DynamicFont::initialize_dynamic_fonts() { - dynamic_fonts = memnew(SelfList<DynamicFont>::List()); -} - -void DynamicFont::finish_dynamic_fonts() { - memdelete(dynamic_fonts); - dynamic_fonts = nullptr; -} - -void DynamicFont::update_oversampling() { - Vector<Ref<DynamicFont>> changed; - { - MutexLock lock(dynamic_font_mutex); - - SelfList<DynamicFont> *E = dynamic_fonts->first(); - while (E) { - if (E->self()->data_at_size.is_valid()) { - E->self()->data_at_size->update_oversampling(); - - if (E->self()->outline_data_at_size.is_valid()) { - E->self()->outline_data_at_size->update_oversampling(); - } - - for (int i = 0; i < E->self()->fallback_data_at_size.size(); i++) { - if (E->self()->fallback_data_at_size[i].is_valid()) { - E->self()->fallback_data_at_size.write[i]->update_oversampling(); - - if (E->self()->has_outline() && E->self()->fallback_outline_data_at_size[i].is_valid()) { - E->self()->fallback_outline_data_at_size.write[i]->update_oversampling(); - } - } - } - - changed.push_back(Ref<DynamicFont>(E->self())); - } - - E = E->next(); - } - } - - for (int i = 0; i < changed.size(); i++) { - changed.write[i]->emit_changed(); - } -} - -///////////////////////// - -RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { - if (r_error) { - *r_error = ERR_FILE_CANT_OPEN; - } - - Ref<DynamicFontData> dfont; - dfont.instance(); - dfont->set_font_path(p_path); - - if (r_error) { - *r_error = OK; - } - - return dfont; -} - -void ResourceFormatLoaderDynamicFont::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("ttf"); - p_extensions->push_back("otf"); -} - -bool ResourceFormatLoaderDynamicFont::handles_type(const String &p_type) const { - return (p_type == "DynamicFontData"); -} - -String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const { - String el = p_path.get_extension().to_lower(); - if (el == "ttf" || el == "otf") { - return "DynamicFontData"; - } - return ""; -} - -#endif diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h deleted file mode 100644 index 73ba42f8a7..0000000000 --- a/scene/resources/dynamic_font.h +++ /dev/null @@ -1,316 +0,0 @@ -/*************************************************************************/ -/* dynamic_font.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef DYNAMIC_FONT_H -#define DYNAMIC_FONT_H - -#include "modules/modules_enabled.gen.h" -#ifdef MODULE_FREETYPE_ENABLED - -#include "core/io/resource_loader.h" -#include "core/os/mutex.h" -#include "core/os/thread_safe.h" -#include "core/templates/pair.h" -#include "scene/resources/font.h" - -#include <ft2build.h> -#include FT_FREETYPE_H - -class DynamicFontAtSize; -class DynamicFont; - -class DynamicFontData : public Resource { - GDCLASS(DynamicFontData, Resource); - -public: - struct CacheID { - union { - struct { - uint32_t size : 16; - uint32_t outline_size : 8; - uint32_t unused : 8; - }; - uint32_t key; - }; - bool operator<(CacheID right) const; - CacheID() { - key = 0; - } - }; - - enum Hinting { - HINTING_NONE, - HINTING_LIGHT, - HINTING_NORMAL - }; - - bool is_antialiased() const; - void set_antialiased(bool p_antialiased); - Hinting get_hinting() const; - void set_hinting(Hinting p_hinting); - -private: - const uint8_t *font_mem; - int font_mem_size; - bool antialiased; - bool force_autohinter; - Hinting hinting; - - String font_path; - Map<CacheID, DynamicFontAtSize *> size_cache; - - friend class DynamicFontAtSize; - - friend class DynamicFont; - - Ref<DynamicFontAtSize> _get_dynamic_font_at_size(CacheID p_cache_id); - -protected: - static void _bind_methods(); - -public: - void set_font_ptr(const uint8_t *p_font_mem, int p_font_mem_size); - void set_font_path(const String &p_path); - String get_font_path() const; - void set_force_autohinter(bool p_force); - - DynamicFontData(); - ~DynamicFontData(); -}; - -VARIANT_ENUM_CAST(DynamicFontData::Hinting); - -class DynamicFontAtSize : public Reference { - GDCLASS(DynamicFontAtSize, Reference); - - _THREAD_SAFE_CLASS_ - - FT_Library library; /* handle to library */ - FT_Face face; /* handle to face object */ - FT_StreamRec stream; - - float ascent; - float descent; - float linegap; - float rect_margin; - float oversampling; - float scale_color_font; - float underline_position; - float underline_thickness; - - bool valid; - - struct CharTexture { - Vector<uint8_t> imgdata; - int texture_size; - Vector<int> offsets; - Ref<ImageTexture> texture; - }; - - Vector<CharTexture> textures; - - struct Character { - bool found; - int texture_idx; - Rect2 rect; - Rect2 rect_uv; - float v_align; - float h_align; - float advance; - - Character() { - texture_idx = 0; - v_align = 0; - } - - static Character not_found(); - }; - - struct TexturePosition { - int index; - int x; - int y; - }; - - const Pair<const Character *, DynamicFontAtSize *> _find_char_with_font(char32_t p_char, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const; - Character _make_outline_char(char32_t p_char); - TexturePosition _find_texture_pos_for_glyph(int p_color_size, Image::Format p_image_format, int p_width, int p_height); - Character _bitmap_to_character(FT_Bitmap bitmap, int yofs, int xofs, float advance); - - static unsigned long _ft_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count); - static void _ft_stream_close(FT_Stream stream); - - HashMap<char32_t, Character> char_map; - - _FORCE_INLINE_ void _update_char(char32_t p_char); - - friend class DynamicFontData; - Ref<DynamicFontData> font; - DynamicFontData::CacheID id; - - static HashMap<String, Vector<uint8_t>> _fontdata; - Error _load(); - -public: - static float font_oversampling; - - float get_height() const; - - float get_ascent() const; - float get_descent() const; - float get_underline_position() const; - float get_underline_thickness() const; - - Size2 get_char_size(char32_t p_char, char32_t p_next, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const; - String get_available_chars() const; - - float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks, bool p_advance_only = false, bool p_outline = false) const; - - void set_texture_flags(uint32_t p_flags); - void update_oversampling(); - - DynamicFontAtSize(); - ~DynamicFontAtSize(); -}; - -/////////////// - -class DynamicFont : public Font { - GDCLASS(DynamicFont, Font); - -public: - enum SpacingType { - SPACING_TOP, - SPACING_BOTTOM, - SPACING_CHAR, - SPACING_SPACE - }; - -private: - Ref<DynamicFontData> data; - Ref<DynamicFontAtSize> data_at_size; - Ref<DynamicFontAtSize> outline_data_at_size; - - Vector<Ref<DynamicFontData>> fallbacks; - Vector<Ref<DynamicFontAtSize>> fallback_data_at_size; - Vector<Ref<DynamicFontAtSize>> fallback_outline_data_at_size; - - DynamicFontData::CacheID cache_id; - DynamicFontData::CacheID outline_cache_id; - - bool valid; - int spacing_top; - int spacing_bottom; - int spacing_char; - int spacing_space; - - Color outline_color; - -protected: - void _reload_cache(); - - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; - - static void _bind_methods(); - -public: - void set_font_data(const Ref<DynamicFontData> &p_data); - Ref<DynamicFontData> get_font_data() const; - - void set_size(int p_size); - int get_size() const; - - void set_outline_size(int p_size); - int get_outline_size() const; - - void set_outline_color(Color p_color); - Color get_outline_color() const; - - bool get_use_mipmaps() const; - void set_use_mipmaps(bool p_enable); - - bool get_use_filter() const; - void set_use_filter(bool p_enable); - - int get_spacing(int p_type) const; - void set_spacing(int p_type, int p_value); - - void add_fallback(const Ref<DynamicFontData> &p_data); - void set_fallback(int p_idx, const Ref<DynamicFontData> &p_data); - int get_fallback_count() const; - Ref<DynamicFontData> get_fallback(int p_idx) const; - void remove_fallback(int p_idx); - - virtual float get_height() const override; - - virtual float get_ascent() const override; - virtual float get_descent() const override; - virtual float get_underline_position() const override; - virtual float get_underline_thickness() const override; - - virtual Size2 get_char_size(char32_t p_char, char32_t p_next = 0) const override; - String get_available_chars() const; - - virtual bool is_distance_field_hint() const override; - - virtual bool has_outline() const override; - - virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const override; - - SelfList<DynamicFont> font_list; - - static Mutex dynamic_font_mutex; - static SelfList<DynamicFont>::List *dynamic_fonts; - - static void initialize_dynamic_fonts(); - static void finish_dynamic_fonts(); - static void update_oversampling(); - - DynamicFont(); - ~DynamicFont(); -}; - -VARIANT_ENUM_CAST(DynamicFont::SpacingType); - -///////////// - -class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { -public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; -}; - -#endif - -#endif diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 7bda889e46..da35137a09 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -31,639 +31,890 @@ #include "font.h" #include "core/io/resource_loader.h" -#include "core/os/file_access.h" - -void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate, const Color &p_outline_modulate) const { - float length = get_string_size(p_text).width; - if (length >= p_width) { - draw(p_canvas_item, p_pos, p_text, p_modulate, p_width, p_outline_modulate); - return; - } - - float ofs = 0.f; - switch (p_align) { - case HALIGN_LEFT: { - ofs = 0; - } break; - case HALIGN_CENTER: { - ofs = Math::floor((p_width - length) / 2.0); - } break; - case HALIGN_RIGHT: { - ofs = p_width - length; - } break; - default: { - ERR_PRINT("Unknown halignment type"); - } break; - } - draw(p_canvas_item, p_pos + Point2(ofs, 0), p_text, p_modulate, p_width, p_outline_modulate); -} - -void Font::draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w, const Color &p_outline_modulate) const { - Vector2 ofs; - - int chars_drawn = 0; - bool with_outline = has_outline(); - for (int i = 0; i < p_text.length(); i++) { - int width = get_char_size(p_text[i]).width; - - if (p_clip_w >= 0 && (ofs.x + width) > p_clip_w) { - break; //clip - } +#include "core/string/translation.h" +#include "core/templates/hashfuncs.h" +#include "scene/resources/text_line.h" +#include "scene/resources/text_paragraph.h" - ofs.x += draw_char(p_canvas_item, p_pos + ofs, p_text[i], p_text[i + 1], with_outline ? p_outline_modulate : p_modulate, with_outline); - ++chars_drawn; - } +void FontData::_bind_methods() { + ClassDB::bind_method(D_METHOD("load_resource", "filename", "base_size"), &FontData::load_resource, DEFVAL(16)); + ClassDB::bind_method(D_METHOD("load_memory", "data", "type", "base_size"), &FontData::_load_memory, DEFVAL(16)); - if (has_outline()) { - ofs = Vector2(0, 0); - for (int i = 0; i < chars_drawn; i++) { - ofs.x += draw_char(p_canvas_item, p_pos + ofs, p_text[i], p_text[i + 1], p_modulate, false); - } - } -} + ClassDB::bind_method(D_METHOD("set_data_path", "path"), &FontData::set_data_path); + ClassDB::bind_method(D_METHOD("get_data_path"), &FontData::get_data_path); -void Font::update_changes() { - emit_changed(); -} + ClassDB::bind_method(D_METHOD("get_height", "size"), &FontData::get_height); + ClassDB::bind_method(D_METHOD("get_ascent", "size"), &FontData::get_ascent); + ClassDB::bind_method(D_METHOD("get_descent", "size"), &FontData::get_descent); -void Font::_bind_methods() { - ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "string", "modulate", "clip_w", "outline_modulate"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1), DEFVAL(Color(1, 1, 1))); - ClassDB::bind_method(D_METHOD("get_ascent"), &Font::get_ascent); - ClassDB::bind_method(D_METHOD("get_descent"), &Font::get_descent); - ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height); - ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint); - ClassDB::bind_method(D_METHOD("get_char_size", "char", "next"), &Font::get_char_size, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size); - ClassDB::bind_method(D_METHOD("get_wordwrap_string_size", "string", "width"), &Font::get_wordwrap_string_size); - ClassDB::bind_method(D_METHOD("has_outline"), &Font::has_outline); - ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate", "outline"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes); -} + ClassDB::bind_method(D_METHOD("get_underline_position", "size"), &FontData::get_underline_position); + ClassDB::bind_method(D_METHOD("get_underline_thickness", "size"), &FontData::get_underline_thickness); -Font::Font() { -} + ClassDB::bind_method(D_METHOD("set_antialiased", "antialiased"), &FontData::set_antialiased); + ClassDB::bind_method(D_METHOD("get_antialiased"), &FontData::get_antialiased); -///////////////////////////////////////////////////////////////// + ClassDB::bind_method(D_METHOD("set_hinting", "hinting"), &FontData::set_hinting); + ClassDB::bind_method(D_METHOD("get_hinting"), &FontData::get_hinting); -void BitmapFont::_set_chars(const Vector<int> &p_chars) { - int len = p_chars.size(); - //char 1 charsize 1 texture, 4 rect, 2 align, advance 1 - ERR_FAIL_COND(len % 9); - if (!len) { - return; //none to do - } - int chars = len / 9; + ClassDB::bind_method(D_METHOD("set_force_autohinter", "enabled"), &FontData::set_force_autohinter); + ClassDB::bind_method(D_METHOD("get_force_autohinter"), &FontData::get_force_autohinter); + + ClassDB::bind_method(D_METHOD("set_distance_field_hint", "distance_field"), &FontData::set_distance_field_hint); + ClassDB::bind_method(D_METHOD("get_distance_field_hint"), &FontData::get_distance_field_hint); - const int *r = p_chars.ptr(); - for (int i = 0; i < chars; i++) { - const int *data = &r[i * 9]; - add_char(data[0], data[1], Rect2(data[2], data[3], data[4], data[5]), Size2(data[6], data[7]), data[8]); + ClassDB::bind_method(D_METHOD("has_char", "char"), &FontData::has_char); + ClassDB::bind_method(D_METHOD("get_supported_chars"), &FontData::get_supported_chars); + + ClassDB::bind_method(D_METHOD("get_glyph_advance", "index", "size"), &FontData::get_glyph_advance); + ClassDB::bind_method(D_METHOD("get_glyph_kerning", "index_a", "index_b", "size"), &FontData::get_glyph_kerning); + + ClassDB::bind_method(D_METHOD("get_base_size"), &FontData::get_base_size); + + ClassDB::bind_method(D_METHOD("has_outline"), &FontData::has_outline); + + ClassDB::bind_method(D_METHOD("is_language_supported", "language"), &FontData::is_language_supported); + ClassDB::bind_method(D_METHOD("set_language_support_override", "language", "supported"), &FontData::set_language_support_override); + ClassDB::bind_method(D_METHOD("get_language_support_override", "language"), &FontData::get_language_support_override); + ClassDB::bind_method(D_METHOD("remove_language_support_override", "language"), &FontData::remove_language_support_override); + ClassDB::bind_method(D_METHOD("get_language_support_overrides"), &FontData::get_language_support_overrides); + + ClassDB::bind_method(D_METHOD("is_script_supported", "script"), &FontData::is_script_supported); + ClassDB::bind_method(D_METHOD("set_script_support_override", "script", "supported"), &FontData::set_script_support_override); + ClassDB::bind_method(D_METHOD("get_script_support_override", "script"), &FontData::get_script_support_override); + ClassDB::bind_method(D_METHOD("remove_script_support_override", "script"), &FontData::remove_script_support_override); + ClassDB::bind_method(D_METHOD("get_script_support_overrides"), &FontData::get_script_support_overrides); + + ClassDB::bind_method(D_METHOD("get_glyph_index", "char", "variation_selector"), &FontData::get_glyph_index, DEFVAL(0x0000)); + ClassDB::bind_method(D_METHOD("draw_glyph", "canvas", "size", "pos", "index", "color"), &FontData::draw_glyph, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_glyph_outline", "canvas", "size", "outline_size", "pos", "index", "color"), &FontData::draw_glyph_outline, DEFVAL(Color(1, 1, 1))); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "data_path", PROPERTY_HINT_FILE, "*.ttf,*.otf,*.woff,*.fnt,*.font"), "set_data_path", "get_data_path"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased"), "set_antialiased", "get_antialiased"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter"), "set_force_autohinter", "get_force_autohinter"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distance_field_hint"), "set_distance_field_hint", "get_distance_field_hint"); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting"); +} + +bool FontData::_set(const StringName &p_name, const Variant &p_value) { + String str = p_name; + if (str.begins_with("language_support_override/")) { + String lang = str.get_slicec('/', 1); + if (lang == "_new") { + return false; + } + set_language_support_override(lang, p_value); + return true; + } + if (str.begins_with("script_support_override/")) { + String scr = str.get_slicec('/', 1); + if (scr == "_new") { + return false; + } + set_script_support_override(scr, p_value); + return true; } + + return false; } -Vector<int> BitmapFont::_get_chars() const { - Vector<int> chars; +bool FontData::_get(const StringName &p_name, Variant &r_ret) const { + String str = p_name; + if (str.begins_with("language_support_override/")) { + String lang = str.get_slicec('/', 1); + if (lang == "_new") { + return true; + } + r_ret = get_language_support_override(lang); + return true; + } + if (str.begins_with("script_support_override/")) { + String scr = str.get_slicec('/', 1); + if (scr == "_new") { + return true; + } + r_ret = get_script_support_override(scr); + return true; + } - const char32_t *key = nullptr; + return false; +} - while ((key = char_map.next(key))) { - const Character *c = char_map.getptr(*key); - ERR_FAIL_COND_V(!c, Vector<int>()); - chars.push_back(*key); - chars.push_back(c->texture_idx); - chars.push_back(c->rect.position.x); - chars.push_back(c->rect.position.y); +void FontData::_get_property_list(List<PropertyInfo> *p_list) const { + Vector<String> lang_over = get_language_support_overrides(); + for (int i = 0; i < lang_over.size(); i++) { + p_list->push_back(PropertyInfo(Variant::BOOL, "language_support_override/" + lang_over[i], PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE)); + } + p_list->push_back(PropertyInfo(Variant::NIL, "language_support_override/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); - chars.push_back(c->rect.size.x); - chars.push_back(c->rect.size.y); - chars.push_back(c->h_align); - chars.push_back(c->v_align); - chars.push_back(c->advance); + Vector<String> scr_over = get_script_support_overrides(); + for (int i = 0; i < scr_over.size(); i++) { + p_list->push_back(PropertyInfo(Variant::BOOL, "script_support_override/" + scr_over[i], PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE)); } + p_list->push_back(PropertyInfo(Variant::NIL, "script_support_override/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); +} - return chars; +RID FontData::get_rid() const { + return rid; } -void BitmapFont::_set_kernings(const Vector<int> &p_kernings) { - int len = p_kernings.size(); - ERR_FAIL_COND(len % 3); - if (!len) { - return; +void FontData::load_resource(const String &p_filename, int p_base_size) { + if (rid != RID()) { + TS->free(rid); } - const int *r = p_kernings.ptr(); + rid = TS->create_font_resource(p_filename, p_base_size); + path = p_filename; + base_size = TS->font_get_base_size(rid); + emit_changed(); +} - for (int i = 0; i < len / 3; i++) { - const int *data = &r[i * 3]; - add_kerning_pair(data[0], data[1], data[2]); +void FontData::_load_memory(const PackedByteArray &p_data, const String &p_type, int p_base_size) { + if (rid != RID()) { + TS->free(rid); } + rid = TS->create_font_memory(p_data.ptr(), p_data.size(), p_type, p_base_size); + path = TTR("(Memory: " + p_type.to_upper() + " @ 0x" + String::num_int64((uint64_t)p_data.ptr(), 16, true) + ")"); + base_size = TS->font_get_base_size(rid); + emit_changed(); } -Vector<int> BitmapFont::_get_kernings() const { - Vector<int> kernings; - - for (Map<KerningPairKey, int>::Element *E = kerning_map.front(); E; E = E->next()) { - kernings.push_back(E->key().A); - kernings.push_back(E->key().B); - kernings.push_back(E->get()); +void FontData::load_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size) { + if (rid != RID()) { + TS->free(rid); } + rid = TS->create_font_memory(p_data, p_size, p_type, p_base_size); + path = TTR("(Memory: " + p_type.to_upper() + " @ 0x" + String::num_int64((uint64_t)p_data, 16, true) + ")"); + base_size = TS->font_get_base_size(rid); + emit_changed(); +} - return kernings; +void FontData::set_data_path(const String &p_path) { + load_resource(p_path, base_size); } -void BitmapFont::_set_textures(const Vector<Variant> &p_textures) { - textures.clear(); - for (int i = 0; i < p_textures.size(); i++) { - Ref<Texture2D> tex = p_textures[i]; - ERR_CONTINUE(!tex.is_valid()); - add_texture(tex); +String FontData::get_data_path() const { + return path; +} + +float FontData::get_height(int p_size) const { + if (rid == RID()) { + return 0.f; // Do not raise errors in getters, to prevent editor from spamming errors on incomplete (without data_path set) fonts. } + return TS->font_get_height(rid, (p_size < 0) ? base_size : p_size); } -Vector<Variant> BitmapFont::_get_textures() const { - Vector<Variant> rtextures; - for (int i = 0; i < textures.size(); i++) { - rtextures.push_back(textures[i]); +float FontData::get_ascent(int p_size) const { + if (rid == RID()) { + return 0.f; } - return rtextures; + return TS->font_get_ascent(rid, (p_size < 0) ? base_size : p_size); } -Error BitmapFont::create_from_fnt(const String &p_file) { - //fnt format used by angelcode bmfont - //http://www.angelcode.com/products/bmfont/ +float FontData::get_descent(int p_size) const { + if (rid == RID()) { + return 0.f; + } + return TS->font_get_descent(rid, (p_size < 0) ? base_size : p_size); +} - FileAccess *f = FileAccess::open(p_file, FileAccess::READ); +float FontData::get_underline_position(int p_size) const { + if (rid == RID()) { + return 0.f; + } + return TS->font_get_underline_position(rid, (p_size < 0) ? base_size : p_size); +} - ERR_FAIL_COND_V_MSG(!f, ERR_FILE_NOT_FOUND, "Can't open font: " + p_file + "."); +Dictionary FontData::get_feature_list() const { + if (rid == RID()) { + return Dictionary(); + } + return TS->font_get_feature_list(rid); +} - clear(); +float FontData::get_underline_thickness(int p_size) const { + if (rid == RID()) { + return 0.f; + } + return TS->font_get_underline_thickness(rid, (p_size < 0) ? base_size : p_size); +} - while (true) { - String line = f->get_line(); +void FontData::set_antialiased(bool p_antialiased) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_antialiased(rid, p_antialiased); + emit_changed(); +} - int delimiter = line.find(" "); - String type = line.substr(0, delimiter); - int pos = delimiter + 1; - Map<String, String> keys; +bool FontData::get_antialiased() const { + if (rid == RID()) { + return false; + } + return TS->font_get_antialiased(rid); +} - while (pos < line.size() && line[pos] == ' ') { - pos++; - } +void FontData::set_distance_field_hint(bool p_distance_field) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_distance_field_hint(rid, p_distance_field); + emit_changed(); +} - while (pos < line.size()) { - int eq = line.find("=", pos); - if (eq == -1) { - break; - } - String key = line.substr(pos, eq - pos); - int end = -1; - String value; - if (line[eq + 1] == '"') { - end = line.find("\"", eq + 2); - if (end == -1) { - break; - } - value = line.substr(eq + 2, end - 1 - eq - 1); - pos = end + 1; - } else { - end = line.find(" ", eq + 1); - if (end == -1) { - end = line.size(); - } +bool FontData::get_distance_field_hint() const { + if (rid == RID()) { + return false; + } + return TS->font_get_distance_field_hint(rid); +} - value = line.substr(eq + 1, end - eq); +void FontData::set_hinting(TextServer::Hinting p_hinting) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_hinting(rid, p_hinting); + emit_changed(); +} - pos = end; - } +TextServer::Hinting FontData::get_hinting() const { + if (rid == RID()) { + return TextServer::HINTING_NONE; + } + return TS->font_get_hinting(rid); +} - while (pos < line.size() && line[pos] == ' ') { - pos++; - } +void FontData::set_force_autohinter(bool p_enabeld) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_force_autohinter(rid, p_enabeld); + emit_changed(); +} - keys[key] = value; - } +bool FontData::get_force_autohinter() const { + if (rid == RID()) { + return false; + } + return TS->font_get_force_autohinter(rid); +} - if (type == "info") { - if (keys.has("face")) { - set_name(keys["face"]); - } - /* - if (keys.has("size")) - font->set_height(keys["size"].to_int()); - */ - - } else if (type == "common") { - if (keys.has("lineHeight")) { - set_height(keys["lineHeight"].to_int()); - } - if (keys.has("base")) { - set_ascent(keys["base"].to_int()); - } +bool FontData::has_char(char32_t p_char) const { + if (rid == RID()) { + return false; + } + return TS->font_has_char(rid, p_char); +} - } else if (type == "page") { - if (keys.has("file")) { - String base_dir = p_file.get_base_dir(); - String file = base_dir.plus_file(keys["file"]); - Ref<Texture2D> tex = ResourceLoader::load(file); - if (tex.is_null()) { - ERR_PRINT("Can't load font texture!"); - } else { - add_texture(tex); - } - } - } else if (type == "char") { - char32_t idx = 0; - if (keys.has("id")) { - idx = keys["id"].to_int(); - } +String FontData::get_supported_chars() const { + ERR_FAIL_COND_V(rid == RID(), String()); + return TS->font_get_supported_chars(rid); +} - Rect2 rect; +Vector2 FontData::get_glyph_advance(uint32_t p_index, int p_size) const { + ERR_FAIL_COND_V(rid == RID(), Vector2()); + return TS->font_get_glyph_advance(rid, p_index, (p_size < 0) ? base_size : p_size); +} - if (keys.has("x")) { - rect.position.x = keys["x"].to_int(); - } - if (keys.has("y")) { - rect.position.y = keys["y"].to_int(); - } - if (keys.has("width")) { - rect.size.width = keys["width"].to_int(); - } - if (keys.has("height")) { - rect.size.height = keys["height"].to_int(); - } +Vector2 FontData::get_glyph_kerning(uint32_t p_index_a, uint32_t p_index_b, int p_size) const { + ERR_FAIL_COND_V(rid == RID(), Vector2()); + return TS->font_get_glyph_kerning(rid, p_index_a, p_index_b, (p_size < 0) ? base_size : p_size); +} - Point2 ofs; +bool FontData::has_outline() const { + if (rid == RID()) { + return false; + } + return TS->font_has_outline(rid); +} - if (keys.has("xoffset")) { - ofs.x = keys["xoffset"].to_int(); - } - if (keys.has("yoffset")) { - ofs.y = keys["yoffset"].to_int(); - } +float FontData::get_base_size() const { + return base_size; +} - int texture = 0; - if (keys.has("page")) { - texture = keys["page"].to_int(); - } - int advance = -1; - if (keys.has("xadvance")) { - advance = keys["xadvance"].to_int(); - } +bool FontData::is_language_supported(const String &p_language) const { + if (rid == RID()) { + return false; + } + return TS->font_is_language_supported(rid, p_language); +} - add_char(idx, texture, rect, ofs, advance); +void FontData::set_language_support_override(const String &p_language, bool p_supported) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_language_support_override(rid, p_language, p_supported); + emit_changed(); +} - } else if (type == "kerning") { - char32_t first = 0, second = 0; - int k = 0; +bool FontData::get_language_support_override(const String &p_language) const { + if (rid == RID()) { + return false; + } + return TS->font_get_language_support_override(rid, p_language); +} - if (keys.has("first")) { - first = keys["first"].to_int(); - } - if (keys.has("second")) { - second = keys["second"].to_int(); - } - if (keys.has("amount")) { - k = keys["amount"].to_int(); - } +void FontData::remove_language_support_override(const String &p_language) { + ERR_FAIL_COND(rid == RID()); + TS->font_remove_language_support_override(rid, p_language); + emit_changed(); +} - add_kerning_pair(first, second, -k); - } +Vector<String> FontData::get_language_support_overrides() const { + if (rid == RID()) { + return Vector<String>(); + } + return TS->font_get_language_support_overrides(rid); +} - if (f->eof_reached()) { - break; - } +bool FontData::is_script_supported(const String &p_script) const { + if (rid == RID()) { + return false; } + return TS->font_is_script_supported(rid, p_script); +} - memdelete(f); +void FontData::set_script_support_override(const String &p_script, bool p_supported) { + ERR_FAIL_COND(rid == RID()); + TS->font_set_script_support_override(rid, p_script, p_supported); + emit_changed(); +} - return OK; +bool FontData::get_script_support_override(const String &p_script) const { + if (rid == RID()) { + return false; + } + return TS->font_get_script_support_override(rid, p_script); } -void BitmapFont::set_height(float p_height) { - height = p_height; +void FontData::remove_script_support_override(const String &p_script) { + ERR_FAIL_COND(rid == RID()); + TS->font_remove_script_support_override(rid, p_script); + emit_changed(); } -float BitmapFont::get_height() const { - return height; +Vector<String> FontData::get_script_support_overrides() const { + if (rid == RID()) { + return Vector<String>(); + } + return TS->font_get_script_support_overrides(rid); } -void BitmapFont::set_ascent(float p_ascent) { - ascent = p_ascent; +uint32_t FontData::get_glyph_index(char32_t p_char, char32_t p_variation_selector) const { + ERR_FAIL_COND_V(rid == RID(), 0); + return TS->font_get_glyph_index(rid, p_char, p_variation_selector); } -float BitmapFont::get_ascent() const { - return ascent; +Vector2 FontData::draw_glyph(RID p_canvas, int p_size, const Vector2 &p_pos, uint32_t p_index, const Color &p_color) const { + ERR_FAIL_COND_V(rid == RID(), Vector2()); + return TS->font_draw_glyph(rid, p_canvas, (p_size <= 0) ? base_size : p_size, p_pos, p_index, p_color); } -float BitmapFont::get_descent() const { - return height - ascent; +Vector2 FontData::draw_glyph_outline(RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, uint32_t p_index, const Color &p_color) const { + ERR_FAIL_COND_V(rid == RID(), Vector2()); + return TS->font_draw_glyph_outline(rid, p_canvas, (p_size <= 0) ? base_size : p_size, p_outline_size, p_pos, p_index, p_color); } -float BitmapFont::get_underline_position() const { - return 2; +FontData::FontData() {} + +FontData::FontData(const String &p_filename, int p_base_size) { + load_resource(p_filename, p_base_size); } -float BitmapFont::get_underline_thickness() const { - return 1; +FontData::FontData(const PackedByteArray &p_data, const String &p_type, int p_base_size) { + _load_memory(p_data, p_type, p_base_size); } -void BitmapFont::add_texture(const Ref<Texture2D> &p_texture) { - ERR_FAIL_COND_MSG(p_texture.is_null(), "It's not a reference to a valid Texture object."); - textures.push_back(p_texture); +FontData::~FontData() { + if (rid != RID()) { + TS->free(rid); + } } -int BitmapFont::get_texture_count() const { - return textures.size(); -}; +/*************************************************************************/ -Ref<Texture2D> BitmapFont::get_texture(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, textures.size(), Ref<Texture2D>()); - return textures[p_idx]; -}; +void Font::_bind_methods() { + ClassDB::bind_method(D_METHOD("add_data", "data"), &Font::add_data); + ClassDB::bind_method(D_METHOD("set_data", "idx", "data"), &Font::set_data); + ClassDB::bind_method(D_METHOD("get_data_count"), &Font::get_data_count); + ClassDB::bind_method(D_METHOD("get_data", "idx"), &Font::get_data); + ClassDB::bind_method(D_METHOD("remove_data", "idx"), &Font::remove_data); -int BitmapFont::get_character_count() const { - return char_map.size(); -}; + ClassDB::bind_method(D_METHOD("get_height", "size"), &Font::get_height, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_ascent", "size"), &Font::get_ascent, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_descent", "size"), &Font::get_descent, DEFVAL(-1)); -Vector<char32_t> BitmapFont::get_char_keys() const { - Vector<char32_t> chars; - chars.resize(char_map.size()); - const char32_t *ct = nullptr; - int count = 0; - while ((ct = char_map.next(ct))) { - chars.write[count++] = *ct; - }; + ClassDB::bind_method(D_METHOD("get_underline_position", "size"), &Font::get_underline_position, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_underline_thickness", "size"), &Font::get_underline_thickness, DEFVAL(-1)); - return chars; -}; + ClassDB::bind_method(D_METHOD("get_spacing", "type"), &Font::get_spacing); + ClassDB::bind_method(D_METHOD("set_spacing", "type", "value"), &Font::set_spacing); -BitmapFont::Character BitmapFont::get_character(char32_t p_char) const { - if (!char_map.has(p_char)) { - ERR_FAIL_V(Character()); - }; + ClassDB::bind_method(D_METHOD("get_string_size", "text", "size"), &Font::get_string_size, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_multiline_string_size", "text", "width", "size", "flags"), &Font::get_multiline_string_size, DEFVAL(-1), DEFVAL(-1), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND)); - return char_map[p_char]; -}; + ClassDB::bind_method(D_METHOD("draw_string", "canvas_item", "pos", "text", "align", "width", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND)); + ClassDB::bind_method(D_METHOD("draw_multiline_string", "canvas_item", "pos", "text", "align", "width", "max_lines", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_multiline_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND)); -void BitmapFont::add_char(char32_t p_char, int p_texture_idx, const Rect2 &p_rect, const Size2 &p_align, float p_advance) { - if (p_advance < 0) { - p_advance = p_rect.size.width; - } + ClassDB::bind_method(D_METHOD("has_char", "char"), &Font::has_char); + ClassDB::bind_method(D_METHOD("get_supported_chars"), &Font::get_supported_chars); + + ClassDB::bind_method(D_METHOD("get_char_size", "char", "next", "size"), &Font::get_char_size, DEFVAL(0), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "pos", "char", "next", "size", "modulate", "outline_size", "outline_modulate"), &Font::draw_char, DEFVAL(0), DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0))); + + ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes); - Character c; - c.rect = p_rect; - c.texture_idx = p_texture_idx; - c.v_align = p_align.y; - c.advance = p_advance; - c.h_align = p_align.x; + ADD_GROUP("Extra Spacing", "extra_spacing"); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_top"), "set_spacing", "get_spacing", SPACING_TOP); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_bottom"), "set_spacing", "get_spacing", SPACING_BOTTOM); - char_map[p_char] = c; + BIND_ENUM_CONSTANT(SPACING_TOP); + BIND_ENUM_CONSTANT(SPACING_BOTTOM); } -void BitmapFont::add_kerning_pair(char32_t p_A, char32_t p_B, int p_kerning) { - KerningPairKey kpk; - kpk.A = p_A; - kpk.B = p_B; +void Font::_data_changed() { + cache.clear(); + cache_wrap.clear(); - if (p_kerning == 0 && kerning_map.has(kpk)) { - kerning_map.erase(kpk); - } else { - kerning_map[kpk] = p_kerning; + emit_changed(); + _change_notify(); +} + +bool Font::_set(const StringName &p_name, const Variant &p_value) { + String str = p_name; + if (str.begins_with("data/")) { + int idx = str.get_slicec('/', 1).to_int(); + Ref<FontData> fd = p_value; + + if (fd.is_valid()) { + if (idx == data.size()) { + add_data(fd); + return true; + } else if (idx >= 0 && idx < data.size()) { + set_data(idx, fd); + return true; + } else { + return false; + } + } else if (idx >= 0 && idx < data.size()) { + remove_data(idx); + return true; + } } + + return false; } -Vector<BitmapFont::KerningPairKey> BitmapFont::get_kerning_pair_keys() const { - Vector<BitmapFont::KerningPairKey> ret; - ret.resize(kerning_map.size()); - int i = 0; +bool Font::_get(const StringName &p_name, Variant &r_ret) const { + String str = p_name; + if (str.begins_with("data/")) { + int idx = str.get_slicec('/', 1).to_int(); - for (Map<KerningPairKey, int>::Element *E = kerning_map.front(); E; E = E->next()) { - ret.write[i++] = E->key(); + if (idx == data.size()) { + r_ret = Ref<FontData>(); + return true; + } else if (idx >= 0 && idx < data.size()) { + r_ret = get_data(idx); + return true; + } } - return ret; + return false; +} + +void Font::_get_property_list(List<PropertyInfo> *p_list) const { + for (int i = 0; i < data.size(); i++) { + p_list->push_back(PropertyInfo(Variant::OBJECT, "data/" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "FontData")); + } + + p_list->push_back(PropertyInfo(Variant::OBJECT, "data/" + itos(data.size()), PROPERTY_HINT_RESOURCE_TYPE, "FontData")); } -int BitmapFont::get_kerning_pair(char32_t p_A, char32_t p_B) const { - KerningPairKey kpk; - kpk.A = p_A; - kpk.B = p_B; +void Font::add_data(const Ref<FontData> &p_data) { + ERR_FAIL_COND(p_data.is_null()); + data.push_back(p_data); - const Map<KerningPairKey, int>::Element *E = kerning_map.find(kpk); - if (E) { - return E->get(); + if (data[data.size() - 1].is_valid()) { + data.write[data.size() - 1]->connect("changed", callable_mp(this, &Font::_data_changed), varray(), CONNECT_REFERENCE_COUNTED); } - return 0; + cache.clear(); + cache_wrap.clear(); + + emit_changed(); + _change_notify(); } -void BitmapFont::set_distance_field_hint(bool p_distance_field) { - distance_field_hint = p_distance_field; +void Font::set_data(int p_idx, const Ref<FontData> &p_data) { + ERR_FAIL_COND(p_data.is_null()); + ERR_FAIL_INDEX(p_idx, data.size()); + + if (data[p_idx].is_valid()) { + data.write[p_idx]->disconnect("changed", callable_mp(this, &Font::_data_changed)); + } + + data.write[p_idx] = p_data; + + if (data[p_idx].is_valid()) { + data.write[p_idx]->connect("changed", callable_mp(this, &Font::_data_changed), varray(), CONNECT_REFERENCE_COUNTED); + } + + cache.clear(); + cache_wrap.clear(); + emit_changed(); + _change_notify(); } -bool BitmapFont::is_distance_field_hint() const { - return distance_field_hint; +int Font::get_data_count() const { + return data.size(); } -void BitmapFont::clear() { - height = 1; - ascent = 0; - char_map.clear(); - textures.clear(); - kerning_map.clear(); - distance_field_hint = false; +Ref<FontData> Font::get_data(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, data.size(), Ref<FontData>()); + return data[p_idx]; } -Size2 Font::get_string_size(const String &p_string) const { - float w = 0; +void Font::remove_data(int p_idx) { + ERR_FAIL_INDEX(p_idx, data.size()); - int l = p_string.length(); - if (l == 0) { - return Size2(0, get_height()); + if (data[p_idx].is_valid()) { + data.write[p_idx]->disconnect("changed", callable_mp(this, &Font::_data_changed)); } - const char32_t *sptr = &p_string[0]; - for (int i = 0; i < l; i++) { - w += get_char_size(sptr[i], sptr[i + 1]).width; + data.remove(p_idx); + + cache.clear(); + cache_wrap.clear(); + + emit_changed(); + _change_notify(); +} + +Dictionary Font::get_feature_list() const { + Dictionary out; + for (int i = 0; i < data.size(); i++) { + Dictionary data_ftrs = data[i]->get_feature_list(); + for (const Variant *ftr = data_ftrs.next(nullptr); ftr != nullptr; ftr = data_ftrs.next(ftr)) { + out[*ftr] = data_ftrs[*ftr]; + } } + return out; +} - return Size2(w, get_height()); +float Font::get_height(int p_size) const { + float ret = 0.f; + for (int i = 0; i < data.size(); i++) { + ret += data[i]->get_height(p_size); + } + return (ret / data.size()) + spacing_top + spacing_bottom; } -Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) const { - ERR_FAIL_COND_V(p_width <= 0, Vector2(0, get_height())); +float Font::get_ascent(int p_size) const { + float ret = 0.f; + for (int i = 0; i < data.size(); i++) { + ret += data[i]->get_ascent(p_size); + } + return (ret / data.size()) + spacing_top; +} - int l = p_string.length(); - if (l == 0) { - return Size2(p_width, get_height()); +float Font::get_descent(int p_size) const { + float ret = 0.f; + for (int i = 0; i < data.size(); i++) { + ret += data[i]->get_descent(p_size); } + return (ret / data.size()) + spacing_bottom; +} - float line_w = 0; - float h = 0; - float space_w = get_char_size(' ').width; - Vector<String> lines = p_string.split("\n"); - for (int i = 0; i < lines.size(); i++) { - h += get_height(); - String t = lines[i]; - line_w = 0; - Vector<String> words = t.split(" "); - for (int j = 0; j < words.size(); j++) { - line_w += get_string_size(words[j]).x; - if (line_w > p_width) { - h += get_height(); - line_w = get_string_size(words[j]).x; - } else { - line_w += space_w; - } - } +float Font::get_underline_position(int p_size) const { + float ret = 0.f; + for (int i = 0; i < data.size(); i++) { + ret += data[i]->get_underline_position(p_size); } + return (ret / data.size()); +} - return Size2(p_width, h); +float Font::get_underline_thickness(int p_size) const { + float ret = 0.f; + for (int i = 0; i < data.size(); i++) { + ret += data[i]->get_underline_thickness(p_size); + } + return (ret / data.size()); } -void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { - for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != nullptr; fallback_child = fallback_child->get_fallback()) { - ERR_FAIL_COND_MSG(fallback_child == this, "Can't set as fallback one of its parents to prevent crashes due to recursive loop."); +int Font::get_spacing(int p_type) const { + if (p_type == SPACING_TOP) { + return spacing_top; + } else if (p_type == SPACING_BOTTOM) { + return spacing_bottom; } - fallback = p_fallback; + return 0; } -Ref<BitmapFont> BitmapFont::get_fallback() const { - return fallback; +void Font::set_spacing(int p_type, int p_value) { + if (p_type == SPACING_TOP) { + spacing_top = p_value; + } else if (p_type == SPACING_BOTTOM) { + spacing_bottom = p_value; + } + + emit_changed(); + _change_notify(); } -float BitmapFont::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next, const Color &p_modulate, bool p_outline) const { - const Character *c = char_map.getptr(p_char); +// Drawing string and string sizes, cached. - if (!c) { - if (fallback.is_valid()) { - return fallback->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, p_outline); - } - return 0; - } +Size2 Font::get_string_size(const String &p_text, int p_size) const { + ERR_FAIL_COND_V(data.empty(), Size2()); - ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0); - if (!p_outline && c->texture_idx != -1) { - Point2 cpos = p_pos; - cpos.x += c->h_align; - cpos.y -= ascent; - cpos.y += c->v_align; - RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, false); - } + uint64_t hash = p_text.hash64(); + hash = hash_djb2_one_64(p_size, hash); - return get_char_size(p_char, p_next).width; + Ref<TextLine> buffer; + if (cache.has(hash)) { + buffer = cache.get(hash); + } else { + buffer.instance(); + int size = p_size <= 0 ? data[0]->get_base_size() : p_size; + buffer->add_string(p_text, Ref<Font>(this), size, Dictionary(), TranslationServer::get_singleton()->get_tool_locale()); + cache.insert(hash, buffer); + } + if (buffer->get_orientation() == TextServer::ORIENTATION_HORIZONTAL) { + return buffer->get_size() + Vector2(0, spacing_top + spacing_bottom); + } else { + return buffer->get_size() + Vector2(spacing_top + spacing_bottom, 0); + } } -Size2 BitmapFont::get_char_size(char32_t p_char, char32_t p_next) const { - const Character *c = char_map.getptr(p_char); +Size2 Font::get_multiline_string_size(const String &p_text, float p_width, int p_size, uint8_t p_flags) const { + ERR_FAIL_COND_V(data.empty(), Size2()); - if (!c) { - if (fallback.is_valid()) { - return fallback->get_char_size(p_char, p_next); + uint64_t hash = p_text.hash64(); + hash = hash_djb2_one_64(p_size, hash); + + uint64_t wrp_hash = hash_djb2_one_64(hash_djb2_one_float(p_width), hash); + wrp_hash = hash_djb2_one_64(p_flags, wrp_hash); + + Ref<TextParagraph> lines_buffer; + if (cache_wrap.has(wrp_hash)) { + lines_buffer = cache_wrap.get(wrp_hash); + } else { + lines_buffer.instance(); + int size = p_size <= 0 ? data[0]->get_base_size() : p_size; + lines_buffer->add_string(p_text, Ref<Font>(this), size, Dictionary(), TranslationServer::get_singleton()->get_tool_locale()); + lines_buffer->set_width(p_width); + lines_buffer->set_flags(p_flags); + cache_wrap.insert(wrp_hash, lines_buffer); + } + + Size2 ret; + for (int i = 0; i < lines_buffer->get_line_count(); i++) { + Size2 line_size = lines_buffer->get_line_size(i); + if (lines_buffer->get_orientation() == TextServer::ORIENTATION_HORIZONTAL) { + ret.x = MAX(ret.x, line_size.x); + ret.y += line_size.y + spacing_top + spacing_bottom; + } else { + ret.y = MAX(ret.y, line_size.y); + ret.x += line_size.x + spacing_top + spacing_bottom; } - return Size2(); } + return ret; +} - Size2 ret(c->advance, c->rect.size.y); +void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align, float p_width, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint8_t p_flags) const { + uint64_t hash = p_text.hash64(); + hash = hash_djb2_one_64(p_size, hash); - if (p_next) { - KerningPairKey kpk; - kpk.A = p_char; - kpk.B = p_next; + Ref<TextLine> buffer; + if (cache.has(hash)) { + buffer = cache.get(hash); + } else { + buffer.instance(); + int size = p_size <= 0 ? data[0]->get_base_size() : p_size; + buffer->add_string(p_text, Ref<Font>(this), size, Dictionary(), TranslationServer::get_singleton()->get_tool_locale()); + cache.insert(hash, buffer); + } - const Map<KerningPairKey, int>::Element *E = kerning_map.find(kpk); - if (E) { - ret.width -= E->get(); - } + Vector2 ofs = p_pos; + if (buffer->get_orientation() == TextServer::ORIENTATION_HORIZONTAL) { + ofs.y += spacing_top - buffer->get_line_ascent(); + } else { + ofs.x += spacing_top - buffer->get_line_ascent(); } - return ret; + buffer->set_width(p_width); + buffer->set_align(p_align); + + if (p_outline_size > 0 && p_outline_modulate.a != 0.0f) { + buffer->draw_outline(p_canvas_item, ofs, p_outline_size, p_outline_modulate); + } + buffer->draw(p_canvas_item, ofs, p_modulate); } -void BitmapFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("create_from_fnt", "path"), &BitmapFont::create_from_fnt); - ClassDB::bind_method(D_METHOD("set_height", "px"), &BitmapFont::set_height); +void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align, float p_width, int p_max_lines, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint8_t p_flags) const { + uint64_t hash = p_text.hash64(); + hash = hash_djb2_one_64(p_size, hash); - ClassDB::bind_method(D_METHOD("set_ascent", "px"), &BitmapFont::set_ascent); + uint64_t wrp_hash = hash_djb2_one_64(hash_djb2_one_float(p_width), hash); + wrp_hash = hash_djb2_one_64(p_flags, wrp_hash); - ClassDB::bind_method(D_METHOD("add_kerning_pair", "char_a", "char_b", "kerning"), &BitmapFont::add_kerning_pair); - ClassDB::bind_method(D_METHOD("get_kerning_pair", "char_a", "char_b"), &BitmapFont::get_kerning_pair); + Ref<TextParagraph> lines_buffer; + if (cache_wrap.has(wrp_hash)) { + lines_buffer = cache_wrap.get(wrp_hash); + } else { + lines_buffer.instance(); + int size = p_size <= 0 ? data[0]->get_base_size() : p_size; + lines_buffer->add_string(p_text, Ref<Font>(this), size, Dictionary(), TranslationServer::get_singleton()->get_tool_locale()); + lines_buffer->set_width(p_width); + lines_buffer->set_flags(p_flags); + cache_wrap.insert(wrp_hash, lines_buffer); + } - ClassDB::bind_method(D_METHOD("add_texture", "texture"), &BitmapFont::add_texture); - ClassDB::bind_method(D_METHOD("add_char", "character", "texture", "rect", "align", "advance"), &BitmapFont::add_char, DEFVAL(Point2()), DEFVAL(-1)); + lines_buffer->set_align(p_align); - ClassDB::bind_method(D_METHOD("get_texture_count"), &BitmapFont::get_texture_count); - ClassDB::bind_method(D_METHOD("get_texture", "idx"), &BitmapFont::get_texture); + Vector2 lofs = p_pos; + for (int i = 0; i < lines_buffer->get_line_count(); i++) { + if (lines_buffer->get_orientation() == TextServer::ORIENTATION_HORIZONTAL) { + lofs.y += spacing_top; + if (i == 0) { + lofs.y -= lines_buffer->get_line_ascent(0); + } + } else { + lofs.x += spacing_top; + if (i == 0) { + lofs.x -= lines_buffer->get_line_ascent(0); + } + } + if (p_width > 0) { + lines_buffer->set_align(p_align); + } - ClassDB::bind_method(D_METHOD("set_distance_field_hint", "enable"), &BitmapFont::set_distance_field_hint); + if (p_outline_size > 0 && p_outline_modulate.a != 0.0f) { + lines_buffer->draw_line_outline(p_canvas_item, lofs, i, p_outline_size, p_outline_modulate); + } + lines_buffer->draw_line(p_canvas_item, lofs, i, p_modulate); - ClassDB::bind_method(D_METHOD("clear"), &BitmapFont::clear); + Size2 line_size = lines_buffer->get_line_size(i); + if (lines_buffer->get_orientation() == TextServer::ORIENTATION_HORIZONTAL) { + lofs.y += line_size.y + spacing_bottom; + } else { + lofs.x += line_size.x + spacing_bottom; + } - ClassDB::bind_method(D_METHOD("_set_chars"), &BitmapFont::_set_chars); - ClassDB::bind_method(D_METHOD("_get_chars"), &BitmapFont::_get_chars); + if ((p_max_lines > 0) && (i >= p_max_lines)) { + return; + } + } +} - ClassDB::bind_method(D_METHOD("_set_kernings"), &BitmapFont::_set_kernings); - ClassDB::bind_method(D_METHOD("_get_kernings"), &BitmapFont::_get_kernings); +bool Font::has_char(char32_t p_char) const { + for (int i = 0; i < data.size(); i++) { + if (data[i]->has_char(p_char)) { + return true; + } + } + return false; +} - ClassDB::bind_method(D_METHOD("_set_textures"), &BitmapFont::_set_textures); - ClassDB::bind_method(D_METHOD("_get_textures"), &BitmapFont::_get_textures); +String Font::get_supported_chars() const { + String chars; + for (int i = 0; i < data.size(); i++) { + String data_chars = data[i]->get_supported_chars(); + for (int j = 0; j < data_chars.length(); j++) { + if (chars.find_char(data_chars[j]) == -1) { + chars += data_chars[j]; + } + } + } + return chars; +} - ClassDB::bind_method(D_METHOD("set_fallback", "fallback"), &BitmapFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); +Size2 Font::get_char_size(char32_t p_char, char32_t p_next, int p_size) const { + for (int i = 0; i < data.size(); i++) { + if (data[i]->has_char(p_char)) { + int size = p_size <= 0 ? data[i]->get_base_size() : p_size; + uint32_t glyph_a = data[i]->get_glyph_index(p_char); + Size2 ret = Size2(data[i]->get_glyph_advance(glyph_a, size).x, data[i]->get_height(size)); + if ((p_next != 0) && data[i]->has_char(p_next)) { + uint32_t glyph_b = data[i]->get_glyph_index(p_next); + ret.x -= data[i]->get_glyph_kerning(glyph_a, glyph_b, size).x; + } + return ret; + } + } + return Size2(); +} + +float Font::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate) const { + for (int i = 0; i < data.size(); i++) { + if (data[i]->has_char(p_char)) { + int size = p_size <= 0 ? data[i]->get_base_size() : p_size; + uint32_t glyph_a = data[i]->get_glyph_index(p_char); + float ret = data[i]->get_glyph_advance(glyph_a, size).x; + if ((p_next != 0) && data[i]->has_char(p_next)) { + uint32_t glyph_b = data[i]->get_glyph_index(p_next); + ret -= data[i]->get_glyph_kerning(glyph_a, glyph_b, size).x; + } + if (p_outline_size > 0 && p_outline_modulate.a != 0.0f) { + data[i]->draw_glyph_outline(p_canvas_item, size, p_outline_size, p_pos, glyph_a, p_outline_modulate); + } + data[i]->draw_glyph(p_canvas_item, size, p_pos, glyph_a, p_modulate); + return ret; + } + } + return 0; +} - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_textures", "_get_textures"); - ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars"); - ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings"); +Vector<RID> Font::get_rids() const { + Vector<RID> ret; + for (int i = 0; i < data.size(); i++) { + RID rid = data[i]->get_rid(); + if (rid != RID()) { + ret.push_back(rid); + } + } + return ret; +} - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "1,1024,1"), "set_height", "get_height"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ascent", PROPERTY_HINT_RANGE, "0,1024,1"), "set_ascent", "get_ascent"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distance_field"), "set_distance_field_hint", "is_distance_field_hint"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback", PROPERTY_HINT_RESOURCE_TYPE, "BitmapFont"), "set_fallback", "get_fallback"); +void Font::update_changes() { + emit_changed(); } -BitmapFont::BitmapFont() { - clear(); +Font::Font() { + cache.set_capacity(128); + cache_wrap.set_capacity(32); } -BitmapFont::~BitmapFont() { - clear(); +Font::~Font() { + cache.clear(); + cache_wrap.clear(); } -//////////// +/*************************************************************************/ -RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { +RES ResourceFormatLoaderFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } - Ref<BitmapFont> font; - font.instance(); + Ref<FontData> dfont; + dfont.instance(); + dfont->load_resource(p_path); - Error err = font->create_from_fnt(p_path); - - if (err) { - if (r_error) { - *r_error = err; - } - return RES(); + if (r_error) { + *r_error = OK; } - return font; + return dfont; } -void ResourceFormatLoaderBMFont::get_recognized_extensions(List<String> *p_extensions) const { +void ResourceFormatLoaderFont::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("ttf"); + p_extensions->push_back("otf"); + p_extensions->push_back("woff"); + p_extensions->push_back("font"); p_extensions->push_back("fnt"); } -bool ResourceFormatLoaderBMFont::handles_type(const String &p_type) const { - return (p_type == "BitmapFont"); +bool ResourceFormatLoaderFont::handles_type(const String &p_type) const { + return (p_type == "FontData"); } -String ResourceFormatLoaderBMFont::get_resource_type(const String &p_path) const { +String ResourceFormatLoaderFont::get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == "fnt") { - return "BitmapFont"; + if (el == "ttf" || el == "otf" || el == "woff" || el == "font" || el == "fnt") { + return "FontData"; } return ""; } diff --git a/scene/resources/font.h b/scene/resources/font.h index d8c350bb41..226979c4a0 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -32,173 +32,170 @@ #define FONT_H #include "core/io/resource.h" +#include "core/templates/lru.h" #include "core/templates/map.h" #include "scene/resources/texture.h" +#include "servers/text_server.h" -class Font : public Resource { - GDCLASS(Font, Resource); +/*************************************************************************/ + +class FontData : public Resource { + GDCLASS(FontData, Resource); + + RID rid; + int base_size = 16; + String path; protected: static void _bind_methods(); + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; + void _get_property_list(List<PropertyInfo> *p_list) const; + public: - virtual float get_height() const = 0; + virtual RID get_rid() const override; - virtual float get_ascent() const = 0; - virtual float get_descent() const = 0; - virtual float get_underline_position() const = 0; - virtual float get_underline_thickness() const = 0; + void load_resource(const String &p_filename, int p_base_size = 16); + void load_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size = 16); + void _load_memory(const PackedByteArray &p_data, const String &p_type, int p_base_size = 16); - virtual Size2 get_char_size(char32_t p_char, char32_t p_next = 0) const = 0; - Size2 get_string_size(const String &p_string) const; - Size2 get_wordwrap_string_size(const String &p_string, float p_width) const; + void set_data_path(const String &p_path); + String get_data_path() const; - virtual bool is_distance_field_hint() const = 0; + float get_height(int p_size) const; + float get_ascent(int p_size) const; + float get_descent(int p_size) const; - void draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1, const Color &p_outline_modulate = Color(1, 1, 1)) const; - void draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate = Color(1, 1, 1), const Color &p_outline_modulate = Color(1, 1, 1)) const; + Dictionary get_feature_list() const; - virtual bool has_outline() const { return false; } - virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const = 0; + float get_underline_position(int p_size) const; + float get_underline_thickness(int p_size) const; - void update_changes(); - Font(); -}; + void set_antialiased(bool p_antialiased); + bool get_antialiased() const; -// Helper class to that draws outlines immediately and draws characters in its destructor. -class FontDrawer { - const Ref<Font> &font; - Color outline_color; - bool has_outline; - - struct PendingDraw { - RID canvas_item; - Point2 pos; - char32_t chr; - char32_t next; - Color modulate; - }; + void set_distance_field_hint(bool p_distance_field); + bool get_distance_field_hint() const; - Vector<PendingDraw> pending_draws; + void set_force_autohinter(bool p_enabeld); + bool get_force_autohinter() const; -public: - FontDrawer(const Ref<Font> &p_font, const Color &p_outline_color) : - font(p_font), - outline_color(p_outline_color) { - has_outline = p_font->has_outline(); - } - - float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, const Color &p_modulate = Color(1, 1, 1)) { - if (has_outline) { - PendingDraw draw = { p_canvas_item, p_pos, p_char, p_next, p_modulate }; - pending_draws.push_back(draw); - } - return font->draw_char(p_canvas_item, p_pos, p_char, p_next, has_outline ? outline_color : p_modulate, has_outline); - } - - ~FontDrawer() { - for (int i = 0; i < pending_draws.size(); ++i) { - const PendingDraw &draw = pending_draws[i]; - font->draw_char(draw.canvas_item, draw.pos, draw.chr, draw.next, draw.modulate, false); - } - } -}; + void set_hinting(TextServer::Hinting p_hinting); + TextServer::Hinting get_hinting() const; -class BitmapFont : public Font { - GDCLASS(BitmapFont, Font); - RES_BASE_EXTENSION("font"); + bool has_char(char32_t p_char) const; + String get_supported_chars() const; - Vector<Ref<Texture2D>> textures; + Vector2 get_glyph_advance(uint32_t p_index, int p_size) const; + Vector2 get_glyph_kerning(uint32_t p_index_a, uint32_t p_index_b, int p_size) const; -public: - struct Character { - int texture_idx; - Rect2 rect; - float v_align; - float h_align; - float advance; - - Character() { - texture_idx = 0; - v_align = 0; - } - }; + bool has_outline() const; + float get_base_size() const; - struct KerningPairKey { - union { - struct { - uint32_t A, B; - }; + bool is_language_supported(const String &p_language) const; + void set_language_support_override(const String &p_language, bool p_supported); + bool get_language_support_override(const String &p_language) const; + void remove_language_support_override(const String &p_language); + Vector<String> get_language_support_overrides() const; - uint64_t pair; - }; + bool is_script_supported(const String &p_script) const; + void set_script_support_override(const String &p_script, bool p_supported); + bool get_script_support_override(const String &p_script) const; + void remove_script_support_override(const String &p_script); + Vector<String> get_script_support_overrides() const; - _FORCE_INLINE_ bool operator<(const KerningPairKey &p_r) const { return pair < p_r.pair; } + uint32_t get_glyph_index(char32_t p_char, char32_t p_variation_selector = 0x0000) const; + + Vector2 draw_glyph(RID p_canvas, int p_size, const Vector2 &p_pos, uint32_t p_index, const Color &p_color = Color(1, 1, 1)) const; + Vector2 draw_glyph_outline(RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, uint32_t p_index, const Color &p_color = Color(1, 1, 1)) const; + + FontData(); + FontData(const String &p_filename, int p_base_size); + FontData(const PackedByteArray &p_data, const String &p_type, int p_base_size); + + ~FontData(); +}; + +/*************************************************************************/ + +class TextLine; +class TextParagraph; + +class Font : public Resource { + GDCLASS(Font, Resource); + +public: + enum SpacingType { + SPACING_TOP, + SPACING_BOTTOM }; private: - HashMap<char32_t, Character> char_map; - Map<KerningPairKey, int> kerning_map; - - float height; - float ascent; - bool distance_field_hint; + int spacing_top = 0; + int spacing_bottom = 0; - void _set_chars(const Vector<int> &p_chars); - Vector<int> _get_chars() const; - void _set_kernings(const Vector<int> &p_kernings); - Vector<int> _get_kernings() const; - void _set_textures(const Vector<Variant> &p_textures); - Vector<Variant> _get_textures() const; + mutable LRUCache<uint64_t, Ref<TextLine>> cache; + mutable LRUCache<uint64_t, Ref<TextParagraph>> cache_wrap; - Ref<BitmapFont> fallback; + Vector<Ref<FontData>> data; protected: static void _bind_methods(); -public: - Error create_from_fnt(const String &p_file); + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; + void _get_property_list(List<PropertyInfo> *p_list) const; - void set_height(float p_height); - float get_height() const override; + void _data_changed(); - void set_ascent(float p_ascent); - float get_ascent() const override; - float get_descent() const override; - float get_underline_position() const override; - float get_underline_thickness() const override; +public: + Dictionary get_feature_list() const; - void add_texture(const Ref<Texture2D> &p_texture); - void add_char(char32_t p_char, int p_texture_idx, const Rect2 &p_rect, const Size2 &p_align, float p_advance = -1); + // Font data control. + void add_data(const Ref<FontData> &p_data); + void set_data(int p_idx, const Ref<FontData> &p_data); + int get_data_count() const; + Ref<FontData> get_data(int p_idx) const; + void remove_data(int p_idx); - int get_character_count() const; - Vector<char32_t> get_char_keys() const; - Character get_character(char32_t p_char) const; + float get_height(int p_size = -1) const; + float get_ascent(int p_size = -1) const; + float get_descent(int p_size = -1) const; - int get_texture_count() const; - Ref<Texture2D> get_texture(int p_idx) const; + float get_underline_position(int p_size = -1) const; + float get_underline_thickness(int p_size = -1) const; - void add_kerning_pair(char32_t p_A, char32_t p_B, int p_kerning); - int get_kerning_pair(char32_t p_A, char32_t p_B) const; - Vector<KerningPairKey> get_kerning_pair_keys() const; + int get_spacing(int p_type) const; + void set_spacing(int p_type, int p_value); - Size2 get_char_size(char32_t p_char, char32_t p_next = 0) const override; + // Drawing string. + Size2 get_string_size(const String &p_text, int p_size = -1) const; + Size2 get_multiline_string_size(const String &p_text, float p_width = -1, int p_size = -1, uint8_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND) const; - void set_fallback(const Ref<BitmapFont> &p_fallback); - Ref<BitmapFont> get_fallback() const; + void draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, float p_width = -1, int p_size = -1, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint8_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const; + void draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, float p_width = -1, int p_max_lines = -1, int p_size = -1, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint8_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const; - void clear(); + // Helper functions. + bool has_char(char32_t p_char) const; + String get_supported_chars() const; - void set_distance_field_hint(bool p_distance_field); - bool is_distance_field_hint() const override; + Size2 get_char_size(char32_t p_char, char32_t p_next = 0, int p_size = -1) const; + float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, int p_size = -1, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0)) const; - float draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const override; + Vector<RID> get_rids() const; + + void update_changes(); - BitmapFont(); - ~BitmapFont(); + Font(); + ~Font(); }; -class ResourceFormatLoaderBMFont : public ResourceFormatLoader { +VARIANT_ENUM_CAST(Font::SpacingType); + +/*************************************************************************/ + +class ResourceFormatLoaderFont : public ResourceFormatLoader { public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 1d5f29ab14..cf8be8fe15 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -838,6 +838,11 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p f->seek(tag_end); uint8_t c = f->get_8(); + if (c == '\n' && !f->eof_reached()) { + // Skip first newline character since we added one + c = f->get_8(); + } + while (!f->eof_reached()) { fw->store_8(c); c = f->get_8(); diff --git a/scene/resources/text_line.cpp b/scene/resources/text_line.cpp new file mode 100644 index 0000000000..5a419bb232 --- /dev/null +++ b/scene/resources/text_line.cpp @@ -0,0 +1,359 @@ +/*************************************************************************/ +/* text_line.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "text_line.h" + +void TextLine::_bind_methods() { + ClassDB::bind_method(D_METHOD("clear"), &TextLine::clear); + + ClassDB::bind_method(D_METHOD("set_direction", "direction"), &TextLine::set_direction); + ClassDB::bind_method(D_METHOD("get_direction"), &TextLine::get_direction); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "direction", PROPERTY_HINT_ENUM, "Auto,Light-to-right,Right-to-left"), "set_direction", "get_direction"); + + ClassDB::bind_method(D_METHOD("set_orientation", "orientation"), &TextLine::set_orientation); + ClassDB::bind_method(D_METHOD("get_orientation"), &TextLine::get_orientation); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "orientation", PROPERTY_HINT_ENUM, "Horizontal,Orientation"), "set_orientation", "get_orientation"); + + ClassDB::bind_method(D_METHOD("set_preserve_invalid", "enabled"), &TextLine::set_preserve_invalid); + ClassDB::bind_method(D_METHOD("get_preserve_invalid"), &TextLine::get_preserve_invalid); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "preserve_invalid"), "set_preserve_invalid", "get_preserve_invalid"); + + ClassDB::bind_method(D_METHOD("set_preserve_control", "enabled"), &TextLine::set_preserve_control); + ClassDB::bind_method(D_METHOD("get_preserve_control"), &TextLine::get_preserve_control); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "preserve_control"), "set_preserve_control", "get_preserve_control"); + + ClassDB::bind_method(D_METHOD("set_bidi_override", "override"), &TextLine::_set_bidi_override); + + ClassDB::bind_method(D_METHOD("add_string", "text", "fonts", "size", "opentype_features", "language"), &TextLine::add_string, DEFVAL(Dictionary()), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextLine::add_object, DEFVAL(VALIGN_CENTER), DEFVAL(1)); + ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextLine::resize_object, DEFVAL(VALIGN_CENTER)); + + ClassDB::bind_method(D_METHOD("set_width", "width"), &TextLine::set_width); + ClassDB::bind_method(D_METHOD("get_width"), &TextLine::get_width); + + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width"), "set_width", "get_width"); + + ClassDB::bind_method(D_METHOD("set_align", "align"), &TextLine::set_align); + ClassDB::bind_method(D_METHOD("get_align"), &TextLine::get_align); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); + + ClassDB::bind_method(D_METHOD("tab_align", "tab_stops"), &TextLine::tab_align); + + ClassDB::bind_method(D_METHOD("set_flags", "flags"), &TextLine::set_flags); + ClassDB::bind_method(D_METHOD("get_flags"), &TextLine::get_flags); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Kashida justification,Word justification,Trim edge spaces after justification,Justification only after last tab"), "set_flags", "get_flags"); + + ClassDB::bind_method(D_METHOD("get_objects"), &TextLine::get_objects); + ClassDB::bind_method(D_METHOD("get_object_rect", "key"), &TextLine::get_object_rect); + + ClassDB::bind_method(D_METHOD("get_size"), &TextLine::get_size); + + ClassDB::bind_method(D_METHOD("get_rid"), &TextLine::get_rid); + + ClassDB::bind_method(D_METHOD("get_line_ascent"), &TextLine::get_line_ascent); + ClassDB::bind_method(D_METHOD("get_line_descent"), &TextLine::get_line_descent); + ClassDB::bind_method(D_METHOD("get_line_width"), &TextLine::get_line_width); + ClassDB::bind_method(D_METHOD("get_line_underline_position"), &TextLine::get_line_underline_position); + ClassDB::bind_method(D_METHOD("get_line_underline_thickness"), &TextLine::get_line_underline_thickness); + + ClassDB::bind_method(D_METHOD("draw", "canvas", "pos", "color"), &TextLine::draw, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_outline", "canvas", "pos", "outline_size", "color"), &TextLine::draw_outline, DEFVAL(1), DEFVAL(Color(1, 1, 1))); + + ClassDB::bind_method(D_METHOD("hit_test", "coords"), &TextLine::hit_test); +} + +void TextLine::_shape() { + if (dirty) { + if (!tab_stops.empty()) { + TS->shaped_text_tab_align(rid, tab_stops); + } + if (align == HALIGN_FILL) { + TS->shaped_text_fit_to_width(rid, width, flags); + } + dirty = false; + } +} + +RID TextLine::get_rid() const { + return rid; +} + +void TextLine::clear() { + TS->shaped_text_clear(rid); +} + +void TextLine::set_preserve_invalid(bool p_enabled) { + TS->shaped_text_set_preserve_invalid(rid, p_enabled); + dirty = true; +} + +bool TextLine::get_preserve_invalid() const { + return TS->shaped_text_get_preserve_invalid(rid); +} + +void TextLine::set_preserve_control(bool p_enabled) { + TS->shaped_text_set_preserve_control(rid, p_enabled); + dirty = true; +} + +bool TextLine::get_preserve_control() const { + return TS->shaped_text_get_preserve_control(rid); +} + +void TextLine::set_direction(TextServer::Direction p_direction) { + TS->shaped_text_set_direction(rid, p_direction); + dirty = true; +} + +TextServer::Direction TextLine::get_direction() const { + return TS->shaped_text_get_direction(rid); +} + +void TextLine::set_orientation(TextServer::Orientation p_orientation) { + TS->shaped_text_set_orientation(rid, p_orientation); + dirty = true; +} + +TextServer::Orientation TextLine::get_orientation() const { + return TS->shaped_text_get_orientation(rid); +} + +void TextLine::_set_bidi_override(const Array &p_override) { + Vector<Vector2i> overrides; + for (int i = 0; i < p_override.size(); i++) { + overrides.push_back(p_override[i]); + } + set_bidi_override(overrides); +} + +void TextLine::set_bidi_override(const Vector<Vector2i> &p_override) { + TS->shaped_text_set_bidi_override(rid, p_override); + dirty = true; +} + +bool TextLine::add_string(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language) { + bool res = TS->shaped_text_add_string(rid, p_text, p_fonts->get_rids(), p_size, p_opentype_features, p_language); + dirty = true; + return res; +} + +bool TextLine::add_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align, int p_length) { + bool res = TS->shaped_text_add_object(rid, p_key, p_size, p_inline_align, p_length); + dirty = true; + return res; +} + +bool TextLine::resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align) { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_resize_object(rid, p_key, p_size, p_inline_align); +} + +Array TextLine::get_objects() const { + return TS->shaped_text_get_objects(rid); +} + +Rect2 TextLine::get_object_rect(Variant p_key) const { + return TS->shaped_text_get_object_rect(rid, p_key); +} + +void TextLine::set_align(HAlign p_align) { + if (align != p_align) { + if (align == HALIGN_FILL || p_align == HALIGN_FILL) { + align = p_align; + dirty = true; + } else { + align = p_align; + } + } +} + +HAlign TextLine::get_align() const { + return align; +} + +void TextLine::tab_align(const Vector<float> &p_tab_stops) { + tab_stops = p_tab_stops; + dirty = true; +} + +void TextLine::set_flags(uint8_t p_flags) { + if (flags != p_flags) { + flags = p_flags; + dirty = true; + } +} + +uint8_t TextLine::get_flags() const { + return flags; +} + +void TextLine::set_width(float p_width) { + width = p_width; + if (align == HALIGN_FILL) { + dirty = true; + } +} + +float TextLine::get_width() const { + return width; +} + +Size2 TextLine::get_size() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_size(rid); +} + +float TextLine::get_line_ascent() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_ascent(rid); +} + +float TextLine::get_line_descent() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_descent(rid); +} + +float TextLine::get_line_width() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_width(rid); +} + +float TextLine::get_line_underline_position() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_underline_position(rid); +} + +float TextLine::get_line_underline_thickness() const { + const_cast<TextLine *>(this)->_shape(); + return TS->shaped_text_get_underline_thickness(rid); +} + +void TextLine::draw(RID p_canvas, const Vector2 &p_pos, const Color &p_color) const { + const_cast<TextLine *>(this)->_shape(); + + Vector2 ofs = p_pos; + + float length = TS->shaped_text_get_width(rid); + if (width > 0) { + switch (align) { + case HALIGN_FILL: + case HALIGN_LEFT: + break; + case HALIGN_CENTER: { + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += Math::floor((width - length) / 2.0); + } else { + ofs.y += Math::floor((width - length) / 2.0); + } + } break; + case HALIGN_RIGHT: { + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += width - length; + } else { + ofs.y += width - length; + } + } break; + } + } + + float clip_l; + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.y += TS->shaped_text_get_ascent(rid); + clip_l = MAX(0, p_pos.x - ofs.x); + } else { + ofs.x += TS->shaped_text_get_ascent(rid); + clip_l = MAX(0, p_pos.y - ofs.y); + } + return TS->shaped_text_draw(rid, p_canvas, ofs, clip_l, clip_l + width, p_color); +} + +void TextLine::draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outline_size, const Color &p_color) const { + const_cast<TextLine *>(this)->_shape(); + + Vector2 ofs = p_pos; + + float length = TS->shaped_text_get_width(rid); + if (width > 0) { + switch (align) { + case HALIGN_FILL: + case HALIGN_LEFT: + break; + case HALIGN_CENTER: { + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += Math::floor((width - length) / 2.0); + } else { + ofs.y += Math::floor((width - length) / 2.0); + } + } break; + case HALIGN_RIGHT: { + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += width - length; + } else { + ofs.y += width - length; + } + } break; + } + } + + float clip_l; + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.y += TS->shaped_text_get_ascent(rid); + clip_l = MAX(0, p_pos.x - ofs.x); + } else { + ofs.x += TS->shaped_text_get_ascent(rid); + clip_l = MAX(0, p_pos.y - ofs.y); + } + return TS->shaped_text_draw_outline(rid, p_canvas, ofs, clip_l, clip_l + width, p_outline_size, p_color); +} + +int TextLine::hit_test(float p_coords) const { + const_cast<TextLine *>(this)->_shape(); + + return TS->shaped_text_hit_test_position(rid, p_coords); +} + +TextLine::TextLine(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, TextServer::Direction p_direction, TextServer::Orientation p_orientation) { + rid = TS->create_shaped_text(p_direction, p_orientation); + TS->shaped_text_add_string(rid, p_text, p_fonts->get_rids(), p_size, p_opentype_features, p_language); +} + +TextLine::TextLine() { + rid = TS->create_shaped_text(); +} + +TextLine::~TextLine() { + TS->free(rid); +} diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h new file mode 100644 index 0000000000..ffa06cc5c1 --- /dev/null +++ b/scene/resources/text_line.h @@ -0,0 +1,114 @@ +/*************************************************************************/ +/* text_line.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TEXT_LINE_H +#define TEXT_LINE_H + +#include "scene/resources/font.h" +#include "servers/text_server.h" + +/*************************************************************************/ + +class TextLine : public Reference { + GDCLASS(TextLine, Reference); + + RID rid; + + bool dirty = true; + + float width = -1; + uint8_t flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA; + HAlign align = HALIGN_LEFT; + + Vector<float> tab_stops; + +protected: + static void _bind_methods(); + + void _shape(); + +public: + RID get_rid() const; + + void clear(); + + void set_direction(TextServer::Direction p_direction); + TextServer::Direction get_direction() const; + + void set_bidi_override(const Vector<Vector2i> &p_override); + + void set_orientation(TextServer::Orientation p_orientation); + TextServer::Orientation get_orientation() const; + + void set_preserve_invalid(bool p_enabled); + bool get_preserve_invalid() const; + + void set_preserve_control(bool p_enabled); + bool get_preserve_control() const; + + bool add_string(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = ""); + bool add_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER, int p_length = 1); + bool resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER); + + void set_align(HAlign p_align); + HAlign get_align() const; + + void tab_align(const Vector<float> &p_tab_stops); + + void set_flags(uint8_t p_flags); + uint8_t get_flags() const; + + void set_width(float p_width); + float get_width() const; + + Array get_objects() const; + Rect2 get_object_rect(Variant p_key) const; + + Size2 get_size() const; + + float get_line_ascent() const; + float get_line_descent() const; + float get_line_width() const; + float get_line_underline_position() const; + float get_line_underline_thickness() const; + + void draw(RID p_canvas, const Vector2 &p_pos, const Color &p_color = Color(1, 1, 1)) const; + void draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const; + + int hit_test(float p_coords) const; + + void _set_bidi_override(const Array &p_override); + + TextLine(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL); + TextLine(); + ~TextLine(); +}; + +#endif // TEXT_LINE_H diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp new file mode 100644 index 0000000000..d4f96ff9e8 --- /dev/null +++ b/scene/resources/text_paragraph.cpp @@ -0,0 +1,517 @@ +/*************************************************************************/ +/* text_paragraph.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "scene/resources/text_paragraph.h" + +void TextParagraph::_bind_methods() { + ClassDB::bind_method(D_METHOD("clear"), &TextParagraph::clear); + + ClassDB::bind_method(D_METHOD("set_direction", "direction"), &TextParagraph::set_direction); + ClassDB::bind_method(D_METHOD("get_direction"), &TextParagraph::get_direction); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "direction", PROPERTY_HINT_ENUM, "Auto,Light-to-right,Right-to-left"), "set_direction", "get_direction"); + + ClassDB::bind_method(D_METHOD("set_orientation", "orientation"), &TextParagraph::set_orientation); + ClassDB::bind_method(D_METHOD("get_orientation"), &TextParagraph::get_orientation); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "orientation", PROPERTY_HINT_ENUM, "Horizontal,Orientation"), "set_orientation", "get_orientation"); + + ClassDB::bind_method(D_METHOD("set_preserve_invalid", "enabled"), &TextParagraph::set_preserve_invalid); + ClassDB::bind_method(D_METHOD("get_preserve_invalid"), &TextParagraph::get_preserve_invalid); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "preserve_invalid"), "set_preserve_invalid", "get_preserve_invalid"); + + ClassDB::bind_method(D_METHOD("set_preserve_control", "enabled"), &TextParagraph::set_preserve_control); + ClassDB::bind_method(D_METHOD("get_preserve_control"), &TextParagraph::get_preserve_control); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "preserve_control"), "set_preserve_control", "get_preserve_control"); + + ClassDB::bind_method(D_METHOD("set_bidi_override", "override"), &TextParagraph::_set_bidi_override); + + ClassDB::bind_method(D_METHOD("add_string", "text", "fonts", "size", "opentype_features", "language"), &TextParagraph::add_string, DEFVAL(Dictionary()), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextParagraph::add_object, DEFVAL(VALIGN_CENTER), DEFVAL(1)); + ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextParagraph::resize_object, DEFVAL(VALIGN_CENTER)); + + ClassDB::bind_method(D_METHOD("set_align", "align"), &TextParagraph::set_align); + ClassDB::bind_method(D_METHOD("get_align"), &TextParagraph::get_align); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); + + ClassDB::bind_method(D_METHOD("tab_align", "tab_stops"), &TextParagraph::tab_align); + + ClassDB::bind_method(D_METHOD("set_flags", "flags"), &TextParagraph::set_flags); + ClassDB::bind_method(D_METHOD("get_flags"), &TextParagraph::get_flags); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Kashida justification,Word justification,Trim edge spaces after justification,Justification only after last tab,Break mandatory,Break words,Break graphemes"), "set_flags", "get_flags"); + + ClassDB::bind_method(D_METHOD("set_width", "width"), &TextParagraph::set_width); + ClassDB::bind_method(D_METHOD("get_width"), &TextParagraph::get_width); + + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width"), "set_width", "get_width"); + + ClassDB::bind_method(D_METHOD("get_non_wraped_size"), &TextParagraph::get_non_wraped_size); + ClassDB::bind_method(D_METHOD("get_size"), &TextParagraph::get_size); + + ClassDB::bind_method(D_METHOD("get_rid"), &TextParagraph::get_rid); + ClassDB::bind_method(D_METHOD("get_line_rid", "line"), &TextParagraph::get_line_rid); + + ClassDB::bind_method(D_METHOD("get_line_count"), &TextParagraph::get_line_count); + + ClassDB::bind_method(D_METHOD("get_line_objects", "line"), &TextParagraph::get_line_objects); + ClassDB::bind_method(D_METHOD("get_line_object_rect", "line", "key"), &TextParagraph::get_line_object_rect); + ClassDB::bind_method(D_METHOD("get_line_size", "line"), &TextParagraph::get_line_size); + ClassDB::bind_method(D_METHOD("get_line_range", "line"), &TextParagraph::get_line_range); + ClassDB::bind_method(D_METHOD("get_line_ascent", "line"), &TextParagraph::get_line_ascent); + ClassDB::bind_method(D_METHOD("get_line_descent", "line"), &TextParagraph::get_line_descent); + ClassDB::bind_method(D_METHOD("get_line_width", "line"), &TextParagraph::get_line_width); + ClassDB::bind_method(D_METHOD("get_line_underline_position", "line"), &TextParagraph::get_line_underline_position); + ClassDB::bind_method(D_METHOD("get_line_underline_thickness", "line"), &TextParagraph::get_line_underline_thickness); + + ClassDB::bind_method(D_METHOD("draw", "canvas", "pos", "color"), &TextParagraph::draw, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_outline", "canvas", "outline_size", "color"), &TextParagraph::draw_outline, DEFVAL(1), DEFVAL(Color(1, 1, 1))); + + ClassDB::bind_method(D_METHOD("draw_line", "canvas", "pos", "line", "color"), &TextParagraph::draw_line, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_line_outline", "canvas", "pos", "line", "outline_size", "color"), &TextParagraph::draw_line_outline, DEFVAL(1), DEFVAL(Color(1, 1, 1))); + + ClassDB::bind_method(D_METHOD("hit_test", "coords"), &TextParagraph::hit_test); +} + +void TextParagraph::_shape_lines() { + if (dirty_lines) { + for (int i = 0; i < lines.size(); i++) { + TS->free(lines[i]); + } + lines.clear(); + + if (!tab_stops.empty()) { + TS->shaped_text_tab_align(rid, tab_stops); + } + + Vector<Vector2i> line_breaks = TS->shaped_text_get_line_breaks(rid, width, 0, flags); + for (int i = 0; i < line_breaks.size(); i++) { + RID line = TS->shaped_text_substr(rid, line_breaks[i].x, line_breaks[i].y - line_breaks[i].x); + if (!tab_stops.empty()) { + TS->shaped_text_tab_align(line, tab_stops); + } + if (align == HALIGN_FILL && (line_breaks.size() == 1 || i < line_breaks.size() - 1)) { + TS->shaped_text_fit_to_width(line, width, flags); + } + lines.push_back(line); + } + dirty_lines = false; + } +} + +RID TextParagraph::get_rid() const { + return rid; +} + +RID TextParagraph::get_line_rid(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), RID()); + return lines[p_line]; +} + +void TextParagraph::clear() { + for (int i = 0; i < lines.size(); i++) { + TS->free(lines[i]); + } + lines.clear(); + TS->shaped_text_clear(rid); +} + +void TextParagraph::set_preserve_invalid(bool p_enabled) { + TS->shaped_text_set_preserve_invalid(rid, p_enabled); + dirty_lines = true; +} + +bool TextParagraph::get_preserve_invalid() const { + return TS->shaped_text_get_preserve_invalid(rid); +} + +void TextParagraph::set_preserve_control(bool p_enabled) { + TS->shaped_text_set_preserve_control(rid, p_enabled); + dirty_lines = true; +} + +bool TextParagraph::get_preserve_control() const { + return TS->shaped_text_get_preserve_control(rid); +} + +void TextParagraph::set_direction(TextServer::Direction p_direction) { + TS->shaped_text_set_direction(rid, p_direction); + dirty_lines = true; +} + +TextServer::Direction TextParagraph::get_direction() const { + const_cast<TextParagraph *>(this)->_shape_lines(); + return TS->shaped_text_get_direction(rid); +} + +void TextParagraph::set_orientation(TextServer::Orientation p_orientation) { + TS->shaped_text_set_orientation(rid, p_orientation); + dirty_lines = true; +} + +TextServer::Orientation TextParagraph::get_orientation() const { + const_cast<TextParagraph *>(this)->_shape_lines(); + return TS->shaped_text_get_orientation(rid); +} + +bool TextParagraph::add_string(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language) { + bool res = TS->shaped_text_add_string(rid, p_text, p_fonts->get_rids(), p_size, p_opentype_features, p_language); + dirty_lines = true; + return res; +} + +void TextParagraph::_set_bidi_override(const Array &p_override) { + Vector<Vector2i> overrides; + for (int i = 0; i < p_override.size(); i++) { + overrides.push_back(p_override[i]); + } + set_bidi_override(overrides); +} + +void TextParagraph::set_bidi_override(const Vector<Vector2i> &p_override) { + TS->shaped_text_set_bidi_override(rid, p_override); + dirty_lines = true; +} + +bool TextParagraph::add_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align, int p_length) { + bool res = TS->shaped_text_add_object(rid, p_key, p_size, p_inline_align, p_length); + dirty_lines = true; + return res; +} + +bool TextParagraph::resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align) { + bool res = TS->shaped_text_resize_object(rid, p_key, p_size, p_inline_align); + dirty_lines = true; + return res; +} + +void TextParagraph::set_align(HAlign p_align) { + if (align != p_align) { + if (align == HALIGN_FILL || p_align == HALIGN_FILL) { + align = p_align; + dirty_lines = true; + } else { + align = p_align; + } + } +} + +HAlign TextParagraph::get_align() const { + return align; +} + +void TextParagraph::tab_align(const Vector<float> &p_tab_stops) { + tab_stops = p_tab_stops; + dirty_lines = true; +} + +void TextParagraph::set_flags(uint8_t p_flags) { + if (flags != p_flags) { + flags = p_flags; + dirty_lines = true; + } +} + +uint8_t TextParagraph::get_flags() const { + return flags; +} + +void TextParagraph::set_width(float p_width) { + if (width != p_width) { + width = p_width; + dirty_lines = true; + } +} + +float TextParagraph::get_width() const { + return width; +} + +Size2 TextParagraph::get_non_wraped_size() const { + const_cast<TextParagraph *>(this)->_shape_lines(); + return TS->shaped_text_get_size(rid); +} + +Size2 TextParagraph::get_size() const { + const_cast<TextParagraph *>(this)->_shape_lines(); + Size2 size; + for (int i = 0; i < lines.size(); i++) { + Size2 lsize = TS->shaped_text_get_size(lines[i]); + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + size.x = MAX(size.x, lsize.x); + size.y += lsize.y; + } else { + size.x += lsize.x; + size.y = MAX(size.y, lsize.y); + } + } + return size; +} + +int TextParagraph::get_line_count() const { + const_cast<TextParagraph *>(this)->_shape_lines(); + return lines.size(); +} + +Array TextParagraph::get_line_objects(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), Array()); + return TS->shaped_text_get_objects(lines[p_line]); +} + +Rect2 TextParagraph::get_line_object_rect(int p_line, Variant p_key) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), Rect2()); + Rect2 xrect = TS->shaped_text_get_object_rect(lines[p_line], p_key); + for (int i = 0; i < p_line; i++) { + Size2 lsize = TS->shaped_text_get_size(lines[i]); + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + xrect.position.y += lsize.y; + } else { + xrect.position.x += lsize.x; + } + } + return xrect; +} + +Size2 TextParagraph::get_line_size(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), Size2()); + return TS->shaped_text_get_size(lines[p_line]); +} + +Vector2i TextParagraph::get_line_range(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), Vector2i()); + return TS->shaped_text_get_range(lines[p_line]); +} + +float TextParagraph::get_line_ascent(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), 0.f); + return TS->shaped_text_get_ascent(lines[p_line]); +} + +float TextParagraph::get_line_descent(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), 0.f); + return TS->shaped_text_get_descent(lines[p_line]); +} + +float TextParagraph::get_line_width(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), 0.f); + return TS->shaped_text_get_width(lines[p_line]); +} + +float TextParagraph::get_line_underline_position(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), 0.f); + return TS->shaped_text_get_underline_position(lines[p_line]); +} + +float TextParagraph::get_line_underline_thickness(int p_line) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND_V(p_line < 0 || p_line >= lines.size(), 0.f); + return TS->shaped_text_get_underline_thickness(lines[p_line]); +} + +void TextParagraph::draw(RID p_canvas, const Vector2 &p_pos, const Color &p_color) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + Vector2 ofs = p_pos; + for (int i = 0; i < lines.size(); i++) { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x = p_pos.x; + ofs.y += TS->shaped_text_get_ascent(lines[i]); + } else { + ofs.y = p_pos.y; + ofs.x += TS->shaped_text_get_ascent(lines[i]); + } + float length = TS->shaped_text_get_width(lines[i]); + if (width > 0) { + switch (align) { + case HALIGN_FILL: + case HALIGN_LEFT: + break; + case HALIGN_CENTER: { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += Math::floor((width - length) / 2.0); + } else { + ofs.y += Math::floor((width - length) / 2.0); + } + } break; + case HALIGN_RIGHT: { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += width - length; + } else { + ofs.y += width - length; + } + } break; + } + } + float clip_l; + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + clip_l = MAX(0, p_pos.x - ofs.x); + } else { + clip_l = MAX(0, p_pos.y - ofs.y); + } + TS->shaped_text_draw(lines[i], p_canvas, ofs, clip_l, clip_l + width, p_color); + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x = p_pos.x; + ofs.y += TS->shaped_text_get_descent(lines[i]); + } else { + ofs.y = p_pos.y; + ofs.x += TS->shaped_text_get_descent(lines[i]); + } + } +} + +void TextParagraph::draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outline_size, const Color &p_color) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + Vector2 ofs = p_pos; + for (int i = 0; i < lines.size(); i++) { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x = p_pos.x; + ofs.y += TS->shaped_text_get_ascent(lines[i]); + } else { + ofs.y = p_pos.y; + ofs.x += TS->shaped_text_get_ascent(lines[i]); + } + float length = TS->shaped_text_get_width(lines[i]); + if (width > 0) { + switch (align) { + case HALIGN_FILL: + case HALIGN_LEFT: + break; + case HALIGN_CENTER: { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += Math::floor((width - length) / 2.0); + } else { + ofs.y += Math::floor((width - length) / 2.0); + } + } break; + case HALIGN_RIGHT: { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x += width - length; + } else { + ofs.y += width - length; + } + } break; + } + } + float clip_l; + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + clip_l = MAX(0, p_pos.x - ofs.x); + } else { + clip_l = MAX(0, p_pos.y - ofs.y); + } + TS->shaped_text_draw_outline(lines[i], p_canvas, ofs, clip_l, clip_l + width, p_outline_size, p_color); + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.x = p_pos.x; + ofs.y += TS->shaped_text_get_descent(lines[i]); + } else { + ofs.y = p_pos.y; + ofs.x += TS->shaped_text_get_descent(lines[i]); + } + } +} + +int TextParagraph::hit_test(const Point2 &p_coords) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + Vector2 ofs; + if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { + if (ofs.y < 0) + return 0; + } else { + if (ofs.x < 0) + return 0; + } + for (int i = 0; i < lines.size(); i++) { + if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { + if ((p_coords.y >= ofs.y) && (p_coords.y <= ofs.y + TS->shaped_text_get_size(lines[i]).y)) { + return TS->shaped_text_hit_test_position(lines[i], p_coords.x); + } + } else { + if ((p_coords.x >= ofs.x) && (p_coords.x <= ofs.x + TS->shaped_text_get_size(lines[i]).x)) { + return TS->shaped_text_hit_test_position(lines[i], p_coords.y); + } + } + } + return TS->shaped_text_get_range(rid).y; +} + +void TextParagraph::draw_line(RID p_canvas, const Vector2 &p_pos, int p_line, const Color &p_color) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND(p_line < 0 || p_line >= lines.size()); + + Vector2 ofs = p_pos; + if (TS->shaped_text_get_orientation(lines[p_line]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.y += TS->shaped_text_get_ascent(lines[p_line]); + } else { + ofs.x += TS->shaped_text_get_ascent(lines[p_line]); + } + return TS->shaped_text_draw(lines[p_line], p_canvas, ofs, -1, -1, p_color); +} + +void TextParagraph::draw_line_outline(RID p_canvas, const Vector2 &p_pos, int p_line, int p_outline_size, const Color &p_color) const { + const_cast<TextParagraph *>(this)->_shape_lines(); + ERR_FAIL_COND(p_line < 0 || p_line >= lines.size()); + + Vector2 ofs = p_pos; + if (TS->shaped_text_get_orientation(lines[p_line]) == TextServer::ORIENTATION_HORIZONTAL) { + ofs.y += TS->shaped_text_get_ascent(lines[p_line]); + } else { + ofs.x += TS->shaped_text_get_ascent(lines[p_line]); + } + return TS->shaped_text_draw_outline(lines[p_line], p_canvas, ofs, -1, -1, p_outline_size, p_color); +} + +TextParagraph::TextParagraph(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, float p_width, TextServer::Direction p_direction, TextServer::Orientation p_orientation) { + rid = TS->create_shaped_text(p_direction, p_orientation); + TS->shaped_text_add_string(rid, p_text, p_fonts->get_rids(), p_size, p_opentype_features, p_language); + width = p_width; + dirty_lines = true; +} + +TextParagraph::TextParagraph() { + rid = TS->create_shaped_text(); +} + +TextParagraph::~TextParagraph() { + for (int i = 0; i < lines.size(); i++) { + TS->free(lines[i]); + } + lines.clear(); + TS->free(rid); +} diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h new file mode 100644 index 0000000000..587bb6bfc1 --- /dev/null +++ b/scene/resources/text_paragraph.h @@ -0,0 +1,124 @@ +/*************************************************************************/ +/* text_paragraph.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TEXT_PARAGRAPH_H +#define TEXT_PARAGRAPH_H + +#include "scene/resources/font.h" +#include "servers/text_server.h" + +/*************************************************************************/ + +class TextParagraph : public Reference { + GDCLASS(TextParagraph, Reference); + + RID rid; + Vector<RID> lines; + + bool dirty_lines = true; + + float width = -1; + uint8_t flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA; + HAlign align = HALIGN_LEFT; + + Vector<float> tab_stops; + +protected: + static void _bind_methods(); + + void _shape_lines(); + +public: + RID get_rid() const; + RID get_line_rid(int p_line) const; + + void clear(); + + void set_direction(TextServer::Direction p_direction); + TextServer::Direction get_direction() const; + + void set_orientation(TextServer::Orientation p_orientation); + TextServer::Orientation get_orientation() const; + + void set_preserve_invalid(bool p_enabled); + bool get_preserve_invalid() const; + + void set_preserve_control(bool p_enabled); + bool get_preserve_control() const; + + void set_bidi_override(const Vector<Vector2i> &p_override); + + bool add_string(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = ""); + bool add_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER, int p_length = 1); + bool resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER); + + void set_align(HAlign p_align); + HAlign get_align() const; + + void tab_align(const Vector<float> &p_tab_stops); + + void set_flags(uint8_t p_flags); + uint8_t get_flags() const; + + void set_width(float p_width); + float get_width() const; + + Size2 get_non_wraped_size() const; + + Size2 get_size() const; + + int get_line_count() const; + + Array get_line_objects(int p_line) const; + Rect2 get_line_object_rect(int p_line, Variant p_key) const; + Size2 get_line_size(int p_line) const; + float get_line_ascent(int p_line) const; + float get_line_descent(int p_line) const; + float get_line_width(int p_line) const; + Vector2i get_line_range(int p_line) const; + float get_line_underline_position(int p_line) const; + float get_line_underline_thickness(int p_line) const; + + void draw(RID p_canvas, const Vector2 &p_pos, const Color &p_color = Color(1, 1, 1)) const; + void draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const; + + void draw_line(RID p_canvas, const Vector2 &p_pos, int p_line, const Color &p_color = Color(1, 1, 1)) const; + void draw_line_outline(RID p_canvas, const Vector2 &p_pos, int p_line, int p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const; + + int hit_test(const Point2 &p_coords) const; + + void _set_bidi_override(const Array &p_override); + + TextParagraph(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", float p_width = -1.f, TextServer::Direction p_direction = TextServer::DIRECTION_AUTO, TextServer::Orientation p_orientation = TextServer::ORIENTATION_HORIZONTAL); + TextParagraph(); + ~TextParagraph(); +}; + +#endif // TEXT_PARAGRAPH_H diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index ccff49829e..d130470275 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -96,6 +96,21 @@ Vector<String> Theme::_get_font_list(const String &p_node_type) const { return ilret; } +Vector<String> Theme::_get_font_size_list(const String &p_node_type) const { + Vector<String> ilret; + List<StringName> il; + + get_font_size_list(p_node_type, &il); + ilret.resize(il.size()); + + int i = 0; + String *w = ilret.ptrw(); + for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + return ilret; +} + Vector<String> Theme::_get_color_list(const String &p_node_type) const { Vector<String> ilret; List<StringName> il; @@ -291,11 +306,27 @@ Ref<Font> Theme::get_default_theme_font() const { return default_theme_font; } +void Theme::set_default_theme_font_size(int p_font_size) { + if (default_theme_font_size == p_font_size) { + return; + } + + default_theme_font_size = p_font_size; + + _change_notify(); + emit_changed(); +} + +int Theme::get_default_theme_font_size() const { + return default_theme_font_size; +} + Ref<Theme> Theme::project_default_theme; Ref<Theme> Theme::default_theme; Ref<Texture2D> Theme::default_icon; Ref<StyleBox> Theme::default_style; Ref<Font> Theme::default_font; +int Theme::default_font_size = 16; Ref<Theme> Theme::get_default() { return default_theme; @@ -325,6 +356,10 @@ void Theme::set_default_font(const Ref<Font> &p_font) { default_font = p_font; } +void Theme::set_default_font_size(int p_font_size) { + default_font_size = p_font_size; +} + void Theme::set_icon(const StringName &p_name, const StringName &p_node_type, const Ref<Texture2D> &p_icon) { //ERR_FAIL_COND(p_icon.is_null()); @@ -534,7 +569,7 @@ Ref<Font> Theme::get_font(const StringName &p_name, const StringName &p_node_typ } bool Theme::has_font(const StringName &p_name, const StringName &p_node_type) const { - return (font_map.has(p_node_type) && font_map[p_node_type].has(p_name) && font_map[p_node_type][p_name].is_valid()); + return ((font_map.has(p_node_type) && font_map[p_node_type].has(p_name) && font_map[p_node_type][p_name].is_valid()) || default_theme_font.is_valid()); } void Theme::clear_font(const StringName &p_name, const StringName &p_node_type) { @@ -564,6 +599,54 @@ void Theme::get_font_list(StringName p_node_type, List<StringName> *p_list) cons } } +void Theme::set_font_size(const StringName &p_name, const StringName &p_node_type, int p_font_size) { + bool new_value = !font_size_map.has(p_node_type) || !font_size_map[p_node_type].has(p_name); + + font_size_map[p_node_type][p_name] = p_font_size; + + if (new_value) { + _change_notify(); + emit_changed(); + } +} + +int Theme::get_font_size(const StringName &p_name, const StringName &p_node_type) const { + if (font_size_map.has(p_node_type) && font_size_map[p_node_type].has(p_name) && (font_size_map[p_node_type][p_name] > 0)) { + return font_size_map[p_node_type][p_name]; + } else if (default_theme_font_size > 0) { + return default_theme_font_size; + } else { + return default_font_size; + } +} + +bool Theme::has_font_size(const StringName &p_name, const StringName &p_node_type) const { + return ((font_size_map.has(p_node_type) && font_size_map[p_node_type].has(p_name) && (font_size_map[p_node_type][p_name] > 0)) || (default_theme_font_size > 0)); +} + +void Theme::clear_font_size(const StringName &p_name, const StringName &p_node_type) { + ERR_FAIL_COND(!font_size_map.has(p_node_type)); + ERR_FAIL_COND(!font_size_map[p_node_type].has(p_name)); + + font_size_map[p_node_type].erase(p_name); + _change_notify(); + emit_changed(); +} + +void Theme::get_font_size_list(StringName p_node_type, List<StringName> *p_list) const { + ERR_FAIL_NULL(p_list); + + if (!font_size_map.has(p_node_type)) { + return; + } + + const StringName *key = nullptr; + + while ((key = font_size_map[p_node_type].next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_color(const StringName &p_name, const StringName &p_node_type, const Color &p_color) { bool new_value = !color_map.has(p_node_type) || !color_map[p_node_type].has(p_name); @@ -819,6 +902,12 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_font", "name", "node_type"), &Theme::clear_font); ClassDB::bind_method(D_METHOD("get_font_list", "node_type"), &Theme::_get_font_list); + ClassDB::bind_method(D_METHOD("set_font_size", "name", "node_type", "font_size"), &Theme::set_font_size); + ClassDB::bind_method(D_METHOD("get_font_size", "name", "node_type"), &Theme::get_font_size); + ClassDB::bind_method(D_METHOD("has_font_size", "name", "node_type"), &Theme::has_font_size); + ClassDB::bind_method(D_METHOD("clear_font_size", "name", "node_type"), &Theme::clear_font_size); + ClassDB::bind_method(D_METHOD("get_font_size_list", "node_type"), &Theme::_get_font_size_list); + ClassDB::bind_method(D_METHOD("set_color", "name", "node_type", "color"), &Theme::set_color); ClassDB::bind_method(D_METHOD("get_color", "name", "node_type"), &Theme::get_color); ClassDB::bind_method(D_METHOD("has_color", "name", "node_type"), &Theme::has_color); @@ -836,12 +925,16 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_font", "font"), &Theme::set_default_theme_font); ClassDB::bind_method(D_METHOD("get_default_font"), &Theme::get_default_theme_font); + ClassDB::bind_method(D_METHOD("set_default_font_size", "font_size"), &Theme::set_default_theme_font_size); + ClassDB::bind_method(D_METHOD("get_default_font_size"), &Theme::get_default_theme_font_size); + ClassDB::bind_method(D_METHOD("get_type_list", "node_type"), &Theme::_get_type_list); ClassDB::bind_method("copy_default_theme", &Theme::copy_default_theme); ClassDB::bind_method(D_METHOD("copy_theme", "other"), &Theme::copy_theme); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "default_font", PROPERTY_HINT_RESOURCE_TYPE, "Font"), "set_default_font", "get_default_font"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "default_font_size"), "set_default_font_size", "get_default_font_size"); } Theme::Theme() { diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 9c17a69e5d..4175e19112 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -47,6 +47,7 @@ class Theme : public Resource { HashMap<StringName, HashMap<StringName, Ref<Texture2D>>> icon_map; HashMap<StringName, HashMap<StringName, Ref<StyleBox>>> style_map; HashMap<StringName, HashMap<StringName, Ref<Font>>> font_map; + HashMap<StringName, HashMap<StringName, int>> font_size_map; HashMap<StringName, HashMap<StringName, Ref<Shader>>> shader_map; HashMap<StringName, HashMap<StringName, Color>> color_map; HashMap<StringName, HashMap<StringName, int>> constant_map; @@ -55,6 +56,7 @@ class Theme : public Resource { Vector<String> _get_stylebox_list(const String &p_node_type) const; Vector<String> _get_stylebox_types() const; Vector<String> _get_font_list(const String &p_node_type) const; + Vector<String> _get_font_size_list(const String &p_node_type) const; Vector<String> _get_color_list(const String &p_node_type) const; Vector<String> _get_constant_list(const String &p_node_type) const; Vector<String> _get_type_list(const String &p_node_type) const; @@ -69,8 +71,10 @@ protected: static Ref<Texture2D> default_icon; static Ref<StyleBox> default_style; static Ref<Font> default_font; + static int default_font_size; Ref<Font> default_theme_font; + int default_theme_font_size = -1; static void _bind_methods(); @@ -84,10 +88,14 @@ public: static void set_default_icon(const Ref<Texture2D> &p_icon); static void set_default_style(const Ref<StyleBox> &p_style); static void set_default_font(const Ref<Font> &p_font); + static void set_default_font_size(int p_font_size); void set_default_theme_font(const Ref<Font> &p_default_font); Ref<Font> get_default_theme_font() const; + void set_default_theme_font_size(int p_font_size); + int get_default_theme_font_size() const; + void set_icon(const StringName &p_name, const StringName &p_node_type, const Ref<Texture2D> &p_icon); Ref<Texture2D> get_icon(const StringName &p_name, const StringName &p_node_type) const; bool has_icon(const StringName &p_name, const StringName &p_node_type) const; @@ -113,6 +121,12 @@ public: void clear_font(const StringName &p_name, const StringName &p_node_type); void get_font_list(StringName p_node_type, List<StringName> *p_list) const; + void set_font_size(const StringName &p_name, const StringName &p_node_type, int p_font_size); + int get_font_size(const StringName &p_name, const StringName &p_node_type) const; + bool has_font_size(const StringName &p_name, const StringName &p_node_type) const; + void clear_font_size(const StringName &p_name, const StringName &p_node_type); + void get_font_size_list(StringName p_node_type, List<StringName> *p_list) const; + void set_color(const StringName &p_name, const StringName &p_node_type, const Color &p_color); Color get_color(const StringName &p_name, const StringName &p_node_type) const; bool has_color(const StringName &p_name, const StringName &p_node_type) const; |