diff options
159 files changed, 7945 insertions, 5027 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 04b2452a9a..0776dc77eb 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -18,16 +18,16 @@ jobs: fail-fast: false matrix: include: -# - name: Editor w/ Mono (target=release_debug, tools=yes, tests=yes) -# cache-name: linux-editor-mono -# target: release_debug -# tools: true -# tests: false # Disabled due freeze caused by mix Mono build and CI -# sconsflags: module_mono_enabled=yes mono_static=yes mono_glue=no -# doc-test: true -# bin: "./bin/godot.linuxbsd.opt.tools.64.mono" -# build-mono: true -# artifact: true + - name: Editor w/ Mono (target=release_debug, tools=yes, tests=yes) + cache-name: linux-editor-mono + target: release_debug + tools: true + tests: false # Disabled due freeze caused by mix Mono build and CI + sconsflags: module_mono_enabled=yes mono_static=yes mono_glue=no + doc-test: true + bin: "./bin/godot.linuxbsd.opt.tools.64.mono" + build-mono: true + artifact: true - name: Editor with doubles and sanitizers (target=debug, tools=yes, float=64, tests=yes, use_asan=yes, use_ubsan=yes) cache-name: linux-editor-double-sanitizers @@ -42,14 +42,14 @@ jobs: # Skip 2GiB artifact speeding up action. artifact: false -# - name: Template w/ Mono (target=release, tools=no) -# cache-name: linux-template-mono -# target: release -# tools: false -# tests: false -# sconsflags: module_mono_enabled=yes mono_static=yes mono_glue=no debug_symbols=no -# build-mono: false -# artifact: true + - name: Template w/ Mono (target=release, tools=no) + cache-name: linux-template-mono + target: release + tools: false + tests: false + sconsflags: module_mono_enabled=yes mono_static=yes mono_glue=no debug_symbols=no + build-mono: false + artifact: true - name: Minimal Template (target=release, tools=no, everything disabled) cache-name: linux-template-minimal diff --git a/AUTHORS.md b/AUTHORS.md index 07a67de77b..4d52e3d1e0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -197,6 +197,7 @@ name is available. Ray Koopa (RayKoopa) Rémi Verschelde (akien-mga) Rhody Lugo (rraallvv) + Ricardo Buring (rburing) Ricardo Subtil (Ev1lbl0w) Roberto F. Arroyo (robfram) Robin Hübner (profan) @@ -232,7 +233,7 @@ name is available. Wilson E. Alvarez (Rubonnek) Xavier Cho (mysticfall) yg2f (SuperUserNameMan) - Yuri Roubinsky (Chaosus) + Yuri Rubinsky (Chaosus) Yuri Sizov (pycbouh) Zae Chao (zaevi) Zak Stam (zaksnet) @@ -22,7 +22,6 @@ generous deed immortalized in the next stable release of Godot Engine. ## Silver sponsors ASIFA-Hollywood <https://www.asifa-hollywood.org> - LITSLINK <https://litslink.com> ORE System <https://ore-system.com> ## Bronze sponsors @@ -36,8 +35,9 @@ generous deed immortalized in the next stable release of Godot Engine. Hunter Dickson Kitcat490 Kyle Szklenski + Maxim Karsten Moonwards <https://www.moonwards.com> - TrampolineTales <http://trampolinetales.com> + TrampolineTales <https://trampolinetales.com> ## Mini sponsors @@ -49,7 +49,6 @@ generous deed immortalized in the next stable release of Godot Engine. Christian Baune Christopher Montesano Christopher Shifflett - CodeLikeCammy Daniel Edwards Darrin Massena David Mydlarz @@ -69,8 +68,8 @@ generous deed immortalized in the next stable release of Godot Engine. Kossi Selom Banybah Marcel Kräml Marek Belski + Markus Ort Matthieu Huvé - Maxim Karsten Michael Mike King Nassor Paulino da Silva @@ -124,14 +123,12 @@ generous deed immortalized in the next stable release of Godot Engine. Mathieu Matthew Hillier Officine Pixel S.n.c. - Patrick Brock Pedro Silva Retro Village Rob Messick Roland Fredenhagen Ronan Zeegers Sarksus - Scott B Sean Sergey Sofox @@ -145,6 +142,7 @@ generous deed immortalized in the next stable release of Godot Engine. Victor Xeno Coliseum + Adam Mill Adam Nakonieczny Adam Nelson Adrian Adamiak @@ -160,14 +158,12 @@ generous deed immortalized in the next stable release of Godot Engine. Antoni Batchelli Arch Henderson III Arthur S. Muszynski - Brandon Hawkinson + c64cosmin Cameron Connolly - Carl Kryschi Charlie Whitfield Chase Taranto Chris Petrich Chris Serino - Cow Craig Ostrin Craig Scarborough Craig Smith @@ -180,6 +176,7 @@ generous deed immortalized in the next stable release of Godot Engine. Daniel Hernández Alcojor Daniel Tebbutt Darrian Little + Daylon Dennis Belfrage Dev To be curious Dima Fedotov @@ -187,6 +184,7 @@ generous deed immortalized in the next stable release of Godot Engine. Dmitriy Khudorozhkov Donn Eddy Douglas Hammond + EerieExpanse Eric Brand Eugenio Hugo Salgüero Jáñez EXUREI @@ -198,7 +196,6 @@ generous deed immortalized in the next stable release of Godot Engine. Gabrielius Vaiškūnas Gary Hulst gavlig - General Chicken Geoffroy Warin GGGames.org gisora @@ -207,7 +204,7 @@ generous deed immortalized in the next stable release of Godot Engine. Harry Tumber Harvey Fong Heath Hayes - Horváth Péter + Horváth-Lázár Péter Hu Hund Hunter Barabas HurrieCrane @@ -219,6 +216,7 @@ generous deed immortalized in the next stable release of Godot Engine. Jean-Sébastien Ross Jennifer Wilcox Jeremi Biernacki + Jesús Chicharro Joel Fivat Johnathan Kupferer Josef Stumpfegger @@ -243,6 +241,7 @@ generous deed immortalized in the next stable release of Godot Engine. Leo Fidel R Liban Liam Smyth LoparPanda + LordZaruflex Luca Vazzano Luke MadScientistCarl @@ -256,17 +255,17 @@ generous deed immortalized in the next stable release of Godot Engine. matt Matt Greene Matthew Hall + Max Kryschi medecau Michael Dürwald Michael Policastro - Michael Seawell + Miika Moilanen MikadoSC Mike Barbee nate etan Nick Abousselam Nicola Cocchiaro Nicolás Carrasco - Nicole Barovic Oliver Dick Oscar Campos Paul Hocker @@ -291,6 +290,7 @@ generous deed immortalized in the next stable release of Godot Engine. Romeo Disca Ronnie Ashlock Ronny Mühle + Russ Ryan Breaker Ryan Heath Ryan Scott @@ -314,7 +314,6 @@ generous deed immortalized in the next stable release of Godot Engine. Sven F. Thomas Bjarnelöf Thomas Kurz - Tim Howard Timothy van der Valk Tobias Bocanegra Tobias Raggl @@ -326,7 +325,6 @@ generous deed immortalized in the next stable release of Godot Engine. Turntsnaco Valryia Vincent Cloutier - Vlad Ceru Opran VoidPointer Winston Wojciech Chojnacki @@ -353,6 +351,7 @@ generous deed immortalized in the next stable release of Godot Engine. Aidan O'Flannagain Aki Mimoto Alan Beauchamp + Albert Gyulgazyan Alberto Salazar Muñoz Alberto Vilches Alder Stefano @@ -360,7 +359,6 @@ generous deed immortalized in the next stable release of Godot Engine. AleMax Ales Jelovcan Alessandro Senese - Alexander Ravenheart Alex Chan Alex Clavelle alex raeside @@ -389,10 +387,9 @@ generous deed immortalized in the next stable release of Godot Engine. AzulCrescent b110110 Balázs Batári - Bálint Horváth Beau Seymour + Behzad Ghaffari Benedikt - Benoit Jauvin-Girard Ben Ridley Ben Vercammen Bernd Jänichen @@ -411,9 +408,9 @@ generous deed immortalized in the next stable release of Godot Engine. Brodie Fairhall Bronson Zgeb Burney Waring - c64cosmin Caleb Gartner Caleb Makela + Caliburn Cameron Meyer Carlos Rios Carl van der Geest @@ -421,7 +418,7 @@ generous deed immortalized in the next stable release of Godot Engine. Cassidy James Chad Steadman Checkpoint Charlie - Chris Chapin + ChrBohm Chris Jagusch Chris Langford Christian Mauduit @@ -430,15 +427,14 @@ generous deed immortalized in the next stable release of Godot Engine. Christophe Gagnier Christopher Chin Christoph Woinke + Codecat Cody Parker - CoffeeFingers Conall O Conner Lane Corchari - Craig Maloney + Corey W Craig Post Dakota Watkins - damucz Daniel Cheney Daren Scot Wilson Dave Walker @@ -450,18 +446,17 @@ generous deed immortalized in the next stable release of Godot Engine. Devin Carraway Diego Pereira Dimitri Roche - Dmitry Fisher (Raccoon path) Dmytro Korchynskyi Dominik Wetzel Don B Douglas Plumley Dragontrapper Dr Ewan Murray + Ducky Duobix Duodecimal Eduardo Teixeira Edward Herbert - Edward L Edward Swartz Egon Elbre Elgenzay @@ -496,18 +491,17 @@ generous deed immortalized in the next stable release of Godot Engine. Greg Olson Greyson Richey Grid - Grok Games Grominet Guillaume Pham Ngoc Guldoman + Guo Hongci gurehamu Hal A Haplo Hayden Foley Heribert Hirth Hinken - Houdini Blueprints - Ian ORourke + Ian Richard Kunert Ian Williams Idilio Alfaro IndustrialRobot @@ -543,6 +537,7 @@ generous deed immortalized in the next stable release of Godot Engine. Joe Hurdle Joe Klemmer Joel Höglund + John Anders Stav John Bruce John Gabriel Jonas @@ -566,6 +561,7 @@ generous deed immortalized in the next stable release of Godot Engine. Josh P Josh Taylor Joshua Heidrich + Joshua Segall jromkjrom Juanfran Juan Maggi @@ -575,10 +571,10 @@ generous deed immortalized in the next stable release of Godot Engine. Julian Murgia June Little Justin Hamilton - Justin Hurst Justin Oaksford Justin Spedding KaDokta + Karol Wojtasiuk (Drakonter) Katsuomi Kobayashi Keedong Park keeganstoybox @@ -607,11 +603,11 @@ generous deed immortalized in the next stable release of Godot Engine. Laurent CHEA Laurent Dethoor Laxman Pradhan + Leland Vakarian LEMMiNO Leonardo Dimano Linus Lind Lundgren Logan Apple - Luca Poli Ludovic DELVAL Luigi Renna Luis Gaemperle @@ -624,14 +620,13 @@ generous deed immortalized in the next stable release of Godot Engine. Mark Malone Markus Martin Markus Michael Egger - Markus Ort Markus Strompen Martin FIbik Martin Holas + Martin Linklater Martin Liška Martin Trbola Martin Zabinski - Mathieu Meissonnier Matt Edwards Matthew Booe Matt Sylvia @@ -652,7 +647,6 @@ generous deed immortalized in the next stable release of Godot Engine. Michał Skwarek Mikael Nordenberg Mikayla - Mike Mike Birkhead Mike Copley Mitchell @@ -662,7 +656,6 @@ generous deed immortalized in the next stable release of Godot Engine. Molinghu Molly Jameson MoltenGears - Moowool moulefrite MrAZIE Mrjemandem @@ -683,16 +676,16 @@ generous deed immortalized in the next stable release of Godot Engine. Nils Nordmark Nima Farid Noel Billig + Noesis oceoh Okatima Oleg Reva Oliver Ambrose - Oriol Muñoz Princep oscar1000108 Oscar Domingo - p Pascal Patrick Indermühle + Patrickm Patrick Nafarrete Patrick Wuttke Paul E Hansen @@ -719,7 +712,6 @@ generous deed immortalized in the next stable release of Godot Engine. Rammeow RAMupgrade red1939 - Relintai Remi Rampin Reneator René Habermann @@ -728,6 +720,7 @@ generous deed immortalized in the next stable release of Godot Engine. Richard Ivánek Richard Néveri Riley + Robin Ward RobotCritter Rob Ruana Rodrigo Loli @@ -739,6 +732,7 @@ generous deed immortalized in the next stable release of Godot Engine. Ronan Roy Scayged Ryan Groom + Rykk Sam Caulfield Sam Edson Sammy Fischer @@ -766,10 +760,10 @@ generous deed immortalized in the next stable release of Godot Engine. slavfox smbe19 smo1704 + Snippytorque Soheib El-Harrache Solene Waked Sophie Winter - Spencer Everhart Squirrel Stéphane Roussel Stephen Rice diff --git a/SConstruct b/SConstruct index aa31c39d32..a847535812 100644 --- a/SConstruct +++ b/SConstruct @@ -741,7 +741,7 @@ if selected_platform in platform_list: if env["minizip"]: env.Append(CPPDEFINES=["MINIZIP_ENABLED"]) - editor_module_list = ["freetype"] + editor_module_list = [] if env["tools"] and not env.module_check_dependencies("tools", editor_module_list): print( "Build option 'module_" diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index ab0f36132f..52c7c69315 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -424,8 +424,13 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool p_exact_ma } else { match = get_physical_keycode() == key->get_physical_keycode(); } + Key action_mask = get_modifiers_mask(); + Key key_mask = key->get_modifiers_mask(); + if (key->is_pressed()) { + match &= (action_mask & key_mask) == action_mask; + } if (p_exact_match) { - match &= get_modifiers_mask() == key->get_modifiers_mask(); + match &= action_mask == key_mask; } if (match) { bool pressed = key->is_pressed(); @@ -589,8 +594,13 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool p_ } bool match = button_index == mb->button_index; + Key action_mask = get_modifiers_mask(); + Key button_mask = mb->get_modifiers_mask(); + if (mb->is_pressed()) { + match &= (action_mask & button_mask) == action_mask; + } if (p_exact_match) { - match &= get_modifiers_mask() == mb->get_modifiers_mask(); + match &= action_mask == button_mask; } if (match) { bool pressed = mb->is_pressed(); diff --git a/core/io/image.cpp b/core/io/image.cpp index 766c84bdbe..5376b78a89 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -3112,8 +3112,8 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("generate_mipmaps", "renormalize"), &Image::generate_mipmaps, DEFVAL(false)); ClassDB::bind_method(D_METHOD("clear_mipmaps"), &Image::clear_mipmaps); - ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::_create_empty); - ClassDB::bind_method(D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::_create_from_data); + ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::create_empty); + ClassDB::bind_method(D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::create_from_data); ClassDB::bind_method(D_METHOD("is_empty"), &Image::is_empty); diff --git a/core/io/image.h b/core/io/image.h index 53bfa0881f..39c700565b 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -155,14 +155,6 @@ protected: static void _bind_methods(); private: - void _create_empty(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { - create(p_width, p_height, p_use_mipmaps, p_format); - } - - void _create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { - create(p_width, p_height, p_use_mipmaps, p_format, p_data); - } - Format format = FORMAT_L8; Vector<uint8_t> data; int width = 0; @@ -289,6 +281,14 @@ public: Vector<uint8_t> save_png_to_buffer() const; Error save_exr(const String &p_path, bool p_grayscale) const; + void create_empty(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { + create(p_width, p_height, p_use_mipmaps, p_format); + } + + void create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { + create(p_width, p_height, p_use_mipmaps, p_format, p_data); + } + /** * create an empty image */ diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index 3a03c0a10b..24907d34c8 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -41,8 +41,8 @@ static const _KeyCodeText _keycodes[] = { /* clang-format off */ {Key::ESCAPE ,"Escape"}, {Key::TAB ,"Tab"}, - {Key::BACKTAB ,"BackTab"}, - {Key::BACKSPACE ,"BackSpace"}, + {Key::BACKTAB ,"Backtab"}, + {Key::BACKSPACE ,"Backspace"}, {Key::ENTER ,"Enter"}, {Key::KP_ENTER ,"Kp Enter"}, {Key::INSERT ,"Insert"}, diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 759c121f29..7cfd34b53e 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -463,6 +463,12 @@ String String::operator+(const String &p_str) const { return res; } +String String::operator+(char32_t p_char) const { + String res = *this; + res += p_char; + return res; +} + String operator+(const char *p_chr, const String &p_str) { String tmp = p_chr; tmp += p_str; diff --git a/core/string/ustring.h b/core/string/ustring.h index 1d302b65a7..5e7904d827 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -225,6 +225,7 @@ public: bool operator==(const String &p_str) const; bool operator!=(const String &p_str) const; String operator+(const String &p_str) const; + String operator+(char32_t p_char) const; String &operator+=(const String &); String &operator+=(char32_t p_char); diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 17be51eba6..a02f9c5823 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1467,6 +1467,8 @@ static void _register_variant_builtin_methods() { bind_static_method(String, num_scientific, sarray("number"), varray()); bind_static_method(String, num, sarray("number", "decimals"), varray(-1)); + bind_static_method(String, num_int64, sarray("number", "base", "capitalize_hex"), varray(10, false)); + bind_static_method(String, num_uint64, sarray("number", "base", "capitalize_hex"), varray(10, false)); bind_static_method(String, chr, sarray("char"), varray()); bind_static_method(String, humanize_size, sarray("size"), varray()); diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index cd1ae9f41f..35e0319aa3 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -177,6 +177,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorAdd<double, double, double>>(Variant::OP_ADD, Variant::FLOAT, Variant::FLOAT); register_op<OperatorEvaluatorAdd<String, String, String>>(Variant::OP_ADD, Variant::STRING, Variant::STRING); register_op<OperatorEvaluatorAdd<String, char32_t, String>>(Variant::OP_ADD, Variant::INT, Variant::STRING); + register_op<OperatorEvaluatorAdd<String, String, char32_t>>(Variant::OP_ADD, Variant::STRING, Variant::INT); register_op<OperatorEvaluatorAdd<Vector2, Vector2, Vector2>>(Variant::OP_ADD, Variant::VECTOR2, Variant::VECTOR2); register_op<OperatorEvaluatorAdd<Vector2i, Vector2i, Vector2i>>(Variant::OP_ADD, Variant::VECTOR2I, Variant::VECTOR2I); register_op<OperatorEvaluatorAdd<Vector3, Vector3, Vector3>>(Variant::OP_ADD, Variant::VECTOR3, Variant::VECTOR3); diff --git a/doc/classes/AnimationNodeBlendTree.xml b/doc/classes/AnimationNodeBlendTree.xml index 20eb349363..fcdd09f144 100644 --- a/doc/classes/AnimationNodeBlendTree.xml +++ b/doc/classes/AnimationNodeBlendTree.xml @@ -4,7 +4,8 @@ [AnimationTree] node resource that contains many blend type nodes. </brief_description> <description> - This node may contain a sub-tree of any other blend type nodes, such as mix, blend2, blend3, one shot, etc. This is one of the most commonly used roots. + This node may contain a sub-tree of any other blend type nodes, such as [AnimationNodeTransition], [AnimationNodeBlend2], [AnimationNodeBlend3], [AnimationNodeOneShot], etc. This is one of the most commonly used roots. + An [AnimationNodeOutput] node named [code]output[/code] is created by default. </description> <tutorials> <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index c7451509f3..1fe2f5a756 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -80,6 +80,17 @@ Draws a colored polygon of any amount of points, convex or concave. Unlike [method draw_polygon], a single color must be specified for the whole polygon. </description> </method> + <method name="draw_dashed_line"> + <return type="void" /> + <argument index="0" name="from" type="Vector2" /> + <argument index="1" name="to" type="Vector2" /> + <argument index="2" name="color" type="Color" /> + <argument index="3" name="width" type="float" default="1.0" /> + <argument index="4" name="dash" type="float" default="2.0" /> + <description> + Draws a dashed line from a 2D point to another, with a given color and width. See also [method draw_multiline] and [method draw_polyline]. + </description> + </method> <method name="draw_end_animation"> <return type="void" /> <description> @@ -428,14 +439,14 @@ <return type="void" /> <argument index="0" name="enable" type="bool" /> <description> - If [code]enable[/code] is [code]true[/code], children will be updated with local transform data. + If [code]enable[/code] is [code]true[/code], this node will receive [constant NOTIFICATION_LOCAL_TRANSFORM_CHANGED] when its local transform changes. </description> </method> <method name="set_notify_transform"> <return type="void" /> <argument index="0" name="enable" type="bool" /> <description> - If [code]enable[/code] is [code]true[/code], children will be updated with global transform data. + If [code]enable[/code] is [code]true[/code], this node will receive [constant NOTIFICATION_TRANSFORM_CHANGED] when its global transform changes. </description> </method> <method name="show"> @@ -513,7 +524,10 @@ </signals> <constants> <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000"> - The [CanvasItem]'s transform has changed. This notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform]. + The [CanvasItem]'s global transform has changed. This notification is only received if enabled by [method set_notify_transform]. + </constant> + <constant name="NOTIFICATION_LOCAL_TRANSFORM_CHANGED" value="35"> + The [CanvasItem]'s local transform has changed. This notification is only received if enabled by [method set_notify_local_transform]. </constant> <constant name="NOTIFICATION_DRAW" value="30"> The [CanvasItem] is requested to draw. diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 4ba15d7afc..f357cb05b5 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -191,6 +191,12 @@ See also [method draw_multiline_string]. </description> </method> + <method name="get_rids" qualifiers="const"> + <return type="Array" /> + <description> + Returns [Array] of valid [FontData] [RID]s, which can be passsed to the [TextServer] methods. + </description> + </method> <method name="get_spacing" qualifiers="const"> <return type="int" /> <argument index="0" name="spacing" type="int" enum="TextServer.SpacingType" /> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 2cbcfb8d9b..64a914bb31 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -58,7 +58,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action's deadzone. In most cases, you should use [method get_action_strength] instead. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="get_action_strength" qualifiers="const"> @@ -67,7 +67,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis as the keyboard, the value returned will be 0 or 1. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="get_axis" qualifiers="const"> @@ -186,7 +186,7 @@ <description> Returns [code]true[/code] when the user starts pressing the action event, meaning it's [code]true[/code] only on the frame that the user pressed down the button. This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. [b]Note:[/b] Due to keyboard ghosting, [method is_action_just_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. </description> </method> @@ -196,7 +196,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] when the user stops pressing the action event, meaning it's [code]true[/code] only on the frame that the user released the button. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="is_action_pressed" qualifiers="const"> @@ -205,7 +205,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] if you are pressing the action event. Note that if an action has multiple buttons assigned and more than one of them is pressed, releasing one button will release the action, even if some other button assigned to this action is still pressed. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. [b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. </description> </method> diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml index cbed163f18..230ad04b33 100644 --- a/doc/classes/InputEvent.xml +++ b/doc/classes/InputEvent.xml @@ -33,7 +33,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type [InputEventJoypadMotion]. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="is_action" qualifiers="const"> @@ -42,7 +42,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] if this input event matches a pre-defined action of any type. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="is_action_pressed" qualifiers="const"> @@ -52,7 +52,7 @@ <argument index="2" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] if the given action is being pressed (and is not an echo event for [InputEventKey] events, unless [code]allow_echo[/code] is [code]true[/code]). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag]. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. [b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. </description> </method> @@ -62,7 +62,7 @@ <argument index="1" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] if the given action is released (i.e. not pressed). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag]. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="is_action_type" qualifiers="const"> @@ -83,7 +83,7 @@ <argument index="1" name="exact_match" type="bool" default="true" /> <description> Returns [code]true[/code] if the specified [code]event[/code] matches this event. Only valid for action events i.e key ([InputEventKey]), button ([InputEventMouseButton] or [InputEventJoypadButton]), axis [InputEventJoypadMotion] or action ([InputEventAction]) events. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="is_pressed" qualifiers="const"> diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml index ac5921404c..61d54e85f8 100644 --- a/doc/classes/InputMap.xml +++ b/doc/classes/InputMap.xml @@ -86,7 +86,7 @@ <argument index="2" name="exact_match" type="bool" default="false" /> <description> Returns [code]true[/code] if the given event is part of an existing action. This method ignores keyboard modifiers if the given [InputEvent] is not pressed (for proper release detection). See [method action_has_event] if you don't want this behavior. - If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + If [code]exact_match[/code] is [code]false[/code], it ignores additional input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. </description> </method> <method name="get_actions"> diff --git a/doc/classes/MultiplayerPeerExtension.xml b/doc/classes/MultiplayerPeerExtension.xml index c5fe04cb32..bd11c76039 100644 --- a/doc/classes/MultiplayerPeerExtension.xml +++ b/doc/classes/MultiplayerPeerExtension.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="MultiplayerPeerExtension" inherits="MultiplayerPeer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Class that can be inherited to implement custom multiplayer API networking layers via GDExtension. </brief_description> <description> + This class is designed to be inherited from a GDExtension plugin to implement custom networking layers for the multiplayer API (such as WebRTC). All the methods below [b]must[/b] be implemented to have a working custom multiplayer implementation. See also [MultiplayerAPI]. </description> <tutorials> </tutorials> @@ -10,16 +12,19 @@ <method name="_get_available_packet_count" qualifiers="virtual const"> <return type="int" /> <description> + Called when the available packet count is internally requested by the [MultiplayerAPI]. </description> </method> <method name="_get_connection_status" qualifiers="virtual const"> <return type="int" /> <description> + Called when the connection status is requested on the [MultiplayerPeer] (see [method MultiplayerPeer.get_connection_status]). </description> </method> <method name="_get_max_packet_size" qualifiers="virtual const"> <return type="int" /> <description> + Called when the maximum allowed packet size (in bytes) is requested by the [MultiplayerAPI]. </description> </method> <method name="_get_packet" qualifiers="virtual"> @@ -27,41 +32,49 @@ <argument index="0" name="r_buffer" type="const uint8_t **" /> <argument index="1" name="r_buffer_size" type="int32_t*" /> <description> + Called when a packet needs to be received by the [MultiplayerAPI], with [code]p_buffer_size[/code] being the size of the binary [code]p_buffer[/code] in bytes. </description> </method> <method name="_get_packet_peer" qualifiers="virtual const"> <return type="int" /> <description> + Called when the ID of the [MultiplayerPeer] who sent the most recent packet is requested (see [method MultiplayerPeer.get_packet_peer]). </description> </method> <method name="_get_transfer_channel" qualifiers="virtual const"> <return type="int" /> <description> + Called when the transfer channel to use is read on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_channel]). </description> </method> <method name="_get_transfer_mode" qualifiers="virtual const"> <return type="int" /> <description> + Called when the transfer mode to use is read on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_mode]). </description> </method> <method name="_get_unique_id" qualifiers="virtual const"> <return type="int" /> <description> + Called when the unique ID of this [MultiplayerPeer] is requested (see [method MultiplayerPeer.get_unique_id]). </description> </method> <method name="_is_refusing_new_connections" qualifiers="virtual const"> <return type="bool" /> <description> + Called when the "refuse new connections" status is requested on this [MultiplayerPeer] (see [member MultiplayerPeer.refuse_new_connections]). </description> </method> <method name="_is_server" qualifiers="virtual const"> <return type="bool" /> <description> + Called when the "is server" status is requested on the [MultiplayerAPI]. See [method MultiplayerAPI.is_server]. </description> </method> <method name="_poll" qualifiers="virtual"> <return type="int" /> <description> + Called when the [MultiplayerAPI] is polled. See [method MultiplayerAPI.poll]. </description> </method> <method name="_put_packet" qualifiers="virtual"> @@ -69,30 +82,35 @@ <argument index="0" name="p_buffer" type="const uint8_t*" /> <argument index="1" name="p_buffer_size" type="int" /> <description> + Called when a packet needs to be sent by the [MultiplayerAPI], with [code]p_buffer_size[/code] being the size of the binary [code]p_buffer[/code] in bytes. </description> </method> <method name="_set_refuse_new_connections" qualifiers="virtual"> <return type="void" /> <argument index="0" name="p_enable" type="bool" /> <description> + Called when the "refuse new connections" status is set on this [MultiplayerPeer] (see [member MultiplayerPeer.refuse_new_connections]). </description> </method> <method name="_set_target_peer" qualifiers="virtual"> <return type="void" /> <argument index="0" name="p_peer" type="int" /> <description> + Called when the target peer to use is set for this [MultiplayerPeer] (see [method MultiplayerPeer.set_target_peer]). </description> </method> <method name="_set_transfer_channel" qualifiers="virtual"> <return type="void" /> <argument index="0" name="p_channel" type="int" /> <description> + Called when the channel to use is set for this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_channel]). </description> </method> <method name="_set_transfer_mode" qualifiers="virtual"> <return type="void" /> <argument index="0" name="p_mode" type="int" /> <description> + Called when the transfer mode is set on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_mode]). </description> </method> </methods> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 5291ecab08..28b104e276 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -133,7 +133,7 @@ [/csharp] [/codeblocks] If you need the child node to be added below a specific node in the list of children, use [method add_sibling] instead of this method. - [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=https://godot.readthedocs.io/en/latest/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=https://godot.readthedocs.io/en/latest/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. + [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. </description> </method> <method name="add_sibling"> @@ -717,6 +717,7 @@ </member> <member name="owner" type="Node" setter="set_owner" getter="get_owner"> The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using [PackedScene]), all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing. + [b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=$DOCS_URL/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=$DOCS_URL/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view. </member> <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="Node.ProcessMode" default="0"> Can be used to pause or unpause the node, or make the node paused based on the [SceneTree], or make it inherit the process mode from its parent (default). diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index a57101b62d..d09f3a2b0d 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -53,7 +53,8 @@ <method name="_init" qualifiers="virtual"> <return type="void" /> <description> - Called when the object is initialized. + Called when the object is initialized in memory. Can be defined to take in parameters, that are passed in when constructing. + [b]Note:[/b] If [method _init] is defined with required parameters, then explicit construction is the only valid means of creating an Object of the class. If any other means (such as [method PackedScene.instantiate]) is used, then initialization will fail. </description> </method> <method name="_notification" qualifiers="virtual"> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 69e6d4b74c..25e41116a2 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -6,6 +6,7 @@ <description> OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text. See also [BaseButton] which contains common properties and methods associated with this node. + [b]Note:[/b] Properties [member Button.text] and [member Button.icon] are automatically set based on the selected item. They shouldn't be changed manually. </description> <tutorials> </tutorials> diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index 7a9a0ac7c5..2e84287227 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -733,7 +733,7 @@ <return type="int" /> <argument index="0" name="process_info" type="int" enum="PhysicsServer3D.ProcessInfo" /> <description> - Returns an Info defined by the [enum ProcessInfo] input given. + Returns information about the current state of the 3D physics engine. See [enum ProcessInfo] for a list of available states. </description> </method> <method name="heightmap_shape_create"> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index d5e134fc60..e805d3469c 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -256,6 +256,13 @@ Adds a [code][font_size][/code] tag to the tag stack. Overrides default font size for its duration. </description> </method> + <method name="push_hint"> + <return type="void" /> + <argument index="0" name="description" type="String" /> + <description> + Adds a [code][hint][/code] tag to the tag stack. Same as BBCode [code][hint=something]{text}[/hint][/code]. + </description> + </method> <method name="push_indent"> <return type="void" /> <argument index="0" name="level" type="int" /> @@ -424,6 +431,9 @@ If [code]true[/code], the label's height will be automatically updated to fit its content. [b]Note:[/b] This property is used as a workaround to fix issues with [RichTextLabel] in [Container]s, but it's unreliable in some cases and will be removed in future versions. </member> + <member name="hint_underlined" type="bool" setter="set_hint_underline" getter="is_hint_underlined" default="true"> + If [code]true[/code], the label underlines hint tags such as [code][hint=description]{text}[/hint][/code]. + </member> <member name="language" type="String" setter="set_language" getter="get_language" default=""""> Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. </member> @@ -563,9 +573,11 @@ </constant> <constant name="ITEM_META" value="23" enum="ItemType"> </constant> - <constant name="ITEM_DROPCAP" value="24" enum="ItemType"> + <constant name="ITEM_HINT" value="24" enum="ItemType"> + </constant> + <constant name="ITEM_DROPCAP" value="25" enum="ItemType"> </constant> - <constant name="ITEM_CUSTOMFX" value="25" enum="ItemType"> + <constant name="ITEM_CUSTOMFX" value="26" enum="ItemType"> </constant> <constant name="VC_CHARS_BEFORE_SHAPING" value="0" enum="VisibleCharactersBehavior"> Trims text before the shaping. e.g, increasing [member visible_characters] value is visually identical to typing the text. diff --git a/doc/classes/String.xml b/doc/classes/String.xml index ea0bd2adb1..9a6155c8a8 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -514,12 +514,30 @@ [/codeblock] </description> </method> + <method name="num_int64" qualifiers="static"> + <return type="String" /> + <argument index="0" name="number" type="int" /> + <argument index="1" name="base" type="int" default="10" /> + <argument index="2" name="capitalize_hex" type="bool" default="false" /> + <description> + Converts a signed [int] to a string representation of a number. + </description> + </method> <method name="num_scientific" qualifiers="static"> <return type="String" /> <argument index="0" name="number" type="float" /> <description> </description> </method> + <method name="num_uint64" qualifiers="static"> + <return type="String" /> + <argument index="0" name="number" type="int" /> + <argument index="1" name="base" type="int" default="10" /> + <argument index="2" name="capitalize_hex" type="bool" default="false" /> + <description> + Converts a unsigned [int] to a string representation of a number. + </description> + </method> <method name="pad_decimals" qualifiers="const"> <return type="String" /> <argument index="0" name="digits" type="int" /> @@ -887,6 +905,12 @@ <description> </description> </operator> + <operator name="operator +"> + <return type="String" /> + <argument index="0" name="right" type="int" /> + <description> + </description> + </operator> <operator name="operator <"> <return type="bool" /> <argument index="0" name="right" type="String" /> diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index 020c30b9cd..b4339bef11 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -57,7 +57,7 @@ <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <description> - Removes all font sizes from the cache entry + Removes all font sizes from the cache entry. </description> </method> <method name="font_clear_textures"> @@ -509,7 +509,7 @@ <argument index="1" name="size" type="Vector2i" /> <argument index="2" name="index" type="int" /> <description> - Renders specified glyph the the font cache texture. + Renders specified glyph to the font cache texture. </description> </method> <method name="font_render_range"> @@ -1112,7 +1112,7 @@ <return type="Array" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns text glyphs in the visual order. + Returns an array of glyphs in the visual order. </description> </method> <method name="shaped_text_get_grapheme_bounds" qualifiers="const"> @@ -1177,7 +1177,7 @@ <return type="RID" /> <argument index="0" name="shaped" type="RID" /> <description> - Sets text orientation. + Returns the parent buffer from which the substring originates. </description> </method> <method name="shaped_text_get_preserve_control" qualifiers="const"> @@ -1222,7 +1222,7 @@ <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns position of the trim. + Returns the position of the overrun trim. </description> </method> <method name="shaped_text_get_underline_position" qualifiers="const"> @@ -1420,6 +1420,7 @@ <argument index="0" name="string" type="String" /> <description> Strips diacritics from the string. + [b]Note:[/b] The result may be longer or shorter than the original. </description> </method> <method name="tag_to_name" qualifiers="const"> @@ -1544,8 +1545,8 @@ </constant> <constant name="SUBPIXEL_POSITIONING_AUTO" value="1" enum="SubpixelPositioning"> Glyph horizontal position is rounded based on font size. - - To one quarter of the pixel size if font size is smaller or equal to [code]16[/code]. - - To one half of the pixel size if font size is smaller or equal to [code]20[/code]. + - To one quarter of the pixel size if font size is smaller or equal to [constant SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE]. + - To one half of the pixel size if font size is smaller or equal to [constant SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE]. - To the whole pixel size for larger fonts. </constant> <constant name="SUBPIXEL_POSITIONING_ONE_HALF" value="2" enum="SubpixelPositioning"> @@ -1554,31 +1555,49 @@ <constant name="SUBPIXEL_POSITIONING_ONE_QUARTER" value="3" enum="SubpixelPositioning"> Glyph horizontal position is rounded to one quarter of the pixel size, each glyph is rasterized up to four times. </constant> - <constant name="FEATURE_BIDI_LAYOUT" value="1" enum="Feature"> - TextServer supports bidirectional layouts. + <constant name="SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE" value="20" enum="SubpixelPositioning"> + Maximum font size which will use one half of the pixel subpixel positioning in [constants SUBPIXEL_POSITIONING_AUTO] mode. + </constant> + <constant name="SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE" value="16" enum="SubpixelPositioning"> + Maximum font size which will use one quarter of the pixel subpixel positioning in [constants SUBPIXEL_POSITIONING_AUTO] mode. + </constant> + <constant name="FEATURE_SIMPLE_LAYOUT" value="1" enum="Feature"> + TextServer supports simple text layouts. + </constant> + <constant name="FEATURE_BIDI_LAYOUT" value="2" enum="Feature"> + TextServer supports bidirectional text layouts. </constant> - <constant name="FEATURE_VERTICAL_LAYOUT" value="2" enum="Feature"> + <constant name="FEATURE_VERTICAL_LAYOUT" value="4" enum="Feature"> TextServer supports vertical layouts. </constant> - <constant name="FEATURE_SHAPING" value="4" enum="Feature"> + <constant name="FEATURE_SHAPING" value="8" enum="Feature"> TextServer supports complex text shaping. </constant> - <constant name="FEATURE_KASHIDA_JUSTIFICATION" value="8" enum="Feature"> + <constant name="FEATURE_KASHIDA_JUSTIFICATION" value="16" enum="Feature"> TextServer supports justification using kashidas. </constant> - <constant name="FEATURE_BREAK_ITERATORS" value="16" enum="Feature"> + <constant name="FEATURE_BREAK_ITERATORS" value="32" enum="Feature"> TextServer supports complex line/word breaking rules (e.g. dictionary based). </constant> - <constant name="FEATURE_FONT_SYSTEM" value="32" enum="Feature"> + <constant name="FEATURE_FONT_BITMAP" value="64" enum="Feature"> + TextServer supports loading bitmap fonts. + </constant> + <constant name="FEATURE_FONT_DYNAMIC" value="128" enum="Feature"> + TextServer supports loading dynamic (TrueType, OpeType, etc.) fonts. + </constant> + <constant name="FEATURE_FONT_MSDF" value="256" enum="Feature"> + TextServer supports multichannel signed distance field dynamic font rendering. + </constant> + <constant name="FEATURE_FONT_SYSTEM" value="512" enum="Feature"> TextServer supports loading system fonts. </constant> - <constant name="FEATURE_FONT_VARIABLE" value="64" enum="Feature"> + <constant name="FEATURE_FONT_VARIABLE" value="1024" enum="Feature"> TextServer supports variable fonts. </constant> - <constant name="FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION" value="128" enum="Feature"> + <constant name="FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION" value="2048" enum="Feature"> TextServer supports locale dependent and context sensitive case conversion. </constant> - <constant name="FEATURE_USE_SUPPORT_DATA" value="256" enum="Feature"> + <constant name="FEATURE_USE_SUPPORT_DATA" value="4096" enum="Feature"> TextServer require external data file for some features. </constant> <constant name="CONTOUR_CURVE_TAG_ON" value="1" enum="ContourPointTag"> diff --git a/doc/classes/TextServerDummy.xml b/doc/classes/TextServerDummy.xml new file mode 100644 index 0000000000..b872e93fd6 --- /dev/null +++ b/doc/classes/TextServerDummy.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TextServerDummy" inherits="TextServerExtension" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> +</class> diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index 5ffd80bf63..25647e2668 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -9,23 +9,21 @@ <tutorials> </tutorials> <methods> - <method name="_create_font" qualifiers="virtual"> + <method name="create_font" qualifiers="virtual"> <return type="RID" /> <description> - Creates new, empty font cache entry resource. To free the resulting resourec, use [method _free] method. + Creates new, empty font cache entry resource. To free the resulting resourec, use [method free_rid] method. </description> </method> - <method name="_create_shaped_text" qualifiers="virtual"> + <method name="create_shaped_text" qualifiers="virtual"> <return type="RID" /> <argument index="0" name="direction" type="int" enum="TextServer.Direction" /> <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" /> <description> - Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method _free] method. - [b]Note:[/b] Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature. - [b]Note:[/b] Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature. + Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method free_rid] method. </description> </method> - <method name="_draw_hex_code_box" qualifiers="virtual const"> + <method name="draw_hex_code_box" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="canvas" type="RID" /> <argument index="1" name="size" type="int" /> @@ -34,18 +32,18 @@ <argument index="4" name="color" type="Color" /> <description> Draws box displaying character hexadecimal code. Used for replacing missing characters. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_font_clear_glyphs" qualifiers="virtual"> + <method name="font_clear_glyphs" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> <description> Removes all rendered glyphs information from the cache entry. - [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method _font_remove_texture] to remove them manually. </description> </method> - <method name="_font_clear_kerning_map" qualifiers="virtual"> + <method name="font_clear_kerning_map" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -53,23 +51,22 @@ Removes all kerning overrides. </description> </method> - <method name="_font_clear_size_cache" qualifiers="virtual"> + <method name="font_clear_size_cache" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <description> - Removes all font sizes from the cache entry + Removes all font sizes from the cache entry. </description> </method> - <method name="_font_clear_textures" qualifiers="virtual"> + <method name="font_clear_textures" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> <description> Removes all textures from font cache entry. - [b]Note:[/b] This function will not remove glyphs associated with the texture, use [method _font_remove_glyph] to remove them manually. </description> </method> - <method name="_font_draw_glyph" qualifiers="virtual const"> + <method name="font_draw_glyph" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="canvas" type="RID" /> @@ -79,10 +76,9 @@ <argument index="5" name="color" type="Color" /> <description> Draws single glyph into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code]. - [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method _shaped_text_get_glyphs] or [method _font_get_glyph_index]. </description> </method> - <method name="_font_draw_glyph_outline" qualifiers="virtual const"> + <method name="font_draw_glyph_outline" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="canvas" type="RID" /> @@ -93,10 +89,9 @@ <argument index="6" name="color" type="Color" /> <description> Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code]. - [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method _shaped_text_get_glyphs] or [method _font_get_glyph_index]. </description> </method> - <method name="_font_get_ascent" qualifiers="virtual const"> + <method name="font_get_ascent" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -104,7 +99,7 @@ Returns the font ascent (number of pixels above the baseline). </description> </method> - <method name="_font_get_descent" qualifiers="virtual const"> + <method name="font_get_descent" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -112,37 +107,36 @@ Returns the font descent (number of pixels below the baseline). </description> </method> - <method name="_font_get_embolden" qualifiers="virtual const"> + <method name="font_get_embolden" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font embolden strength. </description> </method> - <method name="_font_get_fixed_size" qualifiers="virtual const"> + <method name="font_get_fixed_size" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns bitmap font fixed size. </description> </method> - <method name="_font_get_global_oversampling" qualifiers="virtual const"> + <method name="font_get_global_oversampling" qualifiers="virtual const"> <return type="float" /> <description> Returns the font oversampling factor, shared by all fonts in the TextServer. </description> </method> - <method name="_font_get_glyph_advance" qualifiers="virtual const"> + <method name="font_get_glyph_advance" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> <argument index="2" name="glyph" type="int" /> <description> Returns glyph advance (offset of the next glyph). - [b]Note:[/b] Advance for glyphs outlines is the same as the base glyph advance and is not saved. </description> </method> - <method name="_font_get_glyph_contours" qualifiers="virtual const"> + <method name="font_get_glyph_contours" qualifiers="virtual const"> <return type="Dictionary" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -154,7 +148,7 @@ [code]orientation[/code] - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled. </description> </method> - <method name="_font_get_glyph_index" qualifiers="virtual const"> + <method name="font_get_glyph_index" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -164,7 +158,7 @@ Returns the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code]. </description> </method> - <method name="_font_get_glyph_list" qualifiers="virtual const"> + <method name="font_get_glyph_list" qualifiers="virtual const"> <return type="Array" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -172,7 +166,7 @@ Returns list of rendered glyphs in the cache entry. </description> </method> - <method name="_font_get_glyph_offset" qualifiers="virtual const"> + <method name="font_get_glyph_offset" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -181,7 +175,7 @@ Returns glyph offset from the baseline. </description> </method> - <method name="_font_get_glyph_size" qualifiers="virtual const"> + <method name="font_get_glyph_size" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -190,7 +184,7 @@ Returns size of the glyph. </description> </method> - <method name="_font_get_glyph_texture_idx" qualifiers="virtual const"> + <method name="font_get_glyph_texture_idx" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -199,7 +193,7 @@ Returns index of the cache texture containing the glyph. </description> </method> - <method name="_font_get_glyph_uv_rect" qualifiers="virtual const"> + <method name="font_get_glyph_uv_rect" qualifiers="virtual const"> <return type="Rect2" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -208,14 +202,14 @@ Returns rectangle in the cache texture containing the glyph. </description> </method> - <method name="_font_get_hinting" qualifiers="virtual const"> + <method name="font_get_hinting" qualifiers="virtual const"> <return type="int" enum="TextServer.Hinting" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns the font hinting mode. Used by dynamic fonts only. </description> </method> - <method name="_font_get_kerning" qualifiers="virtual const"> + <method name="font_get_kerning" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -224,7 +218,7 @@ Returns kerning for the pair of glyphs. </description> </method> - <method name="_font_get_kerning_list" qualifiers="virtual const"> + <method name="font_get_kerning_list" qualifiers="virtual const"> <return type="Array" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -232,7 +226,7 @@ Returns list of the kerning overrides. </description> </method> - <method name="_font_get_language_support_override" qualifiers="virtual"> + <method name="font_get_language_support_override" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="language" type="String" /> @@ -240,49 +234,49 @@ Returns [code]true[/code] if support override is enabled for the [code]language[/code]. </description> </method> - <method name="_font_get_language_support_overrides" qualifiers="virtual"> + <method name="font_get_language_support_overrides" qualifiers="virtual"> <return type="PackedStringArray" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns list of language support overrides. </description> </method> - <method name="_font_get_msdf_pixel_range" qualifiers="virtual const"> + <method name="font_get_msdf_pixel_range" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <description> - Return the width of the range around the shape between the minimum and maximum representable signed distance. + Returns the width of the range around the shape between the minimum and maximum representable signed distance. </description> </method> - <method name="_font_get_msdf_size" qualifiers="virtual const"> + <method name="font_get_msdf_size" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns source font size used to generate MSDF textures. </description> </method> - <method name="_font_get_name" qualifiers="virtual const"> + <method name="font_get_name" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font family name. </description> </method> - <method name="_font_get_opentype_feature_overrides" qualifiers="virtual const"> + <method name="font_get_opentype_feature_overrides" qualifiers="virtual const"> <return type="Dictionary" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font OpenType feature set override. </description> </method> - <method name="_font_get_oversampling" qualifiers="virtual const"> + <method name="font_get_oversampling" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only. </description> </method> - <method name="_font_get_scale" qualifiers="virtual const"> + <method name="font_get_scale" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -290,7 +284,7 @@ Returns scaling factor of the color bitmap font. </description> </method> - <method name="_font_get_script_support_override" qualifiers="virtual"> + <method name="font_get_script_support_override" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="script" type="String" /> @@ -298,21 +292,21 @@ Returns [code]true[/code] if support override is enabled for the [code]script[/code]. </description> </method> - <method name="_font_get_script_support_overrides" qualifiers="virtual"> + <method name="font_get_script_support_overrides" qualifiers="virtual"> <return type="PackedStringArray" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns list of script support overrides. </description> </method> - <method name="_font_get_size_cache_list" qualifiers="virtual const"> + <method name="font_get_size_cache_list" qualifiers="virtual const"> <return type="Array" /> <argument index="0" name="font_rid" type="RID" /> <description> - Return list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size. + Returns list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size. </description> </method> - <method name="_font_get_spacing" qualifiers="virtual const"> + <method name="font_get_spacing" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -321,35 +315,35 @@ Returns extra spacing added between glyphs in pixels. </description> </method> - <method name="_font_get_style" qualifiers="virtual const"> + <method name="font_get_style" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font style flags, see [enum TextServer.FontStyle]. </description> </method> - <method name="_font_get_style_name" qualifiers="virtual const"> + <method name="font_get_style_name" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font style name. </description> </method> - <method name="_font_get_subpixel_positioning" qualifiers="virtual const"> + <method name="font_get_subpixel_positioning" qualifiers="virtual const"> <return type="int" enum="TextServer.SubpixelPositioning" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns font sub-pixel glyph positioning mode. </description> </method> - <method name="_font_get_supported_chars" qualifiers="virtual const"> + <method name="font_get_supported_chars" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns a string containing all the characters available in the font. </description> </method> - <method name="_font_get_texture_count" qualifiers="virtual const"> + <method name="font_get_texture_count" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -357,7 +351,7 @@ Returns number of textures used by font cache entry. </description> </method> - <method name="_font_get_texture_image" qualifiers="virtual const"> + <method name="font_get_texture_image" qualifiers="virtual const"> <return type="Image" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -366,7 +360,7 @@ Returns font cache texture image data. </description> </method> - <method name="_font_get_texture_offsets" qualifiers="virtual const"> + <method name="font_get_texture_offsets" qualifiers="virtual const"> <return type="PackedInt32Array" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -375,14 +369,14 @@ Returns array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty. </description> </method> - <method name="_font_get_transform" qualifiers="virtual const"> + <method name="font_get_transform" qualifiers="virtual const"> <return type="Transform2D" /> <argument index="0" name="font_rid" type="RID" /> <description> Retruns 2D transform applied to the font outlines. </description> </method> - <method name="_font_get_underline_position" qualifiers="virtual const"> + <method name="font_get_underline_position" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -390,7 +384,7 @@ Returns pixel offset of the underline below the baseline. </description> </method> - <method name="_font_get_underline_thickness" qualifiers="virtual const"> + <method name="font_get_underline_thickness" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -398,36 +392,36 @@ Returns thickness of the underline in pixels. </description> </method> - <method name="_font_get_variation_coordinates" qualifiers="virtual const"> + <method name="font_get_variation_coordinates" qualifiers="virtual const"> <return type="Dictionary" /> <argument index="0" name="font_rid" type="RID" /> <description> - Returns variation coordinates for the specified font cache entry. See [method _font_supported_variation_list] for more info. + Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> - <method name="_font_has_char" qualifiers="virtual const"> + <method name="font_has_char" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="char" type="int" /> <description> - Return [code]true[/code] if a Unicode [code]char[/code] is available in the font. + Returns [code]true[/code] if a Unicode [code]char[/code] is available in the font. </description> </method> - <method name="_font_is_antialiased" qualifiers="virtual const"> + <method name="font_is_antialiased" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled. </description> </method> - <method name="_font_is_force_autohinter" qualifiers="virtual const"> + <method name="font_is_force_autohinter" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns [code]true[/code] if auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only. </description> </method> - <method name="_font_is_language_supported" qualifiers="virtual const"> + <method name="font_is_language_supported" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="language" type="String" /> @@ -435,14 +429,14 @@ Returns [code]true[/code], if font supports given language ([url=https://en.wikipedia.org/wiki/ISO_639-1]ISO 639[/url] code). </description> </method> - <method name="_font_is_multichannel_signed_distance_field" qualifiers="virtual const"> + <method name="font_is_multichannel_signed_distance_field" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns [code]true[/code] if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. </description> </method> - <method name="_font_is_script_supported" qualifiers="virtual const"> + <method name="font_is_script_supported" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="script" type="String" /> @@ -450,17 +444,16 @@ Returns [code]true[/code], if font supports given script (ISO 15924 code). </description> </method> - <method name="_font_remove_glyph" qualifiers="virtual"> + <method name="font_remove_glyph" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> <argument index="2" name="glyph" type="int" /> <description> Removes specified rendered glyph information from the cache entry. - [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method _font_remove_texture] to remove them manually. </description> </method> - <method name="_font_remove_kerning" qualifiers="virtual"> + <method name="font_remove_kerning" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -469,7 +462,7 @@ Removes kerning override for the pair of glyphs. </description> </method> - <method name="_font_remove_language_support_override" qualifiers="virtual"> + <method name="font_remove_language_support_override" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="language" type="String" /> @@ -477,7 +470,7 @@ Remove language support override. </description> </method> - <method name="_font_remove_script_support_override" qualifiers="virtual"> + <method name="font_remove_script_support_override" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="script" type="String" /> @@ -485,7 +478,7 @@ Removes script support override. </description> </method> - <method name="_font_remove_size_cache" qualifiers="virtual"> + <method name="font_remove_size_cache" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -493,26 +486,25 @@ Removes specified font size from the cache entry. </description> </method> - <method name="_font_remove_texture" qualifiers="virtual"> + <method name="font_remove_texture" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> <argument index="2" name="texture_index" type="int" /> <description> Removes specified texture from font cache entry. - [b]Note:[/b] This function will not remove glyphs associated with the texture, remove them manually, using [method _font_remove_glyph]. </description> </method> - <method name="_font_render_glyph" qualifiers="virtual"> + <method name="font_render_glyph" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> <argument index="2" name="index" type="int" /> <description> - Renders specified glyph the the font cache texture. + Renders specified glyph to the font cache texture. </description> </method> - <method name="_font_render_range" qualifiers="virtual"> + <method name="font_render_range" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -522,7 +514,7 @@ Renders the range of characters to the font cache texture. </description> </method> - <method name="_font_set_antialiased" qualifiers="virtual"> + <method name="font_set_antialiased" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="antialiased" type="bool" /> @@ -530,7 +522,7 @@ If set to [code]true[/code], 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only. </description> </method> - <method name="_font_set_ascent" qualifiers="virtual"> + <method name="font_set_ascent" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -539,7 +531,7 @@ Sets the font ascent (number of pixels above the baseline). </description> </method> - <method name="_font_set_data" qualifiers="virtual"> + <method name="font_set_data" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="data" type="PackedByteArray" /> @@ -547,25 +539,25 @@ Sets font source data, e.g contents of the dynamic font source file. </description> </method> - <method name="_font_set_data_ptr" qualifiers="virtual"> + <method name="font_set_data_ptr" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="data_ptr" type="const uint8_t*" /> <argument index="2" name="data_size" type="int" /> <description> - Sets the font descent (number of pixels below the baseline). + Sets font source data, e.g contents of the dynamic font source file. [code]data_ptr[/code] memory buffer must remain accessible during font lifetime. </description> </method> - <method name="_font_set_descent" qualifiers="virtual"> + <method name="font_set_descent" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> <argument index="2" name="descent" type="float" /> <description> - Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes. + Sets the font descent (number of pixels below the baseline). </description> </method> - <method name="_font_set_embolden" qualifiers="virtual"> + <method name="font_set_embolden" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="strength" type="float" /> @@ -573,15 +565,15 @@ Sets font embolden strength. If [code]strength[/code] is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness. </description> </method> - <method name="_font_set_fixed_size" qualifiers="virtual"> + <method name="font_set_fixed_size" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="fixed_size" type="int" /> <description> - If set to [code]true[/code] auto-hinting is preferred over font built-in hinting. + Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes. </description> </method> - <method name="_font_set_force_autohinter" qualifiers="virtual"> + <method name="font_set_force_autohinter" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="force_autohinter" type="bool" /> @@ -589,7 +581,7 @@ If set to [code]true[/code] auto-hinting is preferred over font built-in hinting. </description> </method> - <method name="_font_set_global_oversampling" qualifiers="virtual"> + <method name="font_set_global_oversampling" qualifiers="virtual"> <return type="void" /> <argument index="0" name="oversampling" type="float" /> <description> @@ -597,7 +589,7 @@ [b]Note:[/b] This value can be automatically changed by display server. </description> </method> - <method name="_font_set_glyph_advance" qualifiers="virtual"> + <method name="font_set_glyph_advance" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -605,10 +597,9 @@ <argument index="3" name="advance" type="Vector2" /> <description> Sets glyph advance (offset of the next glyph). - [b]Note:[/b] Advance for glyphs outlines is the same as the base glyph advance and is not saved. </description> </method> - <method name="_font_set_glyph_offset" qualifiers="virtual"> + <method name="font_set_glyph_offset" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -618,7 +609,7 @@ Sets glyph offset from the baseline. </description> </method> - <method name="_font_set_glyph_size" qualifiers="virtual"> + <method name="font_set_glyph_size" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -628,7 +619,7 @@ Sets size of the glyph. </description> </method> - <method name="_font_set_glyph_texture_idx" qualifiers="virtual"> + <method name="font_set_glyph_texture_idx" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -638,7 +629,7 @@ Sets index of the cache texture containing the glyph. </description> </method> - <method name="_font_set_glyph_uv_rect" qualifiers="virtual"> + <method name="font_set_glyph_uv_rect" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -648,7 +639,7 @@ Sets rectangle in the cache texture containing the glyph. </description> </method> - <method name="_font_set_hinting" qualifiers="virtual"> + <method name="font_set_hinting" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="hinting" type="int" enum="TextServer.Hinting" /> @@ -656,7 +647,7 @@ Sets font hinting mode. Used by dynamic fonts only. </description> </method> - <method name="_font_set_kerning" qualifiers="virtual"> + <method name="font_set_kerning" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -666,16 +657,16 @@ Sets kerning for the pair of glyphs. </description> </method> - <method name="_font_set_language_support_override" qualifiers="virtual"> + <method name="font_set_language_support_override" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="language" type="String" /> <argument index="2" name="supported" type="bool" /> <description> - Adds override for [method _font_is_language_supported]. + Adds override for [method font_is_language_supported]. </description> </method> - <method name="_font_set_msdf_pixel_range" qualifiers="virtual"> + <method name="font_set_msdf_pixel_range" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="msdf_pixel_range" type="int" /> @@ -683,7 +674,7 @@ Sets the width of the range around the shape between the minimum and maximum representable signed distance. </description> </method> - <method name="_font_set_msdf_size" qualifiers="virtual"> + <method name="font_set_msdf_size" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="msdf_size" type="int" /> @@ -691,15 +682,16 @@ Sets source font size used to generate MSDF textures. </description> </method> - <method name="_font_set_multichannel_signed_distance_field" qualifiers="virtual"> + <method name="font_set_multichannel_signed_distance_field" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="msdf" type="bool" /> <description> - If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. + If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. MSDF rendering allows displaying the font at any scaling factor without blurriness, and without incurring a CPU cost when the font size changes (since the font no longer needs to be rasterized on the CPU). As a downside, font hinting is not available with MSDF. The lack of font hinting may result in less crisp and less readable fonts at small sizes. + [b]Note:[/b] MSDF font rendering does not render glyphs with overlapping shapes correctly. Overlapping shapes are not valid per the OpenType standard, but are still commonly found in many font files, especially those converted by Google Fonts. To avoid issues with overlapping glyphs, consider downloading the font file directly from the type foundry instead of relying on Google Fonts. </description> </method> - <method name="_font_set_name" qualifiers="virtual"> + <method name="font_set_name" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="name" type="String" /> @@ -707,7 +699,7 @@ Sets the font family name. </description> </method> - <method name="_font_set_opentype_feature_overrides" qualifiers="virtual"> + <method name="font_set_opentype_feature_overrides" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="overrides" type="Dictionary" /> @@ -715,7 +707,7 @@ Sets font OpenType feature set override. </description> </method> - <method name="_font_set_oversampling" qualifiers="virtual"> + <method name="font_set_oversampling" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="oversampling" type="float" /> @@ -723,7 +715,7 @@ Sets font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only. </description> </method> - <method name="_font_set_scale" qualifiers="virtual"> + <method name="font_set_scale" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -732,16 +724,16 @@ Sets scaling factor of the color bitmap font. </description> </method> - <method name="_font_set_script_support_override" qualifiers="virtual"> + <method name="font_set_script_support_override" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="script" type="String" /> <argument index="2" name="supported" type="bool" /> <description> - Adds override for [method _font_is_script_supported]. + Adds override for [method font_is_script_supported]. </description> </method> - <method name="_font_set_spacing" qualifiers="virtual"> + <method name="font_set_spacing" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -751,7 +743,7 @@ Sets extra spacing added between glyphs in pixels. </description> </method> - <method name="_font_set_style" qualifiers="virtual"> + <method name="font_set_style" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="style" type="int" /> @@ -759,7 +751,7 @@ Sets the font style flags, see [enum TextServer.FontStyle]. </description> </method> - <method name="_font_set_style_name" qualifiers="virtual"> + <method name="font_set_style_name" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="name_style" type="String" /> @@ -767,7 +759,7 @@ Sets the font style name. </description> </method> - <method name="_font_set_subpixel_positioning" qualifiers="virtual"> + <method name="font_set_subpixel_positioning" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="subpixel_positioning" type="int" enum="TextServer.SubpixelPositioning" /> @@ -775,7 +767,7 @@ Sets font sub-pixel glyph positioning mode. </description> </method> - <method name="_font_set_texture_image" qualifiers="virtual"> + <method name="font_set_texture_image" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -785,7 +777,7 @@ Sets font cache texture image data. </description> </method> - <method name="_font_set_texture_offsets" qualifiers="virtual"> + <method name="font_set_texture_offsets" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="Vector2i" /> @@ -795,7 +787,7 @@ Sets array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty. </description> </method> - <method name="_font_set_transform" qualifiers="virtual"> + <method name="font_set_transform" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="transform" type="Transform2D" /> @@ -804,7 +796,7 @@ For example, to simulate italic typeface by slanting, apply the following transform [code]Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)[/code]. </description> </method> - <method name="_font_set_underline_position" qualifiers="virtual"> + <method name="font_set_underline_position" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -813,7 +805,7 @@ Sets pixel offset of the underline below the baseline. </description> </method> - <method name="_font_set_underline_thickness" qualifiers="virtual"> + <method name="font_set_underline_thickness" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="size" type="int" /> @@ -822,29 +814,29 @@ Sets thickness of the underline in pixels. </description> </method> - <method name="_font_set_variation_coordinates" qualifiers="virtual"> + <method name="font_set_variation_coordinates" qualifiers="virtual"> <return type="void" /> <argument index="0" name="font_rid" type="RID" /> <argument index="1" name="variation_coordinates" type="Dictionary" /> <description> - Sets variation coordinates for the specified font cache entry. See [method _font_supported_variation_list] for more info. + Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> - <method name="_font_supported_feature_list" qualifiers="virtual const"> + <method name="font_supported_feature_list" qualifiers="virtual const"> <return type="Dictionary" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns the dictionary of the supported OpenType features. </description> </method> - <method name="_font_supported_variation_list" qualifiers="virtual const"> + <method name="font_supported_variation_list" qualifiers="virtual const"> <return type="Dictionary" /> <argument index="0" name="font_rid" type="RID" /> <description> Returns the dictionary of the supported OpenType variation coordinates. </description> </method> - <method name="_format_number" qualifiers="virtual const"> + <method name="format_number" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="string" type="String" /> <argument index="1" name="language" type="String" /> @@ -852,82 +844,82 @@ Converts a number from the Western Arabic (0..9) to the numeral systems used in [code]language[/code]. </description> </method> - <method name="_free" qualifiers="virtual"> + <method name="free_rid" qualifiers="virtual"> <return type="void" /> <argument index="0" name="rid" type="RID" /> <description> Frees an object created by this [TextServer]. </description> </method> - <method name="_get_features" qualifiers="virtual const"> + <method name="get_features" qualifiers="virtual const"> <return type="int" /> <description> Returns text server features, see [enum TextServer.Feature]. </description> </method> - <method name="_get_hex_code_box_size" qualifiers="virtual const"> + <method name="get_hex_code_box_size" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="size" type="int" /> <argument index="1" name="index" type="int" /> <description> Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters). + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_get_name" qualifiers="virtual const"> + <method name="get_name" qualifiers="virtual const"> <return type="String" /> <description> Returns the name of the server interface. </description> </method> - <method name="_get_support_data_filename" qualifiers="virtual const"> + <method name="get_support_data_filename" qualifiers="virtual const"> <return type="String" /> <description> Returns default TextServer database (e.g. ICU break iterators and dictionaries) filename. </description> </method> - <method name="_get_support_data_info" qualifiers="virtual const"> + <method name="get_support_data_info" qualifiers="virtual const"> <return type="String" /> <description> Returns TextServer database (e.g. ICU break iterators and dictionaries) description. </description> </method> - <method name="_has" qualifiers="virtual"> + <method name="has" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="rid" type="RID" /> <description> Returns [code]true[/code] if [code]rid[/code] is valid resource owned by this text server. </description> </method> - <method name="_has_feature" qualifiers="virtual const"> + <method name="has_feature" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="feature" type="int" enum="TextServer.Feature" /> <description> Returns [code]true[/code] if the server supports a feature. </description> </method> - <method name="_is_locale_right_to_left" qualifiers="virtual const"> + <method name="is_locale_right_to_left" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="locale" type="String" /> <description> Returns [code]true[/code] if locale is right-to-left. </description> </method> - <method name="_load_support_data" qualifiers="virtual"> + <method name="load_support_data" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="filename" type="String" /> <description> Loads optional TextServer database (e.g. ICU break iterators and dictionaries). - [b]Note:[/b] This function should be called before any other TextServer functions used, otherwise it won't have any effect. </description> </method> - <method name="_name_to_tag" qualifiers="virtual const"> + <method name="name_to_tag" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="name" type="String" /> <description> Converts readable feature, variation, script or language name to OpenType tag. </description> </method> - <method name="_parse_number" qualifiers="virtual const"> + <method name="parse_number" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="string" type="String" /> <argument index="1" name="language" type="String" /> @@ -935,14 +927,14 @@ Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9). </description> </method> - <method name="_percent_sign" qualifiers="virtual const"> + <method name="percent_sign" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="language" type="String" /> <description> Returns percent sign used in the [code]language[/code]. </description> </method> - <method name="_save_support_data" qualifiers="virtual const"> + <method name="save_support_data" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="filename" type="String" /> <description> @@ -950,14 +942,14 @@ [b]Note:[/b] This function is used by during project export, to include TextServer database. </description> </method> - <method name="_shaped_get_span_count" qualifiers="virtual const"> + <method name="shaped_get_span_count" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns number of text spans added using [method _shaped_text_add_string] or [method _shaped_text_add_object]. + Returns number of text spans added using [method shaped_text_add_string] or [method shaped_text_add_object]. </description> </method> - <method name="_shaped_get_span_meta" qualifiers="virtual const"> + <method name="shaped_get_span_meta" qualifiers="virtual const"> <return type="Variant" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="index" type="int" /> @@ -965,7 +957,7 @@ Returns text span metadata. </description> </method> - <method name="_shaped_set_span_update_font" qualifiers="virtual"> + <method name="shaped_set_span_update_font" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="index" type="int" /> @@ -976,7 +968,7 @@ Changes text span font, font size and OpenType features, without changing the text. </description> </method> - <method name="_shaped_text_add_object" qualifiers="virtual"> + <method name="shaped_text_add_object" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="key" type="Variant" /> @@ -987,7 +979,7 @@ Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters. </description> </method> - <method name="_shaped_text_add_string" qualifiers="virtual"> + <method name="shaped_text_add_string" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="text" type="String" /> @@ -1000,14 +992,14 @@ Adds text span and font to draw it to the text buffer. </description> </method> - <method name="_shaped_text_clear" qualifiers="virtual"> + <method name="shaped_text_clear" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <description> Clears text buffer (removes text and inline objects). </description> </method> - <method name="_shaped_text_draw" qualifiers="virtual const"> + <method name="shaped_text_draw" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="canvas" type="RID" /> @@ -1017,9 +1009,10 @@ <argument index="5" name="color" type="Color" /> <description> Draw shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_draw_outline" qualifiers="virtual const"> + <method name="shaped_text_draw_outline" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="canvas" type="RID" /> @@ -1030,116 +1023,118 @@ <argument index="6" name="color" type="Color" /> <description> Draw the outline of the shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_fit_to_width" qualifiers="virtual"> + <method name="shaped_text_fit_to_width" qualifiers="virtual"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="width" type="float" /> <argument index="2" name="jst_flags" type="int" /> <description> - Adjusts text with to fit to specified width, returns new text width + Adjusts text with to fit to specified width, returns new text width. </description> </method> - <method name="_shaped_text_get_ascent" qualifiers="virtual const"> + <method name="shaped_text_get_ascent" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <description> Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). - [b]Note:[/b] Overall ascent can be higher than font ascent, if some glyphs are displaced from the baseline. </description> </method> - <method name="_shaped_text_get_carets" qualifiers="virtual const"> + <method name="shaped_text_get_carets" qualifiers="virtual const"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="position" type="int" /> <argument index="2" name="caret" type="CaretInfo*" /> <description> Returns shapes of the carets corresponding to the character offset [code]position[/code] in the text. Returned caret shape is 1 pixel wide rectangle. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_custom_punctuation" qualifiers="virtual const"> + <method name="shaped_text_get_custom_punctuation" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="shaped" type="RID" /> <description> Returns custom punctuation character list, used for word breaking. If set to empty string, server defaults are used. </description> </method> - <method name="_shaped_text_get_descent" qualifiers="virtual const"> + <method name="shaped_text_get_descent" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <description> Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). - [b]Note:[/b] Overall descent can be higher than font descent, if some glyphs are displaced from the baseline. </description> </method> - <method name="_shaped_text_get_direction" qualifiers="virtual const"> + <method name="shaped_text_get_direction" qualifiers="virtual const"> <return type="int" enum="TextServer.Direction" /> <argument index="0" name="shaped" type="RID" /> <description> Returns direction of the text. </description> </method> - <method name="_shaped_text_get_dominant_direction_in_range" qualifiers="virtual const"> + <method name="shaped_text_get_dominant_direction_in_range" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="start" type="int" /> <argument index="2" name="end" type="int" /> <description> Returns dominant direction of in the range of text. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_ellipsis_glyph_count" qualifiers="virtual const"> + <method name="shaped_text_get_ellipsis_glyph_count" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> Returns number of glyphs in the ellipsis. </description> </method> - <method name="_shaped_text_get_ellipsis_glyphs" qualifiers="virtual const"> - <return type="Glyph*" /> + <method name="shaped_text_get_ellipsis_glyphs" qualifiers="virtual const"> + <return type="const Glyph*" /> <argument index="0" name="shaped" type="RID" /> <description> Returns array of the glyphs in the ellipsis. </description> </method> - <method name="_shaped_text_get_ellipsis_pos" qualifiers="virtual const"> + <method name="shaped_text_get_ellipsis_pos" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> Returns position of the ellipsis. </description> </method> - <method name="_shaped_text_get_glyph_count" qualifiers="virtual const"> + <method name="shaped_text_get_glyph_count" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns text glyphs count. + Returns number of glyphs in the buffer. </description> </method> - <method name="_shaped_text_get_glyphs" qualifiers="virtual const"> - <return type="Glyph*" /> + <method name="shaped_text_get_glyphs" qualifiers="virtual const"> + <return type="const Glyph*" /> <argument index="0" name="shaped" type="RID" /> <description> - Copies text glyphs in the visual order, into preallocated array of the size returned by [method _shaped_text_get_glyph_count]. + Returns an array of glyphs in the visual order. </description> </method> - <method name="_shaped_text_get_grapheme_bounds" qualifiers="virtual const"> + <method name="shaped_text_get_grapheme_bounds" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="pos" type="int" /> <description> Returns composite character's bounds as offsets from the start of the line. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_inferred_direction" qualifiers="virtual const"> + <method name="shaped_text_get_inferred_direction" qualifiers="virtual const"> <return type="int" enum="TextServer.Direction" /> <argument index="0" name="shaped" type="RID" /> <description> Returns direction of the text, inferred by the BiDi algorithm. </description> </method> - <method name="_shaped_text_get_line_breaks" qualifiers="virtual const"> + <method name="shaped_text_get_line_breaks" qualifiers="virtual const"> <return type="PackedInt32Array" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="width" type="float" /> @@ -1147,9 +1142,10 @@ <argument index="3" name="break_flags" type="int" /> <description> Breaks text to the lines and returns character ranges for each line. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_line_breaks_adv" qualifiers="virtual const"> + <method name="shaped_text_get_line_breaks_adv" qualifiers="virtual const"> <return type="PackedInt32Array" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="width" type="PackedFloat32Array" /> @@ -1158,9 +1154,10 @@ <argument index="4" name="break_flags" type="int" /> <description> Breaks text to the lines and columns. Returns character ranges for each segment. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_object_rect" qualifiers="virtual const"> + <method name="shaped_text_get_object_rect" qualifiers="virtual const"> <return type="Rect2" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="key" type="Variant" /> @@ -1168,35 +1165,35 @@ Returns bounding rectangle of the inline object. </description> </method> - <method name="_shaped_text_get_objects" qualifiers="virtual const"> + <method name="shaped_text_get_objects" qualifiers="virtual const"> <return type="Array" /> <argument index="0" name="shaped" type="RID" /> <description> Returns array of inline objects. </description> </method> - <method name="_shaped_text_get_orientation" qualifiers="virtual const"> + <method name="shaped_text_get_orientation" qualifiers="virtual const"> <return type="int" enum="TextServer.Orientation" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns text orientation. + eturns text orientation. </description> </method> - <method name="_shaped_text_get_parent" qualifiers="virtual const"> + <method name="shaped_text_get_parent" qualifiers="virtual const"> <return type="RID" /> <argument index="0" name="shaped" type="RID" /> <description> - Sets text orientation. + Returns the parent buffer from which the substring originates. </description> </method> - <method name="_shaped_text_get_preserve_control" qualifiers="virtual const"> + <method name="shaped_text_get_preserve_control" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> Returns [code]true[/code] if text buffer is configured to display control characters. </description> </method> - <method name="_shaped_text_get_preserve_invalid" qualifiers="virtual const"> + <method name="shaped_text_get_preserve_invalid" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> @@ -1204,97 +1201,102 @@ [b]Note:[/b] If set to [code]false[/code], nothing is displayed in place of invalid characters. </description> </method> - <method name="_shaped_text_get_range" qualifiers="virtual const"> + <method name="shaped_text_get_range" qualifiers="virtual const"> <return type="Vector2i" /> <argument index="0" name="shaped" type="RID" /> <description> Returns substring buffer character range in the parent buffer. </description> </method> - <method name="_shaped_text_get_selection" qualifiers="virtual const"> + <method name="shaped_text_get_selection" qualifiers="virtual const"> <return type="PackedVector2Array" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="start" type="int" /> <argument index="2" name="end" type="int" /> <description> Returns selection rectangles for the specified character range. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_get_size" qualifiers="virtual const"> + <method name="shaped_text_get_size" qualifiers="virtual const"> <return type="Vector2" /> <argument index="0" name="shaped" type="RID" /> <description> Returns size of the text. </description> </method> - <method name="_shaped_text_get_trim_pos" qualifiers="virtual const"> + <method name="shaped_text_get_trim_pos" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <description> - Returns ellipsis and trim positions. + Returns the position of the overrun trim. </description> </method> - <method name="_shaped_text_get_underline_position" qualifiers="virtual const"> + <method name="shaped_text_get_underline_position" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <description> Returns pixel offset of the underline below the baseline. </description> </method> - <method name="_shaped_text_get_underline_thickness" qualifiers="virtual const"> + <method name="shaped_text_get_underline_thickness" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <description> Returns thickness of the underline. </description> </method> - <method name="_shaped_text_get_width" qualifiers="virtual const"> + <method name="shaped_text_get_width" qualifiers="virtual const"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <description> Returns width (for horizontal layout) or height (for vertical) of the text. </description> </method> - <method name="_shaped_text_get_word_breaks" qualifiers="virtual const"> + <method name="shaped_text_get_word_breaks" qualifiers="virtual const"> <return type="PackedInt32Array" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="grapheme_flags" type="int" /> <description> Breaks text into words and returns array of character ranges. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_hit_test_grapheme" qualifiers="virtual const"> + <method name="shaped_text_hit_test_grapheme" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="coord" type="float" /> <description> Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_hit_test_position" qualifiers="virtual const"> + <method name="shaped_text_hit_test_position" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="coord" type="float" /> <description> Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_is_ready" qualifiers="virtual const"> + <method name="shaped_text_is_ready" qualifiers="virtual const"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> Returns [code]true[/code] if buffer is successfully shaped. </description> </method> - <method name="_shaped_text_next_grapheme_pos" qualifiers="virtual const"> + <method name="shaped_text_next_grapheme_pos" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="pos" type="int" /> <description> Returns composite character end position closest to the [code]pos[/code]. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_overrun_trim_to_width" qualifiers="virtual"> + <method name="shaped_text_overrun_trim_to_width" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="width" type="float" /> @@ -1303,15 +1305,16 @@ Trims text if it exceeds the given width. </description> </method> - <method name="_shaped_text_prev_grapheme_pos" qualifiers="virtual const"> + <method name="shaped_text_prev_grapheme_pos" qualifiers="virtual const"> <return type="int" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="pos" type="int" /> <description> Returns composite character start position closest to the [code]pos[/code]. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_shaped_text_resize_object" qualifiers="virtual"> + <method name="shaped_text_resize_object" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="key" type="Variant" /> @@ -1321,7 +1324,7 @@ Sets new size and alignment of embedded object. </description> </method> - <method name="_shaped_text_set_bidi_override" qualifiers="virtual"> + <method name="shaped_text_set_bidi_override" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="override" type="Array" /> @@ -1330,7 +1333,7 @@ Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. </description> </method> - <method name="_shaped_text_set_custom_punctuation" qualifiers="virtual"> + <method name="shaped_text_set_custom_punctuation" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="punct" type="String" /> @@ -1338,25 +1341,23 @@ Sets custom punctuation character list, used for word breaking. If set to empty string, server defaults are used. </description> </method> - <method name="_shaped_text_set_direction" qualifiers="virtual"> + <method name="shaped_text_set_direction" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="direction" type="int" enum="TextServer.Direction" /> <description> Sets desired text direction. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale. - [b]Note:[/b] Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature. </description> </method> - <method name="_shaped_text_set_orientation" qualifiers="virtual"> + <method name="shaped_text_set_orientation" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" /> <description> Sets desired text orientation. - [b]Note:[/b] Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature. </description> </method> - <method name="_shaped_text_set_preserve_control" qualifiers="virtual"> + <method name="shaped_text_set_preserve_control" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="enabled" type="bool" /> @@ -1364,7 +1365,7 @@ If set to [code]true[/code] text buffer will display control characters. </description> </method> - <method name="_shaped_text_set_preserve_invalid" qualifiers="virtual"> + <method name="shaped_text_set_preserve_invalid" qualifiers="virtual"> <return type="void" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="enabled" type="bool" /> @@ -1372,22 +1373,21 @@ If set to [code]true[/code] text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed. </description> </method> - <method name="_shaped_text_shape" qualifiers="virtual"> + <method name="shaped_text_shape" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully. - [b]Note:[/b] It is not necessary to call this function manually, buffer will be shaped automatically as soon as any of its output data is requested. </description> </method> - <method name="_shaped_text_sort_logical" qualifiers="virtual"> - <return type="Glyph*" /> + <method name="shaped_text_sort_logical" qualifiers="virtual"> + <return type="const Glyph*" /> <argument index="0" name="shaped" type="RID" /> <description> - Copies text glyphs in the logical order, into preallocated array of the size returned by [method _shaped_text_get_glyph_count]. + Returns text glyphs in the logical order. </description> </method> - <method name="_shaped_text_substr" qualifiers="virtual const"> + <method name="shaped_text_substr" qualifiers="virtual const"> <return type="RID" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="start" type="int" /> @@ -1396,7 +1396,7 @@ Returns text buffer for the substring of the text in the [code]shaped[/code] text buffer (including inline objects). </description> </method> - <method name="_shaped_text_tab_align" qualifiers="virtual"> + <method name="shaped_text_tab_align" qualifiers="virtual"> <return type="float" /> <argument index="0" name="shaped" type="RID" /> <argument index="1" name="tab_stops" type="PackedFloat32Array" /> @@ -1404,37 +1404,47 @@ Aligns shaped text to the given tab-stops. </description> </method> - <method name="_shaped_text_update_breaks" qualifiers="virtual"> + <method name="shaped_text_update_breaks" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> - Updates line and word breaks. + Updates line breaking positions in the text buffer. + [b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented. </description> </method> - <method name="_shaped_text_update_justification_ops" qualifiers="virtual"> + <method name="shaped_text_update_justification_ops" qualifiers="virtual"> <return type="bool" /> <argument index="0" name="shaped" type="RID" /> <description> - Updates justification opportunities (spaces, kashidas, etc.). + Updates line justification positions (word breaks and elongations) in the text buffer. + [b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented. </description> </method> - <method name="_string_to_lower" qualifiers="virtual const"> + <method name="string_to_lower" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="string" type="String" /> <argument index="1" name="language" type="String" /> <description> - Returns the string converted to lowercase. Casing is locale dependent and context sensitive. The result may be longer or shorter than the original. + Returns the string converted to lowercase. </description> </method> - <method name="_string_to_upper" qualifiers="virtual const"> + <method name="string_to_upper" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="string" type="String" /> <argument index="1" name="language" type="String" /> <description> - Returns the string converted to uppercase. Casing is locale dependent and context sensitive. The result may be longer or shorter than the original. + Returns the string converted to uppercase. + </description> + </method> + <method name="strip_diacritics" qualifiers="virtual const"> + <return type="String" /> + <argument index="0" name="string" type="String" /> + <description> + Strips diacritics from the string. + [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="_tag_to_name" qualifiers="virtual const"> + <method name="tag_to_name" qualifiers="virtual const"> <return type="String" /> <argument index="0" name="tag" type="int" /> <description> diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index 93c58a8d9d..4aa94e5293 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -39,6 +39,7 @@ #include "servers/rendering/renderer_compositor.h" #include "storage/canvas_texture_storage.h" #include "storage/config.h" +#include "storage/decal_atlas_storage.h" #include "storage/render_target_storage.h" #include "storage/texture_storage.h" @@ -53,6 +54,7 @@ protected: GLES3::Config config; GLES3::CanvasTextureStorage canvas_texture_storage; GLES3::TextureStorage texture_storage; + GLES3::DecalAtlasStorage decal_atlas_storage; RasterizerStorageGLES3 storage; RasterizerCanvasGLES3 canvas; RasterizerSceneGLES3 scene; @@ -62,6 +64,7 @@ protected: public: RendererCanvasTextureStorage *get_canvas_texture_storage() { return &canvas_texture_storage; } RendererTextureStorage *get_texture_storage() { return &texture_storage; } + RendererDecalAtlasStorage *get_decal_atlas_storage() { return &decal_atlas_storage; } RendererStorage *get_storage() { return &storage; } RendererCanvasRender *get_canvas() { return &canvas; } RendererSceneRender *get_scene() { return &scene; } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index e28a40ba9b..5efbc715ab 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -175,7 +175,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { p_shader->canvas_item.uses_color = false; p_shader->canvas_item.uses_vertex = false; - p_shader->canvas_item.uses_world_matrix = false; + p_shader->canvas_item.uses_model_matrix = false; p_shader->canvas_item.uses_extra_matrix = false; p_shader->canvas_item.uses_projection_matrix = false; p_shader->canvas_item.uses_instance_custom = false; @@ -198,7 +198,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const { shaders.actions_canvas.usage_flag_pointers["VERTEX"] = &p_shader->canvas_item.uses_vertex; - shaders.actions_canvas.usage_flag_pointers["WORLD_MATRIX"] = &p_shader->canvas_item.uses_world_matrix; + shaders.actions_canvas.usage_flag_pointers["MODEL_MATRIX"] = &p_shader->canvas_item.uses_model_matrix; shaders.actions_canvas.usage_flag_pointers["EXTRA_MATRIX"] = &p_shader->canvas_item.uses_extra_matrix; shaders.actions_canvas.usage_flag_pointers["PROJECTION_MATRIX"] = &p_shader->canvas_item.uses_projection_matrix; shaders.actions_canvas.usage_flag_pointers["INSTANCE_CUSTOM"] = &p_shader->canvas_item.uses_instance_custom; @@ -1202,46 +1202,6 @@ void RasterizerStorageGLES3::base_update_dependency(RID p_base, DependencyTracke void RasterizerStorageGLES3::skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) { } -/* DECAL API */ - -RID RasterizerStorageGLES3::decal_allocate() { - return RID(); -} - -void RasterizerStorageGLES3::decal_initialize(RID p_rid) { -} - -void RasterizerStorageGLES3::decal_set_extents(RID p_decal, const Vector3 &p_extents) { -} - -void RasterizerStorageGLES3::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { -} - -void RasterizerStorageGLES3::decal_set_emission_energy(RID p_decal, float p_energy) { -} - -void RasterizerStorageGLES3::decal_set_albedo_mix(RID p_decal, float p_mix) { -} - -void RasterizerStorageGLES3::decal_set_modulate(RID p_decal, const Color &p_modulate) { -} - -void RasterizerStorageGLES3::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { -} - -void RasterizerStorageGLES3::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) { -} - -void RasterizerStorageGLES3::decal_set_fade(RID p_decal, float p_above, float p_below) { -} - -void RasterizerStorageGLES3::decal_set_normal_fade(RID p_decal, float p_fade) { -} - -AABB RasterizerStorageGLES3::decal_get_aabb(RID p_decal) const { - return AABB(); -} - /* VOXEL GI API */ RID RasterizerStorageGLES3::voxel_gi_allocate() { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 96daed581b..4e04b918c2 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -202,7 +202,7 @@ public: bool uses_vertex; // all these should disable item joining if used in a custom shader - bool uses_world_matrix; + bool uses_model_matrix; bool uses_extra_matrix; bool uses_projection_matrix; bool uses_instance_custom; @@ -579,25 +579,6 @@ public: void base_update_dependency(RID p_base, DependencyTracker *p_instance) override; void skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) override; - /* DECAL API */ - - RID decal_allocate() override; - void decal_initialize(RID p_rid) override; - void decal_set_extents(RID p_decal, const Vector3 &p_extents) override; - void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override; - void decal_set_emission_energy(RID p_decal, float p_energy) override; - void decal_set_albedo_mix(RID p_decal, float p_mix) override; - void decal_set_modulate(RID p_decal, const Color &p_modulate) override; - void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override; - void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override; - void decal_set_fade(RID p_decal, float p_above, float p_below) override; - void decal_set_normal_fade(RID p_decal, float p_fade) override; - - AABB decal_get_aabb(RID p_decal) const override; - - void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} - void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} - /* VOXEL GI API */ RID voxel_gi_allocate() override; diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index a18c451858..8812447f6e 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -96,7 +96,7 @@ void main() { #endif - mat4 world_matrix = mat4(vec4(draw_data[draw_data_instance].world_x, 0.0, 0.0), vec4(draw_data[draw_data_instance].world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data[draw_data_instance].world_ofs, 0.0, 1.0)); + mat4 model_matrix = mat4(vec4(draw_data[draw_data_instance].world_x, 0.0, 0.0), vec4(draw_data[draw_data_instance].world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data[draw_data_instance].world_ofs, 0.0, 1.0)); // MultiMeshes don't batch, so always read from draw_data[0] uint instancing = draw_data[0].flags & FLAGS_INSTANCING_MASK; @@ -169,7 +169,7 @@ void main() { } matrix = transpose(matrix); - world_matrix = world_matrix * matrix; + model_matrix = model_matrix * matrix; } } */ @@ -192,7 +192,7 @@ void main() { #endif #if !defined(SKIP_TRANSFORM_USED) - vertex = (world_matrix * vec4(vertex, 0.0, 1.0)).xy; + vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy; #endif color_interp = color; diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl index 65389c211a..94485abd11 100644 --- a/drivers/gles3/shaders/canvas_shadow.glsl +++ b/drivers/gles3/shaders/canvas_shadow.glsl @@ -15,13 +15,13 @@ layout(location = 0) in highp vec3 vertex; uniform highp mat4 projection_matrix; /* clang-format on */ uniform highp mat4 light_matrix; -uniform highp mat4 world_matrix; +uniform highp mat4 model_matrix; uniform highp float distance_norm; out highp vec4 position_interp; void main() { - gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0))); + gl_Position = projection_matrix * (light_matrix * (model_matrix * vec4(vertex, 1.0))); position_interp = gl_Position; } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 2d504cd052..ebb00e81d0 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -73,8 +73,8 @@ layout(location = 12) in highp vec4 instance_custom_data; // uniforms // -uniform highp mat4 camera_matrix; -uniform highp mat4 camera_inverse_matrix; +uniform highp mat4 inv_view_matrix; +uniform highp mat4 view_matrix; uniform highp mat4 projection_matrix; uniform highp mat4 projection_inverse_matrix; @@ -314,7 +314,7 @@ uniform mediump float fog_height_curve; void main() { highp vec4 vertex = vertex_attrib; - mat4 world_matrix = world_transform; + mat4 model_matrix = world_transform; #ifdef USE_INSTANCING { @@ -323,7 +323,7 @@ void main() { instance_xform_row_1, instance_xform_row_2, vec4(0.0, 0.0, 0.0, 1.0)); - world_matrix = world_matrix * transpose(m); + model_matrix = model_matrix * transpose(m); } #endif @@ -356,12 +356,12 @@ void main() { #endif #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = world_matrix * vertex; - normal = normalize((world_matrix * vec4(normal, 0.0)).xyz); + vertex = model_matrix * vertex; + normal = normalize((model_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) - tangent = normalize((world_matrix * vec4(tangent, 0.0)).xyz); - binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz); + tangent = normalize((model_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((model_matrix * vec4(binormal, 0.0)).xyz); #endif #endif @@ -395,7 +395,7 @@ void main() { #endif - world_matrix = world_matrix * bone_transform; + model_matrix = model_matrix * bone_transform; #endif @@ -408,11 +408,11 @@ void main() { mat4 local_projection_matrix = projection_matrix; - mat4 modelview = camera_inverse_matrix * world_matrix; + mat4 modelview = view_matrix * model_matrix; float roughness = 1.0; #define projection_matrix local_projection_matrix -#define world_transform world_matrix +#define world_transform model_matrix float point_size = 1.0; @@ -439,11 +439,11 @@ VERTEX_SHADER_CODE #endif #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = camera_inverse_matrix * vertex; - normal = normalize((camera_inverse_matrix * vec4(normal, 0.0)).xyz); + vertex = view_matrix * vertex; + normal = normalize((view_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) - tangent = normalize((camera_inverse_matrix * vec4(tangent, 0.0)).xyz); - binormal = normalize((camera_inverse_matrix * vec4(binormal, 0.0)).xyz); + tangent = normalize((view_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((view_matrix * vec4(binormal, 0.0)).xyz); #endif #endif @@ -635,7 +635,7 @@ VERTEX_SHADER_CODE #ifdef FOG_HEIGHT_ENABLED { - float y = (camera_matrix * vec4(vertex_interp, 1.0)).y; + float y = (inv_view_matrix * vec4(vertex_interp, 1.0)).y; fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve)); } #endif @@ -680,9 +680,9 @@ precision mediump int; // uniforms // -uniform highp mat4 camera_matrix; +uniform highp mat4 inv_view_matrix; /* clang-format on */ -uniform highp mat4 camera_inverse_matrix; +uniform highp mat4 view_matrix; uniform highp mat4 projection_matrix; uniform highp mat4 projection_inverse_matrix; @@ -1644,7 +1644,7 @@ FRAGMENT_SHADER_CODE cone_dirs[10] = vec3(-0.700629, -0.509037, -0.5); cone_dirs[11] = vec3(0.267617, -0.823639, -0.5); - vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz; + vec3 local_normal = normalize(inv_view_matrix * vec4(normal, 0.0)).xyz; vec4 captured = vec4(0.0); float sum = 0.0; for (int i = 0; i < 12; i++) { @@ -2122,7 +2122,7 @@ FRAGMENT_SHADER_CODE #ifdef FOG_HEIGHT_ENABLED { - float y = (camera_matrix * vec4(vertex, 1.0)).y; + float y = (inv_view_matrix * vec4(vertex, 1.0)).y; fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve)); } #endif diff --git a/drivers/gles3/storage/decal_atlas_storage.cpp b/drivers/gles3/storage/decal_atlas_storage.cpp new file mode 100644 index 0000000000..7bac34ea19 --- /dev/null +++ b/drivers/gles3/storage/decal_atlas_storage.cpp @@ -0,0 +1,75 @@ +/*************************************************************************/ +/* decal_atlas_storage.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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. */ +/*************************************************************************/ + +#ifdef GLES3_ENABLED + +#include "decal_atlas_storage.h" + +using namespace GLES3; + +RID DecalAtlasStorage::decal_allocate() { + return RID(); +} + +void DecalAtlasStorage::decal_initialize(RID p_rid) { +} + +void DecalAtlasStorage::decal_set_extents(RID p_decal, const Vector3 &p_extents) { +} + +void DecalAtlasStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { +} + +void DecalAtlasStorage::decal_set_emission_energy(RID p_decal, float p_energy) { +} + +void DecalAtlasStorage::decal_set_albedo_mix(RID p_decal, float p_mix) { +} + +void DecalAtlasStorage::decal_set_modulate(RID p_decal, const Color &p_modulate) { +} + +void DecalAtlasStorage::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { +} + +void DecalAtlasStorage::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) { +} + +void DecalAtlasStorage::decal_set_fade(RID p_decal, float p_above, float p_below) { +} + +void DecalAtlasStorage::decal_set_normal_fade(RID p_decal, float p_fade) { +} + +AABB DecalAtlasStorage::decal_get_aabb(RID p_decal) const { + return AABB(); +} + +#endif // !GLES3_ENABLED diff --git a/drivers/gles3/storage/decal_atlas_storage.h b/drivers/gles3/storage/decal_atlas_storage.h new file mode 100644 index 0000000000..f5dc36b1fb --- /dev/null +++ b/drivers/gles3/storage/decal_atlas_storage.h @@ -0,0 +1,67 @@ +/*************************************************************************/ +/* decal_atlas_storage.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 DECAL_ATLAS_STORAGE_GLES3_H +#define DECAL_ATLAS_STORAGE_GLES3_H + +#ifdef GLES3_ENABLED + +#include "core/templates/rid_owner.h" +#include "servers/rendering/storage/decal_atlas_storage.h" + +namespace GLES3 { + +class DecalAtlasStorage : public RendererDecalAtlasStorage { +public: + virtual RID decal_allocate() override; + virtual void decal_initialize(RID p_rid) override; + virtual void decal_free(RID p_rid) override{}; + + virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override; + virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override; + virtual void decal_set_emission_energy(RID p_decal, float p_energy) override; + virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override; + virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) override; + virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override; + virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override; + virtual void decal_set_fade(RID p_decal, float p_above, float p_below) override; + virtual void decal_set_normal_fade(RID p_decal, float p_fade) override; + + virtual AABB decal_get_aabb(RID p_decal) const override; + + virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} + virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} +}; + +} // namespace GLES3 + +#endif // !GLES3_ENABLED + +#endif // !DECAL_ATLAS_STORAGE_GLES3_H diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index bb6428cdf0..40b53c2636 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -392,7 +392,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da stack_dump_info.push_back(d); s->set_metadata(0, d); - String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + d["function"]; + String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + String(d["function"]); s->set_text(0, line); if (i == 0) { diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 9b6e2698b6..5beda7d907 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -43,10 +43,10 @@ void EditorAbout::_theme_changed() { const int font_size = get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts")); _tpl_text->add_theme_font_override("normal_font", font); _tpl_text->add_theme_font_size_override("normal_font_size", font_size); - _tpl_text->add_theme_constant_override("line_separation", 6 * EDSCALE); + _tpl_text->add_theme_constant_override("line_separation", 4 * EDSCALE); _license_text->add_theme_font_override("normal_font", font); _license_text->add_theme_font_size_override("normal_font_size", font_size); - _license_text->add_theme_constant_override("line_separation", 6 * EDSCALE); + _license_text->add_theme_constant_override("line_separation", 4 * EDSCALE); _logo->set_texture(get_theme_icon(SNAME("Logo"), SNAME("EditorIcons"))); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 02495252bc..afb5bd9d4d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1763,6 +1763,8 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "debug/export_console_script", PROPERTY_HINT_ENUM, "No,Debug Only,Debug and Release"), 1)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false)); @@ -1817,23 +1819,6 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, return valid; } -List<String> EditorExportPlatformPC::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { - List<String> list; - for (const KeyValue<String, String> &E : extensions) { - if (p_preset->get(E.key)) { - list.push_back(extensions[E.key]); - return list; - } - } - - if (extensions.has("default")) { - list.push_back(extensions["default"]); - return list; - } - - return list; -} - Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); @@ -1888,10 +1873,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr return ERR_INVALID_PARAMETER; } - FixUpEmbeddedPckFunc fixup_func = get_fixup_embedded_pck_func(); - if (fixup_func) { - err = fixup_func(p_path, embedded_pos, embedded_size); - } + err = fixup_embedded_pck(p_path, embedded_pos, embedded_size); } if (err == OK && !so_files.is_empty()) { @@ -1928,10 +1910,6 @@ Error EditorExportPlatformPC::sign_shared_object(const Ref<EditorExportPreset> & return OK; } -void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) { - extensions[p_feature_key] = p_extension; -} - void EditorExportPlatformPC::set_name(const String &p_name) { name = p_name; } @@ -1982,19 +1960,6 @@ void EditorExportPlatformPC::set_chmod_flags(int p_flags) { chmod_flags = p_flags; } -EditorExportPlatformPC::FixUpEmbeddedPckFunc EditorExportPlatformPC::get_fixup_embedded_pck_func() const { - return fixup_embedded_pck_func; -} - -void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func) { - fixup_embedded_pck_func = p_fixup_embedded_pck_func; -} - -EditorExportPlatformPC::EditorExportPlatformPC() { - chmod_flags = -1; - fixup_embedded_pck_func = nullptr; -} - /////////////////////// void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) { diff --git a/editor/editor_export.h b/editor/editor_export.h index d9039f601e..108abab29b 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -421,23 +421,17 @@ public: class EditorExportPlatformPC : public EditorExportPlatform { GDCLASS(EditorExportPlatformPC, EditorExportPlatform); -public: - typedef Error (*FixUpEmbeddedPckFunc)(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size); - private: Ref<ImageTexture> logo; String name; String os_name; - Map<String, String> extensions; String release_file_32; String release_file_64; String debug_file_32; String debug_file_64; - int chmod_flags; - - FixUpEmbeddedPckFunc fixup_embedded_pck_func; + int chmod_flags = -1; public: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; @@ -449,11 +443,9 @@ public: virtual Ref<Texture2D> get_logo() const override; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override; - virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override; virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path); - void set_extension(const String &p_extension, const String &p_feature_key = "default"); void set_name(const String &p_name); void set_os_name(const String &p_name); @@ -471,10 +463,9 @@ public: int get_chmod_flags() const; void set_chmod_flags(int p_flags); - FixUpEmbeddedPckFunc get_fixup_embedded_pck_func() const; - void set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func); - - EditorExportPlatformPC(); + virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) const { + return Error::OK; + } }; class EditorExportTextSceneToBinaryPlugin : public EditorExportPlugin { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d01dfb5361..bf118b8e16 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -707,7 +707,10 @@ void EditorNode::_notification(int p_what) { bool theme_changed = EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme"); + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font"); if (theme_changed) { theme = create_custom_theme(theme_base->get_theme()); diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index 49f2f21095..f55b2b61c8 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -83,6 +83,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["aabb"] = "AABB"; capitalize_string_remaps["adb"] = "ADB"; capitalize_string_remaps["ao"] = "AO"; + capitalize_string_remaps["apk"] = "APK"; capitalize_string_remaps["arvr"] = "ARVR"; capitalize_string_remaps["bg"] = "BG"; capitalize_string_remaps["bp"] = "BP"; @@ -119,15 +120,21 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["hsv"] = "HSV"; capitalize_string_remaps["http"] = "HTTP"; capitalize_string_remaps["id"] = "ID"; - capitalize_string_remaps["ik"] = "IK"; capitalize_string_remaps["igd"] = "IGD"; + capitalize_string_remaps["ik"] = "IK"; + capitalize_string_remaps["image@2x"] = "Image @2x"; + capitalize_string_remaps["image@3x"] = "Image @3x"; capitalize_string_remaps["ios"] = "iOS"; capitalize_string_remaps["iod"] = "IOD"; capitalize_string_remaps["ip"] = "IP"; + capitalize_string_remaps["ipad"] = "iPad"; + capitalize_string_remaps["iphone"] = "iPhone"; capitalize_string_remaps["ipv6"] = "IPv6"; + capitalize_string_remaps["jit"] = "JIT"; capitalize_string_remaps["k1"] = "K1"; capitalize_string_remaps["k2"] = "K2"; capitalize_string_remaps["kb"] = "(KB)"; // Unit. + capitalize_string_remaps["ldr"] = "LDR"; capitalize_string_remaps["lod"] = "LOD"; capitalize_string_remaps["lowpass"] = "Low-pass"; capitalize_string_remaps["macos"] = "macOS"; @@ -137,13 +144,16 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { //capitalize_string_remaps["msec"] = "(msec)"; // Unit. capitalize_string_remaps["msaa"] = "MSAA"; capitalize_string_remaps["normalmap"] = "Normal Map"; + capitalize_string_remaps["ok"] = "OK"; capitalize_string_remaps["opengl"] = "OpenGL"; capitalize_string_remaps["opentype"] = "OpenType"; capitalize_string_remaps["openxr"] = "OpenXR"; + capitalize_string_remaps["pck"] = "PCK"; capitalize_string_remaps["png"] = "PNG"; capitalize_string_remaps["po2"] = "(Power of 2)"; // Unit. capitalize_string_remaps["pvs"] = "PVS"; capitalize_string_remaps["pvrtc"] = "PVRTC"; + capitalize_string_remaps["rgb"] = "RGB"; capitalize_string_remaps["rid"] = "RID"; capitalize_string_remaps["rmb"] = "RMB"; capitalize_string_remaps["rpc"] = "RPC"; @@ -152,18 +162,21 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["sdfgi"] = "SDFGI"; capitalize_string_remaps["sdk"] = "SDK"; capitalize_string_remaps["sec"] = "(sec)"; // Unit. + capitalize_string_remaps["srgb"] = "sRGB"; capitalize_string_remaps["ssao"] = "SSAO"; capitalize_string_remaps["ssh"] = "SSH"; capitalize_string_remaps["ssil"] = "SSIL"; capitalize_string_remaps["ssl"] = "SSL"; capitalize_string_remaps["stderr"] = "stderr"; capitalize_string_remaps["stdout"] = "stdout"; + capitalize_string_remaps["svg"] = "SVG"; capitalize_string_remaps["tcp"] = "TCP"; capitalize_string_remaps["ui"] = "UI"; capitalize_string_remaps["url"] = "URL"; capitalize_string_remaps["urls"] = "URLs"; - capitalize_string_remaps["us"] = "(µs)"; // Unit. - capitalize_string_remaps["usec"] = "(µsec)"; // Unit. + capitalize_string_remaps["us"] = String::utf8("(µs)"); // Unit. + capitalize_string_remaps["usec"] = String::utf8("(µsec)"); // Unit. + capitalize_string_remaps["uuid"] = "UUID"; capitalize_string_remaps["uv"] = "UV"; capitalize_string_remaps["uv1"] = "UV1"; capitalize_string_remaps["uv2"] = "UV2"; @@ -174,6 +187,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["webp"] = "WebP"; capitalize_string_remaps["webrtc"] = "WebRTC"; capitalize_string_remaps["websocket"] = "WebSocket"; + capitalize_string_remaps["wifi"] = "Wi-Fi"; capitalize_string_remaps["xr"] = "XR"; capitalize_string_remaps["xy"] = "XY"; capitalize_string_remaps["xz"] = "XZ"; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 2d80fe85f8..08cc957ec7 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -404,12 +404,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { const String display_scale_hint_string = vformat("Auto (%d%%),75%%,100%%,125%%,150%%,175%%,200%%,Custom", Math::round(get_auto_display_scale() * 100)); EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/display_scale", 0, display_scale_hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) - _initial_set("interface/editor/enable_debugging_pseudolocalization", false); - set_restart_if_changed("interface/editor/enable_debugging_pseudolocalization", true); + _initial_set("interface/editor/debug/enable_pseudolocalization", false); + set_restart_if_changed("interface/editor/debug/enable_pseudolocalization", true); // Use pseudolocalization in editor. EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/custom_display_scale", 1.0, "0.5,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) - EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_RANGE, "interface/editor/main_font_size", 14, "8,48,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "interface/editor/main_font_size", 14, "8,48,1") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "interface/editor/code_font_size", 14, "8,48,1") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/code_font_contextual_ligatures", 0, "Default,Disable Contextual Alternates (Coding Ligatures),Use Custom OpenType Feature Set") _initial_set("interface/editor/code_font_custom_opentype_features", ""); @@ -535,7 +535,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { // Appearance: Whitespace _initial_set("text_editor/appearance/whitespace/draw_tabs", true); _initial_set("text_editor/appearance/whitespace/draw_spaces", false); - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/appearance/whitespace/line_spacing", 6, "0,50,1") + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/appearance/whitespace/line_spacing", 4, "0,50,1") // Behavior // Behavior: Navigation @@ -716,6 +716,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { // Profiler _initial_set("debugger/profiler_frame_history_size", 600); + // HTTP Proxy + _initial_set("network/http_proxy/host", ""); + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "network/http_proxy/port", 8080, "1,65535,1") + /* Extra config */ EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "project_manager/sorting_order", 0, "Name,Path,Last Edited") @@ -887,7 +891,7 @@ fail: } void EditorSettings::setup_language() { - TranslationServer::get_singleton()->set_editor_pseudolocalization(get("interface/editor/enable_debugging_pseudolocalization")); + TranslationServer::get_singleton()->set_editor_pseudolocalization(get("interface/editor/debug/enable_pseudolocalization")); String lang = get("interface/editor/editor_language"); if (lang == "en") { return; // Default, nothing to do. diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 2fd4f3d6e6..9bf3c4c590 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -346,7 +346,7 @@ void EditorSpinSlider::_draw_spin_slider() { text_ofs.x += glyphs[i].advance; } } - TS->free(num_rid); + TS->free_rid(num_rid); if (get_step() == 1) { Ref<Texture2D> updown2 = get_theme_icon(is_read_only() ? SNAME("updown_disabled") : SNAME("updown"), SNAME("SpinBox")); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index df3e73267e..7320f957c9 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -147,8 +147,8 @@ void ExportTemplateManager::_download_template(const String &p_url, bool p_skip_ download_templates->set_download_file(EditorPaths::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz")); download_templates->set_use_threads(true); - const String proxy_host = EDITOR_DEF("network/http_proxy/host", ""); - const int proxy_port = EDITOR_DEF("network/http_proxy/port", -1); + const String proxy_host = EDITOR_GET("network/http_proxy/host"); + const int proxy_port = EDITOR_GET("network/http_proxy/port"); download_templates->set_http_proxy(proxy_host, proxy_port); download_templates->set_https_proxy(proxy_host, proxy_port); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 5d8f14a978..20349e8ccb 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -645,7 +645,7 @@ void DynamicFontImportSettings::_glyph_text_selected() { selected_glyphs.insert(gl[i].index); } } - TS->free(text_rid); + TS->free_rid(text_rid); label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size())); } _range_selected(); diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index f500268ad3..5045e4a541 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -447,7 +447,7 @@ void SceneImportSettings::_update_camera() { camera->set_orthogonal(camera_size * zoom, 0.0001, camera_size * 2); Transform3D xf; - xf.basis = Basis(Vector3(0, 1, 0), rot_y) * Basis(Vector3(1, 0, 0), rot_x); + xf.basis = Basis(Vector3(1, 0, 0), rot_x) * Basis(Vector3(0, 1, 0), rot_y); xf.origin = center; xf.translate(0, 0, camera_size); @@ -529,6 +529,8 @@ void SceneImportSettings::open_settings(const String &p_path) { base_viewport->add_child(scene); + inspector->edit(nullptr); + if (first_aabb) { contents_aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); first_aabb = false; diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index 7b85fea1e9..5ca8216d4d 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -818,7 +818,7 @@ void ControlEditorToolbar::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - anchor_layouts_icon->set_texture(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons"))); + anchor_presets_menu->set_icon(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons"))); PopupMenu *p = anchor_presets_menu->get_popup(); p->clear(); @@ -871,7 +871,8 @@ void ControlEditorToolbar::_notification(int p_what) { anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons"))); - container_layouts_icon->set_texture(get_theme_icon(SNAME("Container"), SNAME("EditorIcons"))); + container_h_presets_menu->set_icon(get_theme_icon(SNAME("Container"), SNAME("EditorIcons"))); + container_v_presets_menu->set_icon(get_theme_icon(SNAME("Container"), SNAME("EditorIcons"))); p = container_h_presets_menu->get_popup(); p->clear(); @@ -925,27 +926,19 @@ void ControlEditorToolbar::_notification(int p_what) { } if (enable_anchors) { - anchor_presets_menu->set_disabled(false); - anchor_presets_menu->set_tooltip(TTR("Presets for the anchor and offset values of a Control node.")); - anchor_mode_button->set_disabled(false); - anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); + anchor_presets_menu->set_visible(true); + anchor_mode_button->set_visible(true); } else { - anchor_presets_menu->set_disabled(true); - anchor_presets_menu->set_tooltip(TTR("Children of containers have their anchors and offsets values controlled by their parent.")); - anchor_mode_button->set_disabled(true); - anchor_mode_button->set_tooltip(TTR("Children of containers have their anchors and offsets values controlled by their parent.")); + anchor_presets_menu->set_visible(false); + anchor_mode_button->set_visible(false); } if (enable_containers) { - container_h_presets_menu->set_disabled(false); - container_h_presets_menu->set_tooltip(TTR("Horizontal sizing setting for children of a Container node.")); - container_v_presets_menu->set_disabled(false); - container_v_presets_menu->set_tooltip(TTR("Vertical sizing setting for children of a Container node.")); + container_h_presets_menu->set_visible(true); + container_v_presets_menu->set_visible(true); } else { - container_h_presets_menu->set_disabled(true); - container_h_presets_menu->set_tooltip(TTR("Children of regular controls are controlled by their anchors and offsets.")); - container_v_presets_menu->set_disabled(true); - container_v_presets_menu->set_tooltip(TTR("Children of regular controls are controlled by their anchors and offsets.")); + container_h_presets_menu->set_visible(false); + container_v_presets_menu->set_visible(false); } } else { set_visible(false); @@ -955,18 +948,10 @@ void ControlEditorToolbar::_notification(int p_what) { } ControlEditorToolbar::ControlEditorToolbar() { - anchor_layouts_icon = memnew(TextureRect); - anchor_layouts_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED); - add_child(anchor_layouts_icon); - - Label *l = memnew(Label); - l->set_text(TTR("Anchors")); - l->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER); - add_child(l); - anchor_presets_menu = memnew(MenuButton); anchor_presets_menu->set_shortcut_context(this); - anchor_presets_menu->set_text(TTR("Preset")); + anchor_presets_menu->set_text(TTR("Anchors")); + anchor_presets_menu->set_tooltip(TTR("Presets for the anchor and offset values of a Control node.")); add_child(anchor_presets_menu); anchor_presets_menu->set_switch_on_hover(true); @@ -981,23 +966,16 @@ ControlEditorToolbar::ControlEditorToolbar() { anchor_mode_button = memnew(Button); anchor_mode_button->set_flat(true); anchor_mode_button->set_toggle_mode(true); + anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); add_child(anchor_mode_button); anchor_mode_button->connect("toggled", callable_mp(this, &ControlEditorToolbar::_button_toggle_anchor_mode)); add_child(memnew(VSeparator)); - container_layouts_icon = memnew(TextureRect); - container_layouts_icon->set_stretch_mode(TextureRect::StretchMode::STRETCH_KEEP_CENTERED); - add_child(container_layouts_icon); - - l = memnew(Label); - l->set_text(TTR("Containers")); - l->set_vertical_alignment(VerticalAlignment::VERTICAL_ALIGNMENT_CENTER); - add_child(l); - container_h_presets_menu = memnew(MenuButton); container_h_presets_menu->set_shortcut_context(this); container_h_presets_menu->set_text(TTR("Horizontal")); + container_h_presets_menu->set_tooltip(TTR("Horizontal sizing setting for children of a Container node.")); add_child(container_h_presets_menu); container_h_presets_menu->set_switch_on_hover(true); @@ -1007,6 +985,7 @@ ControlEditorToolbar::ControlEditorToolbar() { container_v_presets_menu = memnew(MenuButton); container_v_presets_menu->set_shortcut_context(this); container_v_presets_menu->set_text(TTR("Vertical")); + container_v_presets_menu->set_tooltip(TTR("Vertical sizing setting for children of a Container node.")); add_child(container_v_presets_menu); container_v_presets_menu->set_switch_on_hover(true); diff --git a/editor/plugins/control_editor_plugin.h b/editor/plugins/control_editor_plugin.h index bbbada2b3f..37d218abb9 100644 --- a/editor/plugins/control_editor_plugin.h +++ b/editor/plugins/control_editor_plugin.h @@ -198,10 +198,8 @@ class ControlEditorToolbar : public HBoxContainer { CONTAINERS_V_PRESET_SHRINK_END, }; - TextureRect *anchor_layouts_icon; MenuButton *anchor_presets_menu; PopupMenu *anchors_popup; - TextureRect *container_layouts_icon; MenuButton *container_h_presets_menu; MenuButton *container_v_presets_menu; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 39e2e0bc9b..52e60b606c 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5935,9 +5935,9 @@ void fragment() { float angle_fade = abs(dot(dir, NORMAL)); angle_fade = smoothstep(0.05, 0.2, angle_fade); - vec3 world_pos = (CAMERA_MATRIX * vec4(VERTEX, 1.0)).xyz; - vec3 world_normal = (CAMERA_MATRIX * vec4(NORMAL, 0.0)).xyz; - vec3 camera_world_pos = CAMERA_MATRIX[3].xyz; + vec3 world_pos = (INV_VIEW_MATRIX * vec4(VERTEX, 1.0)).xyz; + vec3 world_normal = (INV_VIEW_MATRIX * vec4(NORMAL, 0.0)).xyz; + vec3 camera_world_pos = INV_VIEW_MATRIX[3].xyz; vec3 camera_world_pos_on_plane = camera_world_pos * (1.0 - world_normal); float dist_fade = 1.0 - (distance(world_pos, camera_world_pos_on_plane) / grid_size); dist_fade = smoothstep(0.02, 0.3, dist_fade); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index aadc7a2e66..065683d632 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -419,8 +419,14 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi capsule_transform.basis = Basis(Vector3(1, 0, 0), Vector3(0, 0, 1), Vector3(0, -1, 0)); bone_shape->set_transform(capsule_transform); + /// Get an up vector not collinear with child rest origin + Vector3 up = Vector3(0, 1, 0); + if (up.cross(child_rest.origin).is_equal_approx(Vector3())) { + up = Vector3(0, 0, 1); + } + Transform3D body_transform; - body_transform.basis = Basis::looking_at(child_rest.origin); + body_transform.basis = Basis::looking_at(child_rest.origin, up); body_transform.origin = body_transform.basis.xform(Vector3(0, 0, -half_height)); Transform3D joint_transform; @@ -811,7 +817,7 @@ void vertex() { COLOR.rgb = mix( pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), COLOR.rgb* (1.0 / 12.92), lessThan(COLOR.rgb,vec3(0.04045)) ); } VERTEX = VERTEX; - POSITION=PROJECTION_MATRIX*INV_CAMERA_MATRIX*WORLD_MATRIX*vec4(VERTEX.xyz,1.0); + POSITION = PROJECTION_MATRIX * VIEW_MATRIX * MODEL_MATRIX * vec4(VERTEX.xyz, 1.0); POSITION.z = mix(POSITION.z, 0, 0.999); POINT_SIZE = point_size; } @@ -1104,7 +1110,7 @@ void vertex() { COLOR.rgb = mix( pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), COLOR.rgb* (1.0 / 12.92), lessThan(COLOR.rgb,vec3(0.04045)) ); } VERTEX = VERTEX; - POSITION=PROJECTION_MATRIX*INV_CAMERA_MATRIX*WORLD_MATRIX*vec4(VERTEX.xyz,1.0); + POSITION = PROJECTION_MATRIX * VIEW_MATRIX * MODEL_MATRIX * vec4(VERTEX.xyz, 1.0); POSITION.z = mix(POSITION.z, 0, 0.998); } void fragment() { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d83cf17048..50773836db 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4949,17 +4949,17 @@ VisualShaderEditor::VisualShaderEditor() { // NODE3D-FOR-ALL - add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "camera"), { "camera" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_camera"), { "inv_camera" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_projection"), { "inv_projection" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("InvProjectionMatrix", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_projection_matrix"), { "inv_projection_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("InvViewMatrix", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "inv_view_matrix"), { "inv_view_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ModelMatrix", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "model_matrix"), { "model_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Normal", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "normal"), { "normal" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("OutputIsSRGB", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "output_is_srgb"), { "output_is_srgb" }, VisualShaderNode::PORT_TYPE_BOOLEAN, -1, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("Projection", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "projection"), { "projection" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ProjectionMatrix", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "projection_matrix"), { "projection_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "time"), { "time" }, VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("UV", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "uv"), { "uv" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("UV2", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "uv2"), { "uv2" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, -1, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ViewMatrix", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "view_matrix"), { "view_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("ViewportSize", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "viewport_size"), { "viewport_size" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, -1, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("World", "Input", "All", "VisualShaderNodeInput", vformat(input_param_shader_modes, "world"), { "world" }, VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL)); // CANVASITEM-FOR-ALL @@ -5012,7 +5012,7 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("InstanceId", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_id"), { "instance_id" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("InstanceCustom", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_custom"), { "instance_custom" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("InstanceCustomAlpha", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_custom_alpha"), { "instance_custom_alpha" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("ModelView", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "modelview"), { "modelview" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ModelViewMatrix", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "modelview_matrix"), { "modelview_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "point_size"), { "point_size" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Tangent", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_mode, "tangent"), { "tangent" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "vertex"), { "vertex" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); @@ -5053,15 +5053,15 @@ VisualShaderEditor::VisualShaderEditor() { // CANVASITEM INPUTS add_options.push_back(AddOption("AtLightPass", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "at_light_pass"), { "at_light_pass" }, VisualShaderNode::PORT_TYPE_BOOLEAN, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); - add_options.push_back(AddOption("Canvas", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "canvas"), { "canvas" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("CanvasMatrix", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "canvas_matrix"), { "canvas_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("InstanceCustom", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_custom"), { "instance_custom" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("InstanceCustomAlpha", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_custom_alpha"), { "instance_custom_alpha" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("InstanceId", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "instance_id"), { "instance_id" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("ModelMatrix", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "model_matrix"), { "model_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "point_size"), { "point_size" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); - add_options.push_back(AddOption("Screen", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "screen"), { "screen" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("ScreenMatrix", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "screen_matrix"), { "screen_matrix" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_mode, "vertex"), { "vertex" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("VertexId", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "vertex_id"), { "vertex_id" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); - add_options.push_back(AddOption("World", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "world"), { "world" }, VisualShaderNode::PORT_TYPE_TRANSFORM, TYPE_FLAGS_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("AtLightPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "at_light_pass"), { "at_light_pass" }, VisualShaderNode::PORT_TYPE_BOOLEAN, TYPE_FLAGS_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "fragcoord"), { "fragcoord" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_CANVAS_ITEM)); diff --git a/editor/translations/extract.py b/editor/translations/extract.py index dd86bd1c1f..8737eb5204 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -34,12 +34,12 @@ matches.sort() remaps = {} -remap_re = re.compile(r'capitalize_string_remaps\["(.+)"\] = "(.+)";') +remap_re = re.compile(r'^\t*capitalize_string_remaps\["(?P<from>.+)"\] = (String::utf8\()?"(?P<to>.+)"') with open("editor/editor_property_name_processor.cpp") as f: for line in f: m = remap_re.search(line) if m: - remaps[m.group(1)] = m.group(2) + remaps[m.group("from")] = m.group("to") unique_str = [] @@ -70,22 +70,25 @@ class ExtractType(enum.IntEnum): GROUP = 3 -# Regex "(?P<name>(?:[^"\\]|\\.)*)" creates a group named `name` that matches a string. +# Regex "(?P<name>([^"\\]|\\.)*)" creates a group named `name` that matches a string. message_patterns = { - re.compile(r'RTR\("(?P<message>(?:[^"\\]|\\.)*)"(?:, "(?P<context>(?:[^"\\]|\\.)*)")?\)'): ExtractType.TEXT, - re.compile(r'TTR\("(?P<message>(?:[^"\\]|\\.)*)"(?:, "(?P<context>(?:[^"\\]|\\.)*)")?\)'): ExtractType.TEXT, - re.compile(r'TTRC\("(?P<message>(?:[^"\\]|\\.)*)"\)'): ExtractType.TEXT, + re.compile(r'RTR\("(?P<message>([^"\\]|\\.)*)"(, "(?P<context>([^"\\]|\\.)*)")?\)'): ExtractType.TEXT, + re.compile(r'TTR\("(?P<message>([^"\\]|\\.)*)"(, "(?P<context>([^"\\]|\\.)*)")?\)'): ExtractType.TEXT, + re.compile(r'TTRC\("(?P<message>([^"\\]|\\.)*)"\)'): ExtractType.TEXT, re.compile( - r'TTRN\("(?P<message>(?:[^"\\]|\\.)*)", "(?P<plural_message>(?:[^"\\]|\\.)*)",[^,)]+?(?:, "(?P<context>(?:[^"\\]|\\.)*)")?\)' + r'TTRN\("(?P<message>([^"\\]|\\.)*)", "(?P<plural_message>([^"\\]|\\.)*)",[^,)]+?(, "(?P<context>([^"\\]|\\.)*)")?\)' ): ExtractType.TEXT, re.compile( - r'RTRN\("(?P<message>(?:[^"\\]|\\.)*)", "(?P<plural_message>(?:[^"\\]|\\.)*)",[^,)]+?(?:, "(?P<context>(?:[^"\\]|\\.)*)")?\)' + r'RTRN\("(?P<message>([^"\\]|\\.)*)", "(?P<plural_message>([^"\\]|\\.)*)",[^,)]+?(, "(?P<context>([^"\\]|\\.)*)")?\)' ): ExtractType.TEXT, re.compile(r'_initial_set\("(?P<message>[^"]+?)",'): ExtractType.PROPERTY_PATH, - re.compile(r'GLOBAL_DEF(?:_RST)?\("(?P<message>[^".]+?)",'): ExtractType.PROPERTY_PATH, - re.compile(r'EDITOR_DEF(?:_RST)?\("(?P<message>[^"]+?)",'): ExtractType.PROPERTY_PATH, + re.compile(r'GLOBAL_DEF(_RST)?(_NOVAL)?\("(?P<message>[^".]+?)",'): ExtractType.PROPERTY_PATH, + re.compile(r'EDITOR_DEF(_RST)?\("(?P<message>[^"]+?)",'): ExtractType.PROPERTY_PATH, re.compile( - r'ADD_PROPERTY\(PropertyInfo\(Variant::[_A-Z0-9]+, "(?P<message>[^"]+?)"[,)]' + r'(ADD_PROPERTYI?|ImportOption|ExportOption)\(PropertyInfo\(Variant::[_A-Z0-9]+, "(?P<message>[^"]+?)"[,)]' + ): ExtractType.PROPERTY_PATH, + re.compile( + r"(?!#define )LIMPL_PROPERTY(_RANGE)?\(Variant::[_A-Z0-9]+, (?P<message>[^,]+?)," ): ExtractType.PROPERTY_PATH, re.compile(r'ADD_GROUP\("(?P<message>[^"]+?)", "(?P<prefix>[^"]*?)"\)'): ExtractType.GROUP, } diff --git a/main/main.cpp b/main/main.cpp index 6134ad5146..f41fa136ba 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -70,6 +70,7 @@ #include "servers/physics_server_3d.h" #include "servers/register_server_types.h" #include "servers/rendering/rendering_server_default.h" +#include "servers/text/text_server_dummy.h" #include "servers/text_server.h" #include "servers/xr_server.h" @@ -399,6 +400,12 @@ Error Main::test_setup() { translation_server = memnew(TranslationServer); tsman = memnew(TextServerManager); + if (tsman) { + Ref<TextServerDummy> ts; + ts.instantiate(); + tsman->add_interface(ts); + } + register_core_extensions(); // From `Main::setup2()`. @@ -435,7 +442,26 @@ Error Main::test_setup() { initialize_theme(); ERR_FAIL_COND_V(TextServerManager::get_singleton()->get_interface_count() == 0, ERR_CANT_CREATE); - TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(0)); + + /* Use one with the most features available. */ + int max_features = 0; + for (int i = 0; i < TextServerManager::get_singleton()->get_interface_count(); i++) { + uint32_t features = TextServerManager::get_singleton()->get_interface(i)->get_features(); + int feature_number = 0; + while (features) { + feature_number += features & 1; + features >>= 1; + } + if (feature_number >= max_features) { + max_features = feature_number; + text_driver_idx = i; + } + } + if (text_driver_idx >= 0) { + TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx)); + } else { + ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface."); + } ClassDB::set_current_api(ClassDB::API_NONE); @@ -1532,6 +1558,12 @@ error: Error Main::setup2(Thread::ID p_main_tid_override) { tsman = memnew(TextServerManager); + if (tsman) { + Ref<TextServerDummy> ts; + ts.instantiate(); + tsman->add_interface(ts); + } + preregister_module_types(); preregister_server_types(); @@ -1867,8 +1899,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { if (text_driver_idx >= 0) { TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx)); } else { - ERR_PRINT("TextServer: Unable to create TextServer interface."); - return ERR_CANT_CREATE; + ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface."); } MAIN_PRINT("Main: Load Scene Types"); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 326720ce86..af3d65d4d6 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -277,6 +277,7 @@ Error GDScriptAnalyzer::resolve_inheritance(GDScriptParser::ClassNode *p_class, base = parser->get_parser()->head->get_datatype(); } else { if (p_class->extends.is_empty()) { + push_error("Could not resolve an empty super class path.", p_class); return ERR_PARSE_ERROR; } const StringName &name = p_class->extends[extends_index++]; @@ -1124,6 +1125,10 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * GDScriptParser::FunctionNode *previous_function = parser->current_function; parser->current_function = p_function; +#ifdef TOOLS_ENABLED + int default_value_count = 0; +#endif // TOOLS_ENABLED + for (int i = 0; i < p_function->parameters.size(); i++) { resolve_parameter(p_function->parameters[i]); #ifdef DEBUG_ENABLED @@ -1133,8 +1138,12 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * is_shadowing(p_function->parameters[i]->identifier, "function parameter"); #endif // DEBUG_ENABLED #ifdef TOOLS_ENABLED - if (p_function->parameters[i]->default_value && p_function->parameters[i]->default_value->is_constant) { - p_function->default_arg_values.push_back(p_function->parameters[i]->default_value->reduced_value); + if (p_function->parameters[i]->default_value) { + default_value_count++; + + if (p_function->parameters[i]->default_value->is_constant) { + p_function->default_arg_values.push_back(p_function->parameters[i]->default_value->reduced_value); + } } #endif // TOOLS_ENABLED } @@ -1169,7 +1178,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * int par_count_diff = p_function->parameters.size() - parameters_types.size(); valid = valid && par_count_diff >= 0; - valid = valid && p_function->default_arg_values.size() >= default_par_count + par_count_diff; + valid = valid && default_value_count >= default_par_count + par_count_diff; int i = 0; for (const GDScriptParser::DataType &par_type : parameters_types) { @@ -1203,7 +1212,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * push_error(vformat(R"(The function signature doesn't match the parent. Parent signature is "%s".)", parent_signature), p_function); } } -#endif +#endif // TOOLS_ENABLED } parser->current_function = previous_function; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 725b62f6d6..10709d3667 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1380,6 +1380,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali push_completion_call(annotation); make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, 0, true); if (!check(GDScriptTokenizer::Token::PARENTHESIS_CLOSE) && !is_at_end()) { + push_multiline(true); int argument_index = 0; do { make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index, true); @@ -1391,6 +1392,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali } annotation->arguments.push_back(argument); } while (match(GDScriptTokenizer::Token::COMMA)); + pop_multiline(); consume(GDScriptTokenizer::Token::PARENTHESIS_CLOSE, R"*(Expected ")" after annotation arguments.)*"); } @@ -3480,6 +3482,15 @@ template <PropertyHint t_hint, Variant::Type t_type> bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node *p_node) { ERR_FAIL_COND_V_MSG(p_node->type != Node::VARIABLE, false, vformat(R"("%s" annotation can only be applied to variables.)", p_annotation->name)); + { + const int max_flags = 32; + + if (t_hint == PropertyHint::PROPERTY_HINT_FLAGS && p_annotation->resolved_arguments.size() > max_flags) { + push_error(vformat(R"(The argument count limit for "@export_flags" is exceeded (%d/%d).)", p_annotation->resolved_arguments.size(), max_flags), p_annotation); + return false; + } + } + VariableNode *variable = static_cast<VariableNode *>(p_node); if (variable->exported) { push_error(vformat(R"(Annotation "%s" cannot be used with another "@export" annotation.)", p_annotation->name), p_annotation); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 272283432d..eea7ed89cc 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -100,6 +100,9 @@ #define BINDINGS_GENERATOR_VERSION UINT32_C(13) +// Types that will be ignored by the generator and won't be available in C#. +const Vector<String> ignored_types = { "PhysicsServer3DExtension" }; + const char *BindingsGenerator::TypeInterface::DEFAULT_VARARG_C_IN("\t%0 %1_in = %1;\n"); static String fix_doc_description(const String &p_bbcode) { @@ -2645,6 +2648,12 @@ bool BindingsGenerator::_populate_object_type_interfaces() { continue; } + if (ignored_types.has(type_cname)) { + _log("Ignoring type '%s' because it's in the list of ignored types\n", String(type_cname).utf8().get_data()); + class_list.pop_front(); + continue; + } + if (!ClassDB::is_class_exposed(type_cname)) { _log("Ignoring type '%s' because it's not exposed\n", String(type_cname).utf8().get_data()); class_list.pop_front(); diff --git a/modules/text_server_adv/.gitignore b/modules/text_server_adv/.gitignore new file mode 100644 index 0000000000..15cc38b59c --- /dev/null +++ b/modules/text_server_adv/.gitignore @@ -0,0 +1,2 @@ +# Godot-cpp headers +gdextension_build/godot-cpp diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index 5e5c284b57..e999700d55 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -103,6 +103,7 @@ if env["builtin_harfbuzz"]: "src/hb-subset-cff2.cc", "src/hb-subset-input.cc", "src/hb-subset-plan.cc", + "src/hb-subset-repacker.cc", "src/hb-subset.cc", "src/hb-ucd.cc", "src/hb-unicode.cc", @@ -455,6 +456,7 @@ if env["builtin_icu"]: if env_icu["tools"]: env_icu.Depends("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name) env_icu.Command("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name, make_icu_data) + env_text_server_adv.Append(CPPPATH=["#thirdparty/icu4c/"]) else: thirdparty_sources += ["icu_data/icudata_stub.cpp"] diff --git a/modules/text_server_adv/doc_classes/TextServerAdvanced.xml b/modules/text_server_adv/doc_classes/TextServerAdvanced.xml index bf86eb6406..91dde65cb8 100644 --- a/modules/text_server_adv/doc_classes/TextServerAdvanced.xml +++ b/modules/text_server_adv/doc_classes/TextServerAdvanced.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextServerAdvanced" inherits="TextServer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> +<class name="TextServerAdvanced" inherits="TextServerExtension" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> Text Server using HarfBuzz, ICU and SIL Graphite to support BiDi, complex text layouts and contextual OpenType features. </brief_description> diff --git a/modules/text_server_adv/gdextension_build/SConstruct b/modules/text_server_adv/gdextension_build/SConstruct new file mode 100644 index 0000000000..b294fab561 --- /dev/null +++ b/modules/text_server_adv/gdextension_build/SConstruct @@ -0,0 +1,638 @@ +#!/usr/bin/env python +import atexit +import os +import sys +import methods +import time + +# For the reference: +# - CCFLAGS are compilation flags shared between C and C++ +# - CFLAGS are for C-specific compilation flags +# - CXXFLAGS are for C++-specific compilation flags +# - CPPFLAGS are for pre-processor flags +# - CPPDEFINES are for pre-processor defines +# - LINKFLAGS are for linking flags + +time_at_start = time.time() + +env = SConscript("./godot-cpp/SConstruct") +env.__class__.disable_warnings = methods.disable_warnings + +opts = Variables([], ARGUMENTS) +opts.Add(BoolVariable("freetype_enabled", "Use FreeType library", True)) +opts.Add(BoolVariable("msdfgen_enabled", "Use MSDFgen library (require FreeType)", True)) +opts.Add(BoolVariable("graphite_enabled", "Use Graphite library (require FreeType)", True)) +opts.Add(BoolVariable("static_icu_data", "Use built-in ICU data", True)) +opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) + +opts.Update(env) + +if not env["verbose"]: + methods.no_verbose(sys, env) + +if env["platform"] == "windows" and not env["use_mingw"]: + env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding. + +# MSDFGEN +if env["msdfgen_enabled"] and env["freetype_enabled"]: + env_msdfgen = env.Clone() + env_msdfgen.disable_warnings() + + thirdparty_msdfgen_dir = "../../../thirdparty/msdfgen/" + thirdparty_msdfgen_sources = [ + "core/Contour.cpp", + "core/EdgeHolder.cpp", + "core/MSDFErrorCorrection.cpp", + "core/Projection.cpp", + "core/Scanline.cpp", + "core/Shape.cpp", + "core/SignedDistance.cpp", + "core/Vector2.cpp", + "core/contour-combiners.cpp", + "core/edge-coloring.cpp", + "core/edge-segments.cpp", + "core/edge-selectors.cpp", + "core/equation-solver.cpp", + "core/msdf-error-correction.cpp", + "core/msdfgen.cpp", + "core/rasterization.cpp", + "core/render-sdf.cpp", + "core/sdf-error-estimation.cpp", + "core/shape-description.cpp", + ] + thirdparty_msdfgen_sources = [thirdparty_msdfgen_dir + file for file in thirdparty_msdfgen_sources] + + env_msdfgen.Append(CPPPATH=["../../../thirdparty/freetype/include", "../../../thirdparty/msdfgen"]) + env.Append(CPPPATH=["../../../thirdparty/msdfgen"]) + env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"]) + + lib = env_msdfgen.Library( + f'msdfgen_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_msdfgen_sources, + ) + env.Append(LIBS=[lib]) + +# FreeType +if env["freetype_enabled"]: + env_freetype = env.Clone() + env_freetype.disable_warnings() + + thirdparty_freetype_dir = "../../../thirdparty/freetype/" + thirdparty_freetype_sources = [ + "src/autofit/autofit.c", + "src/base/ftbase.c", + "src/base/ftbbox.c", + "src/base/ftbdf.c", + "src/base/ftbitmap.c", + "src/base/ftcid.c", + "src/base/ftdebug.c", + "src/base/ftfstype.c", + "src/base/ftgasp.c", + "src/base/ftglyph.c", + "src/base/ftgxval.c", + "src/base/ftinit.c", + "src/base/ftmm.c", + "src/base/ftotval.c", + "src/base/ftpatent.c", + "src/base/ftpfr.c", + "src/base/ftstroke.c", + "src/base/ftsynth.c", + "src/base/ftsystem.c", + "src/base/fttype1.c", + "src/base/ftwinfnt.c", + "src/bdf/bdf.c", + "src/bzip2/ftbzip2.c", + "src/cache/ftcache.c", + "src/cff/cff.c", + "src/cid/type1cid.c", + "src/gxvalid/gxvalid.c", + "src/gzip/ftgzip.c", + "src/lzw/ftlzw.c", + "src/otvalid/otvalid.c", + "src/pcf/pcf.c", + "src/pfr/pfr.c", + "src/psaux/psaux.c", + "src/pshinter/pshinter.c", + "src/psnames/psnames.c", + "src/raster/raster.c", + "src/sdf/sdf.c", + "src/smooth/smooth.c", + "src/truetype/truetype.c", + "src/type1/type1.c", + "src/type42/type42.c", + "src/winfonts/winfnt.c", + "src/sfnt/sfnt.c", + ] + thirdparty_freetype_sources = [thirdparty_freetype_dir + file for file in thirdparty_freetype_sources] + + thirdparty_png_dir = "../../../thirdparty/libpng/" + thirdparty_png_sources = [ + "png.c", + "pngerror.c", + "pngget.c", + "pngmem.c", + "pngpread.c", + "pngread.c", + "pngrio.c", + "pngrtran.c", + "pngrutil.c", + "pngset.c", + "pngtrans.c", + "pngwio.c", + "pngwrite.c", + "pngwtran.c", + "pngwutil.c", + ] + thirdparty_freetype_sources += [thirdparty_png_dir + file for file in thirdparty_png_sources] + + thirdparty_zlib_dir = "../../../thirdparty/zlib/" + thirdparty_zlib_sources = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + ] + thirdparty_freetype_sources += [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] + + env_freetype.Append(CPPPATH=[thirdparty_freetype_dir + "/include", thirdparty_zlib_dir, thirdparty_png_dir]) + env.Append(CPPPATH=[thirdparty_freetype_dir + "/include"]) + + env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", ("PNG_ARM_NEON_OPT", 0)]) + if env["target"] == "debug": + env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"]) + + env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"]) + + lib = env_freetype.Library( + f'freetype_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_freetype_sources, + ) + env.Append(LIBS=[lib]) + +# HarfBuzz +env_harfbuzz = env.Clone() +env_harfbuzz.disable_warnings() + +thirdparty_harfbuzz_dir = "../../../thirdparty/harfbuzz/" +thirdparty_harfbuzz_sources = [ + "src/hb-aat-layout.cc", + "src/hb-aat-map.cc", + "src/hb-blob.cc", + "src/hb-buffer-serialize.cc", + "src/hb-buffer-verify.cc", + "src/hb-buffer.cc", + "src/hb-common.cc", + #'src/hb-coretext.cc', + #'src/hb-directwrite.cc', + "src/hb-draw.cc", + "src/hb-face.cc", + "src/hb-fallback-shape.cc", + "src/hb-font.cc", + #'src/hb-gdi.cc', + #'src/hb-glib.cc', + #'src/hb-gobject-structs.cc', + "src/hb-icu.cc", + "src/hb-map.cc", + "src/hb-number.cc", + "src/hb-ot-cff1-table.cc", + "src/hb-ot-cff2-table.cc", + "src/hb-ot-color.cc", + "src/hb-ot-face.cc", + "src/hb-ot-font.cc", + "src/hb-ot-layout.cc", + "src/hb-ot-map.cc", + "src/hb-ot-math.cc", + "src/hb-ot-meta.cc", + "src/hb-ot-metrics.cc", + "src/hb-ot-name.cc", + "src/hb-ot-shape-complex-arabic.cc", + "src/hb-ot-shape-complex-default.cc", + "src/hb-ot-shape-complex-hangul.cc", + "src/hb-ot-shape-complex-hebrew.cc", + "src/hb-ot-shape-complex-indic-table.cc", + "src/hb-ot-shape-complex-indic.cc", + "src/hb-ot-shape-complex-khmer.cc", + "src/hb-ot-shape-complex-myanmar.cc", + "src/hb-ot-shape-complex-syllabic.cc", + "src/hb-ot-shape-complex-thai.cc", + "src/hb-ot-shape-complex-use.cc", + "src/hb-ot-shape-complex-vowel-constraints.cc", + "src/hb-ot-shape-fallback.cc", + "src/hb-ot-shape-normalize.cc", + "src/hb-ot-shape.cc", + "src/hb-ot-tag.cc", + "src/hb-ot-var.cc", + "src/hb-set.cc", + "src/hb-shape-plan.cc", + "src/hb-shape.cc", + "src/hb-shaper.cc", + "src/hb-static.cc", + "src/hb-style.cc", + "src/hb-subset-cff-common.cc", + "src/hb-subset-cff1.cc", + "src/hb-subset-cff2.cc", + "src/hb-subset-input.cc", + "src/hb-subset-plan.cc", + "src/hb-subset.cc", + "src/hb-ucd.cc", + "src/hb-unicode.cc", + #'src/hb-uniscribe.cc' +] + +if env["freetype_enabled"]: + thirdparty_harfbuzz_sources += [ + "src/hb-ft.cc", + "src/hb-graphite2.cc", + ] +thirdparty_harfbuzz_sources = [thirdparty_harfbuzz_dir + file for file in thirdparty_harfbuzz_sources] + +env_harfbuzz.Append( + CPPPATH=[ + "../../../thirdparty/harfbuzz/src", + "../../../thirdparty/icu4c/common/", + ] +) + +if env["freetype_enabled"]: + env_harfbuzz.Append( + CPPPATH=[ + "../../../thirdparty/freetype/include", + "../../../thirdparty/graphite/include", + ] + ) + +if env["platform"] == "android" or env["platform"] == "linuxbsd": + env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"]) + +env_harfbuzz.Append( + CCFLAGS=[ + "-DHAVE_ICU_BUILTIN", + "-DHAVE_ICU", + ] +) + +if env["freetype_enabled"]: + env_harfbuzz.Append( + CCFLAGS=[ + "-DHAVE_FREETYPE", + "-DHAVE_GRAPHITE2", + "-DGRAPHITE2_STATIC", + ] + ) + +env.Append(CPPPATH=["../../../thirdparty/harfbuzz/src"]) + +lib = env_harfbuzz.Library( + f'harfbuzz_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_harfbuzz_sources, +) +env.Prepend(LIBS=[lib]) + +# Graphite +if env["graphite_enabled"] and env["freetype_enabled"]: + env_graphite = env.Clone() + env_graphite.disable_warnings() + + thirdparty_graphite_dir = "../../../thirdparty/graphite/" + thirdparty_graphite_sources = [ + "src/gr_char_info.cpp", + "src/gr_face.cpp", + "src/gr_features.cpp", + "src/gr_font.cpp", + "src/gr_logging.cpp", + "src/gr_segment.cpp", + "src/gr_slot.cpp", + "src/CmapCache.cpp", + "src/Code.cpp", + "src/Collider.cpp", + "src/Decompressor.cpp", + "src/Face.cpp", + #'src/FileFace.cpp', + "src/FeatureMap.cpp", + "src/Font.cpp", + "src/GlyphCache.cpp", + "src/GlyphFace.cpp", + "src/Intervals.cpp", + "src/Justifier.cpp", + "src/NameTable.cpp", + "src/Pass.cpp", + "src/Position.cpp", + "src/Segment.cpp", + "src/Silf.cpp", + "src/Slot.cpp", + "src/Sparse.cpp", + "src/TtfUtil.cpp", + "src/UtfCodec.cpp", + "src/FileFace.cpp", + "src/json.cpp", + ] + if env["platform"] != "windows" or env["use_mingw"]: + thirdparty_graphite_sources += ["src/direct_machine.cpp"] + else: + thirdparty_graphite_sources += ["src/call_machine.cpp"] + + thirdparty_graphite_sources = [thirdparty_graphite_dir + file for file in thirdparty_graphite_sources] + + env_graphite.Append(CPPPATH=["../../../thirdparty/graphite/src", "../../../thirdparty/graphite/include"]) + env_graphite.Append( + CCFLAGS=[ + "-DGRAPHITE2_STATIC", + "-DGRAPHITE2_NTRACING", + "-DGRAPHITE2_NFILEFACE", + ] + ) + + lib = env_graphite.Library( + f'graphite_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_graphite_sources, + ) + env.Append(LIBS=[lib]) + +# ICU +env_icu = env.Clone() +env_icu.disable_warnings() + +thirdparty_icu_dir = "../../../thirdparty/icu4c/" +thirdparty_icu_sources = [ + "common/appendable.cpp", + "common/bmpset.cpp", + "common/brkeng.cpp", + "common/brkiter.cpp", + "common/bytesinkutil.cpp", + "common/bytestream.cpp", + "common/bytestrie.cpp", + "common/bytestriebuilder.cpp", + "common/bytestrieiterator.cpp", + "common/caniter.cpp", + "common/characterproperties.cpp", + "common/chariter.cpp", + "common/charstr.cpp", + "common/cmemory.cpp", + "common/cstr.cpp", + "common/cstring.cpp", + "common/cwchar.cpp", + "common/dictbe.cpp", + "common/dictionarydata.cpp", + "common/dtintrv.cpp", + "common/edits.cpp", + "common/emojiprops.cpp", + "common/errorcode.cpp", + "common/filteredbrk.cpp", + "common/filterednormalizer2.cpp", + "common/icudataver.cpp", + "common/icuplug.cpp", + "common/loadednormalizer2impl.cpp", + "common/localebuilder.cpp", + "common/localematcher.cpp", + "common/localeprioritylist.cpp", + "common/locavailable.cpp", + "common/locbased.cpp", + "common/locdispnames.cpp", + "common/locdistance.cpp", + "common/locdspnm.cpp", + "common/locid.cpp", + "common/loclikely.cpp", + "common/loclikelysubtags.cpp", + "common/locmap.cpp", + "common/locresdata.cpp", + "common/locutil.cpp", + "common/lsr.cpp", + "common/lstmbe.cpp", + "common/messagepattern.cpp", + "common/normalizer2.cpp", + "common/normalizer2impl.cpp", + "common/normlzr.cpp", + "common/parsepos.cpp", + "common/patternprops.cpp", + "common/pluralmap.cpp", + "common/propname.cpp", + "common/propsvec.cpp", + "common/punycode.cpp", + "common/putil.cpp", + "common/rbbi.cpp", + "common/rbbi_cache.cpp", + "common/rbbidata.cpp", + "common/rbbinode.cpp", + "common/rbbirb.cpp", + "common/rbbiscan.cpp", + "common/rbbisetb.cpp", + "common/rbbistbl.cpp", + "common/rbbitblb.cpp", + "common/resbund.cpp", + "common/resbund_cnv.cpp", + "common/resource.cpp", + "common/restrace.cpp", + "common/ruleiter.cpp", + "common/schriter.cpp", + "common/serv.cpp", + "common/servlk.cpp", + "common/servlkf.cpp", + "common/servls.cpp", + "common/servnotf.cpp", + "common/servrbf.cpp", + "common/servslkf.cpp", + "common/sharedobject.cpp", + "common/simpleformatter.cpp", + "common/static_unicode_sets.cpp", + "common/stringpiece.cpp", + "common/stringtriebuilder.cpp", + "common/uarrsort.cpp", + "common/ubidi.cpp", + "common/ubidi_props.cpp", + "common/ubidiln.cpp", + "common/ubiditransform.cpp", + "common/ubidiwrt.cpp", + "common/ubrk.cpp", + "common/ucase.cpp", + "common/ucasemap.cpp", + "common/ucasemap_titlecase_brkiter.cpp", + "common/ucat.cpp", + "common/uchar.cpp", + "common/ucharstrie.cpp", + "common/ucharstriebuilder.cpp", + "common/ucharstrieiterator.cpp", + "common/uchriter.cpp", + "common/ucln_cmn.cpp", + "common/ucmndata.cpp", + "common/ucnv.cpp", + "common/ucnv2022.cpp", + "common/ucnv_bld.cpp", + "common/ucnv_cb.cpp", + "common/ucnv_cnv.cpp", + "common/ucnv_ct.cpp", + "common/ucnv_err.cpp", + "common/ucnv_ext.cpp", + "common/ucnv_io.cpp", + "common/ucnv_lmb.cpp", + "common/ucnv_set.cpp", + "common/ucnv_u16.cpp", + "common/ucnv_u32.cpp", + "common/ucnv_u7.cpp", + "common/ucnv_u8.cpp", + "common/ucnvbocu.cpp", + "common/ucnvdisp.cpp", + "common/ucnvhz.cpp", + "common/ucnvisci.cpp", + "common/ucnvlat1.cpp", + "common/ucnvmbcs.cpp", + "common/ucnvscsu.cpp", + "common/ucnvsel.cpp", + "common/ucol_swp.cpp", + "common/ucptrie.cpp", + "common/ucurr.cpp", + "common/udata.cpp", + "common/udatamem.cpp", + "common/udataswp.cpp", + "common/uenum.cpp", + "common/uhash.cpp", + "common/uhash_us.cpp", + "common/uidna.cpp", + "common/uinit.cpp", + "common/uinvchar.cpp", + "common/uiter.cpp", + "common/ulist.cpp", + "common/uloc.cpp", + "common/uloc_keytype.cpp", + "common/uloc_tag.cpp", + "common/umapfile.cpp", + "common/umath.cpp", + "common/umutablecptrie.cpp", + "common/umutex.cpp", + "common/unames.cpp", + "common/unifiedcache.cpp", + "common/unifilt.cpp", + "common/unifunct.cpp", + "common/uniset.cpp", + "common/uniset_closure.cpp", + "common/uniset_props.cpp", + "common/unisetspan.cpp", + "common/unistr.cpp", + "common/unistr_case.cpp", + "common/unistr_case_locale.cpp", + "common/unistr_cnv.cpp", + "common/unistr_props.cpp", + "common/unistr_titlecase_brkiter.cpp", + "common/unorm.cpp", + "common/unormcmp.cpp", + "common/uobject.cpp", + "common/uprops.cpp", + "common/ures_cnv.cpp", + "common/uresbund.cpp", + "common/uresdata.cpp", + "common/usc_impl.cpp", + "common/uscript.cpp", + "common/uscript_props.cpp", + "common/uset.cpp", + "common/uset_props.cpp", + "common/usetiter.cpp", + # "common/ushape.cpp", + "common/usprep.cpp", + "common/ustack.cpp", + "common/ustr_cnv.cpp", + "common/ustr_titlecase_brkiter.cpp", + "common/ustr_wcs.cpp", + "common/ustrcase.cpp", + "common/ustrcase_locale.cpp", + "common/ustrenum.cpp", + "common/ustrfmt.cpp", + "common/ustring.cpp", + "common/ustrtrns.cpp", + "common/utext.cpp", + "common/utf_impl.cpp", + "common/util.cpp", + "common/util_props.cpp", + "common/utrace.cpp", + "common/utrie.cpp", + "common/utrie2.cpp", + "common/utrie2_builder.cpp", + "common/utrie_swap.cpp", + "common/uts46.cpp", + "common/utypes.cpp", + "common/uvector.cpp", + "common/uvectr32.cpp", + "common/uvectr64.cpp", + "common/wintz.cpp", +] +thirdparty_icu_sources = [thirdparty_icu_dir + file for file in thirdparty_icu_sources] + +icu_data_name = "icudt70l.dat" + +if env["static_icu_data"]: + env_icu.Depends("../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/" + icu_data_name) + env_icu.Command( + "../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/" + icu_data_name, methods.make_icu_data + ) + env.Append(CXXFLAGS=["-DICU_STATIC_DATA"]) + env.Append(CPPPATH=["../../../thirdparty/icu4c/"]) +else: + thirdparty_sources += ["../icu_data/icudata_stub.cpp"] + +env_icu.Append(CPPPATH=["../../../thirdparty/icu4c/common/"]) +env_icu.Append( + CXXFLAGS=[ + "-DU_STATIC_IMPLEMENTATION", + "-DU_COMMON_IMPLEMENTATION", + "-DUCONFIG_NO_COLLATION", + "-DUCONFIG_NO_CONVERSION", + "-DUCONFIG_NO_FORMATTING", + "-DUCONFIG_NO_SERVICE", + "-DUCONFIG_NO_IDNA", + "-DUCONFIG_NO_FILE_IO", + "-DUCONFIG_NO_TRANSLITERATION", + "-DPKGDATA_MODE=static", + "-DICU_DATA_NAME=" + icu_data_name, + ] +) +env.Append( + CXXFLAGS=[ + "-DICU_DATA_NAME=" + icu_data_name, + ] +) +env.Append(CPPPATH=["../../../thirdparty/icu4c/common/"]) + +if env["platform"] == "windows": + env.Append(LIBS=["advapi32"]) + +lib = env_icu.Library( + f'icu_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', thirdparty_icu_sources +) +env.Append(LIBS=[lib]) + +env.Append(CPPDEFINES=["GDEXTENSION"]) +env.Append(CPPPATH=["../"]) +sources = Glob("../*.cpp") + +if env["platform"] == "osx": + methods.write_osx_plist( + f'./bin/libtextserver_advanced.osx.{env["target"]}.framework', + f'libtextserver_advanced.osx.{env["target"]}', + "org.godotengine.textserver_advanced", + "ICU / HarfBuzz / Graphite Text Server", + ) + library = env.SharedLibrary( + f'./bin/libtextserver_advanced.osx.{env["target"]}.framework/libtextserver_advanced.osx.{env["target"]}', + source=sources, + ) +else: + library = env.SharedLibrary( + f'./bin/libtextserver_advanced.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["SHLIBSUFFIX"]}', + source=sources, + ) + +Default(library) + + +def print_elapsed_time(): + elapsed_time_sec = round(time.time() - time_at_start, 3) + time_ms = round((elapsed_time_sec % 1) * 1000) + print("[Time elapsed: {}.{:03}]".format(time.strftime("%H:%M:%S", time.gmtime(elapsed_time_sec)), time_ms)) + + +atexit.register(print_elapsed_time) diff --git a/modules/text_server_adv/gdextension_build/methods.py b/modules/text_server_adv/gdextension_build/methods.py new file mode 100644 index 0000000000..d404f2851e --- /dev/null +++ b/modules/text_server_adv/gdextension_build/methods.py @@ -0,0 +1,130 @@ +import os +import sys + + +def no_verbose(sys, env): + colors = {} + + # Colors are disabled in non-TTY environments such as pipes. This means + # that if output is redirected to a file, it will not contain color codes + if sys.stdout.isatty(): + colors["blue"] = "\033[0;94m" + colors["bold_blue"] = "\033[1;94m" + colors["reset"] = "\033[0m" + else: + colors["blue"] = "" + colors["bold_blue"] = "" + colors["reset"] = "" + + # There is a space before "..." to ensure that source file names can be + # Ctrl + clicked in the VS Code terminal. + compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + java_compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + compile_shared_source_message = "{}Compiling shared {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_program_message = "{}Linking Program {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_library_message = "{}Linking Static Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + ranlib_library_message = "{}Ranlib Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_shared_library_message = "{}Linking Shared Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + + env.Append(CXXCOMSTR=[compile_source_message]) + env.Append(CCCOMSTR=[compile_source_message]) + env.Append(SHCCCOMSTR=[compile_shared_source_message]) + env.Append(SHCXXCOMSTR=[compile_shared_source_message]) + env.Append(ARCOMSTR=[link_library_message]) + env.Append(RANLIBCOMSTR=[ranlib_library_message]) + env.Append(SHLINKCOMSTR=[link_shared_library_message]) + env.Append(LINKCOMSTR=[link_program_message]) + env.Append(JARCOMSTR=[java_library_message]) + env.Append(JAVACCOMSTR=[java_compile_source_message]) + + +def disable_warnings(self): + # 'self' is the environment + if self["platform"] == "windows" and not self["use_mingw"]: + # We have to remove existing warning level defines before appending /w, + # otherwise we get: "warning D9025 : overriding '/W3' with '/w'" + warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"] + self.Append(CCFLAGS=["/w"]) + self.Append(CFLAGS=["/w"]) + self.Append(CXXFLAGS=["/w"]) + self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags] + self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags] + self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags] + else: + self.Append(CCFLAGS=["-w"]) + self.Append(CFLAGS=["-w"]) + self.Append(CXXFLAGS=["-w"]) + + +def make_icu_data(target, source, env): + dst = target[0].srcnode().abspath + g = open(dst, "w", encoding="utf-8") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n") + g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n") + g.write("#ifndef _ICU_DATA_H\n") + g.write("#define _ICU_DATA_H\n") + g.write('#include "unicode/utypes.h"\n') + g.write('#include "unicode/udata.h"\n') + g.write('#include "unicode/uversion.h"\n') + + f = open(source[0].srcnode().abspath, "rb") + buf = f.read() + + g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n") + g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n') + for i in range(len(buf)): + g.write("\t" + str(buf[i]) + ",\n") + + g.write("};\n") + g.write("#endif") + + +def write_osx_plist(target, binary_name, identifier, name): + os.makedirs(f"{target}/Resourece/", exist_ok=True) + f = open(f"{target}/Resourece/Info.plist", "w") + + f.write(f'<?xml version="1.0" encoding="UTF-8"?>\n') + f.write(f'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n') + f.write(f'<plist version="1.0">\n') + f.write(f"<dict>\n") + f.write(f"\t<key>CFBundleExecutable</key>\n") + f.write(f"\t<string>{binary_name}</string>\n") + f.write(f"\t<key>CFBundleIdentifier</key>\n") + f.write(f"\t<string>{identifier}</string>\n") + f.write(f"\t<key>CFBundleInfoDictionaryVersion</key>\n") + f.write(f"\t<string>6.0</string>\n") + f.write(f"\t<key>CFBundleName</key>\n") + f.write(f"\t<string>{name}</string>\n") + f.write(f"\t<key>CFBundlePackageType</key>\n") + f.write(f"\t<string>FMWK</string>\n") + f.write(f"\t<key>CFBundleShortVersionString</key>\n") + f.write(f"\t<string>1.0.0</string>\n") + f.write(f"\t<key>CFBundleSupportedPlatforms</key>\n") + f.write(f"\t<array>\n") + f.write(f"\t\t<string>MacOSX</string>\n") + f.write(f"\t</array>\n") + f.write(f"\t<key>CFBundleVersion</key>\n") + f.write(f"\t<string>1.0.0</string>\n") + f.write(f"\t<key>LSMinimumSystemVersion</key>\n") + f.write(f"\t<string>10.14</string>\n") + f.write(f"</dict>\n") + f.write(f"</plist>\n") diff --git a/modules/text_server_adv/gdextension_build/text_server_adv.gdextension b/modules/text_server_adv/gdextension_build/text_server_adv.gdextension new file mode 100644 index 0000000000..5956476a5e --- /dev/null +++ b/modules/text_server_adv/gdextension_build/text_server_adv.gdextension @@ -0,0 +1,12 @@ +[configuration] + +entry_symbol = "textserver_advanced_init" + +[libraries] + +linux.64.debug = "bin/libtextserver_advanced.linux.debug.64.so" +linux.64.release = "bin/libtextserver_advanced.linux.release.64.so" +windows.64.debug = "bin/libtextserver_advanced.windows.debug.64.dll" +windows.64.release = "bin/libtextserver_advanced.windows.release.64.dll" +macos.debug = "bin/libtextserver_advanced.osx.debug.framework" +macos.release = "bin/libtextserver_advanced.osx.release.framework" diff --git a/modules/text_server_adv/register_types.cpp b/modules/text_server_adv/register_types.cpp index d2dbfa045b..ed00bdfbf9 100644 --- a/modules/text_server_adv/register_types.cpp +++ b/modules/text_server_adv/register_types.cpp @@ -34,10 +34,11 @@ void preregister_text_server_adv_types() { GDREGISTER_CLASS(TextServerAdvanced); - if (TextServerManager::get_singleton()) { + TextServerManager *tsman = TextServerManager::get_singleton(); + if (tsman) { Ref<TextServerAdvanced> ts; ts.instantiate(); - TextServerManager::get_singleton()->add_interface(ts); + tsman->add_interface(ts); } } @@ -46,3 +47,26 @@ void register_text_server_adv_types() { void unregister_text_server_adv_types() { } + +#ifdef GDEXTENSION + +#include <godot_cpp/core/class_db.hpp> +#include <godot_cpp/core/defs.hpp> +#include <godot_cpp/core/memory.hpp> + +using namespace godot; + +extern "C" { + +GDNativeBool GDN_EXPORT textserver_advanced_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) { + GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); + + init_obj.register_server_initializer(&preregister_text_server_adv_types); + init_obj.register_server_terminator(&unregister_text_server_adv_types); + + return init_obj.init(); +} + +} // ! extern "C" + +#endif // ! GDEXTENSION diff --git a/modules/text_server_adv/script_iterator.h b/modules/text_server_adv/script_iterator.h index 1e11b51521..2bd045b91a 100644 --- a/modules/text_server_adv/script_iterator.h +++ b/modules/text_server_adv/script_iterator.h @@ -31,7 +31,22 @@ #ifndef SCRIPT_ITERATOR_H #define SCRIPT_ITERATOR_H -#include "servers/text_server.h" +#ifdef GDEXTENSION + +// Headers for building as GDExtension plug-in. +#include <godot_cpp/godot.hpp> +#include <godot_cpp/templates/vector.hpp> +#include <godot_cpp/variant/string.hpp> + +using namespace godot; + +#else + +// Headers for building as built-in module. +#include "core/string/ustring.h" +#include "core/templates/vector.h" + +#endif #include <unicode/uchar.h> #include <unicode/uloc.h> diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 7fd9cd42ed..b5912893b1 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -30,15 +30,37 @@ #include "text_server_adv.h" +#ifdef GDEXTENSION +// Headers for building as GDExtension plug-in. + +#include <godot_cpp/classes/file.hpp> +#include <godot_cpp/classes/rendering_server.hpp> +#include <godot_cpp/classes/translation_server.hpp> +#include <godot_cpp/core/error_macros.hpp> + +using namespace godot; + +#else +// Headers for building as built-in module. + +#include "core/core_bind.h" #include "core/error/error_macros.h" #include "core/string/print_string.h" #include "core/string/translation.h" +#include "modules/modules_enabled.gen.h" // For freetype, msdfgen. + +using namespace core_bind; + +#endif + +// Built-in ICU data. + #ifdef ICU_STATIC_DATA -#include "thirdparty/icu4c/icudata.gen.h" +#include "icudata.gen.h" #endif -#include "modules/modules_enabled.gen.h" // For freetype, msdfgen. +// Thirdparty headers. #ifdef MODULE_MSDFGEN_ENABLED #include "core/ShapeDistanceFinder.h" @@ -79,8 +101,8 @@ hb_bool_t TextServerAdvanced::_bmp_get_nominal_glyph(hb_font_t *p_font, void *p_ } if (!bm_font->face->glyph_map.has(p_unicode)) { - if (bm_font->face->glyph_map.has(0xF000u + p_unicode)) { - *r_glyph = 0xF000u + p_unicode; + if (bm_font->face->glyph_map.has(0xf000u + p_unicode)) { + *r_glyph = 0xf000u + p_unicode; return true; } else { return false; @@ -305,22 +327,52 @@ _FORCE_INLINE_ bool is_connected_to_prev(char32_t p_chr, char32_t p_pchr) { /*************************************************************************/ -String TextServerAdvanced::interface_name = "ICU / HarfBuzz / Graphite"; -uint32_t TextServerAdvanced::interface_features = FEATURE_BIDI_LAYOUT | FEATURE_VERTICAL_LAYOUT | FEATURE_SHAPING | FEATURE_KASHIDA_JUSTIFICATION | FEATURE_BREAK_ITERATORS | FEATURE_USE_SUPPORT_DATA | FEATURE_FONT_VARIABLE | FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION; - bool TextServerAdvanced::has_feature(Feature p_feature) const { - return (interface_features & p_feature) == p_feature; + switch (p_feature) { + case FEATURE_SIMPLE_LAYOUT: + case FEATURE_BIDI_LAYOUT: + case FEATURE_VERTICAL_LAYOUT: + case FEATURE_SHAPING: + case FEATURE_KASHIDA_JUSTIFICATION: + case FEATURE_BREAK_ITERATORS: + case FEATURE_FONT_BITMAP: +#ifdef MODULE_FREETYPE_ENABLED + case FEATURE_FONT_DYNAMIC: +#endif +#ifdef MODULE_MSDFGEN_ENABLED + case FEATURE_FONT_MSDF: +#endif + case FEATURE_FONT_VARIABLE: + case FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION: + case FEATURE_USE_SUPPORT_DATA: + return true; + default: { + } + } + return false; } String TextServerAdvanced::get_name() const { - return interface_name; +#ifdef GDEXTENSION + return "ICU / HarfBuzz / Graphite (GDExtension)"; +#else + return "ICU / HarfBuzz / Graphite (Built-in)"; +#endif } -uint32_t TextServerAdvanced::get_features() const { +int64_t TextServerAdvanced::get_features() const { + int64_t interface_features = FEATURE_SIMPLE_LAYOUT | FEATURE_BIDI_LAYOUT | FEATURE_VERTICAL_LAYOUT | FEATURE_SHAPING | FEATURE_KASHIDA_JUSTIFICATION | FEATURE_BREAK_ITERATORS | FEATURE_FONT_BITMAP | FEATURE_FONT_VARIABLE | FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION | FEATURE_USE_SUPPORT_DATA; +#ifdef MODULE_FREETYPE_ENABLED + interface_features |= FEATURE_FONT_DYNAMIC; +#endif +#ifdef MODULE_MSDFGEN_ENABLED + interface_features |= FEATURE_FONT_MSDF; +#endif + return interface_features; } -void TextServerAdvanced::free(RID p_rid) { +void TextServerAdvanced::free_rid(const RID &p_rid) { _THREAD_SAFE_METHOD_ if (font_owner.owns(p_rid)) { FontDataAdvanced *fd = font_owner.get_or_null(p_rid); @@ -333,7 +385,7 @@ void TextServerAdvanced::free(RID p_rid) { } } -bool TextServerAdvanced::has(RID p_rid) { +bool TextServerAdvanced::has(const RID &p_rid) { _THREAD_SAFE_METHOD_ return font_owner.owns(p_rid) || shaped_owner.owns(p_rid); } @@ -342,43 +394,36 @@ bool TextServerAdvanced::load_support_data(const String &p_filename) { _THREAD_SAFE_METHOD_ #ifdef ICU_STATIC_DATA - if (icu_data == nullptr) { + if (!icu_data_loaded) { UErrorCode err = U_ZERO_ERROR; u_init(&err); // Do not check for errors, since we only load part of the data. - icu_data = (uint8_t *)&U_ICUDATA_ENTRY_POINT; + icu_data_loaded = true; } #else - if (icu_data == nullptr) { + if (!icu_data_loaded) { String filename = (p_filename.is_empty()) ? String("res://") + _MKSTR(ICU_DATA_NAME) : p_filename; - FileAccess *f = FileAccess::open(filename, FileAccess::READ); - if (!f) { + Ref<File> f; + f.instantiate(); + if (f->open(filename, File::READ) != OK) { return false; } - - UErrorCode err = U_ZERO_ERROR; - - // ICU data found. uint64_t len = f->get_length(); - icu_data = (uint8_t *)memalloc(len); - f->get_buffer(icu_data, len); + PackedByteArray icu_data = f->get_buffer(len); f->close(); - memdelete(f); - udata_setCommonData(icu_data, &err); + UErrorCode err = U_ZERO_ERROR; + udata_setCommonData(icu_data.ptr(), &err); if (U_FAILURE(err)) { - memfree(icu_data); - icu_data = nullptr; ERR_FAIL_V_MSG(false, u_errorName(err)); } err = U_ZERO_ERROR; u_init(&err); if (U_FAILURE(err)) { - memfree(icu_data); - icu_data = nullptr; ERR_FAIL_V_MSG(false, u_errorName(err)); } + icu_data_loaded = true; } #endif return true; @@ -405,13 +450,18 @@ bool TextServerAdvanced::save_support_data(const String &p_filename) const { #ifdef ICU_STATIC_DATA // Store data to the res file if it's available. - FileAccess *f = FileAccess::open(p_filename, FileAccess::WRITE); - if (!f) { + + Ref<File> f; + f.instantiate(); + if (f->open(p_filename, File::WRITE) != OK) { return false; } - f->store_buffer(U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE); + + PackedByteArray icu_data; + icu_data.resize(U_ICUDATA_SIZE); + memcpy(icu_data.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE); + f->store_buffer(icu_data); f->close(); - memdelete(f); return true; #else @@ -428,256 +478,262 @@ bool TextServerAdvanced::is_locale_right_to_left(const String &p_locale) const { } } +_FORCE_INLINE_ void TextServerAdvanced::_insert_feature(const StringName &p_name, int32_t p_tag) { + feature_sets.insert(p_name, p_tag); + feature_sets_inv.insert(p_tag, p_name); +} + void TextServerAdvanced::_insert_feature_sets() { // Registered OpenType feature tags. - feature_sets.insert("access_all_alternates", HB_TAG('a', 'a', 'l', 't')); - feature_sets.insert("above_base_forms", HB_TAG('a', 'b', 'v', 'f')); - feature_sets.insert("above_base_mark_positioning", HB_TAG('a', 'b', 'v', 'm')); - feature_sets.insert("above_base_substitutions", HB_TAG('a', 'b', 'v', 's')); - feature_sets.insert("alternative_fractions", HB_TAG('a', 'f', 'r', 'c')); - feature_sets.insert("akhands", HB_TAG('a', 'k', 'h', 'n')); - feature_sets.insert("below_base_forms", HB_TAG('b', 'l', 'w', 'f')); - feature_sets.insert("below_base_mark_positioning", HB_TAG('b', 'l', 'w', 'm')); - feature_sets.insert("below_base_substitutions", HB_TAG('b', 'l', 'w', 's')); - feature_sets.insert("contextual_alternates", HB_TAG('c', 'a', 'l', 't')); - feature_sets.insert("case_sensitive_forms", HB_TAG('c', 'a', 's', 'e')); - feature_sets.insert("glyph_composition", HB_TAG('c', 'c', 'm', 'p')); - feature_sets.insert("conjunct_form_after_ro", HB_TAG('c', 'f', 'a', 'r')); - feature_sets.insert("conjunct_forms", HB_TAG('c', 'j', 'c', 't')); - feature_sets.insert("contextual_ligatures", HB_TAG('c', 'l', 'i', 'g')); - feature_sets.insert("centered_cjk_punctuation", HB_TAG('c', 'p', 'c', 't')); - feature_sets.insert("capital_spacing", HB_TAG('c', 'p', 's', 'p')); - feature_sets.insert("contextual_swash", HB_TAG('c', 's', 'w', 'h')); - feature_sets.insert("cursive_positioning", HB_TAG('c', 'u', 'r', 's')); - feature_sets.insert("character_variant_01", HB_TAG('c', 'v', '0', '1')); - feature_sets.insert("character_variant_02", HB_TAG('c', 'v', '0', '2')); - feature_sets.insert("character_variant_03", HB_TAG('c', 'v', '0', '3')); - feature_sets.insert("character_variant_04", HB_TAG('c', 'v', '0', '4')); - feature_sets.insert("character_variant_05", HB_TAG('c', 'v', '0', '5')); - feature_sets.insert("character_variant_06", HB_TAG('c', 'v', '0', '6')); - feature_sets.insert("character_variant_07", HB_TAG('c', 'v', '0', '7')); - feature_sets.insert("character_variant_08", HB_TAG('c', 'v', '0', '8')); - feature_sets.insert("character_variant_09", HB_TAG('c', 'v', '0', '9')); - feature_sets.insert("character_variant_10", HB_TAG('c', 'v', '1', '0')); - feature_sets.insert("character_variant_11", HB_TAG('c', 'v', '1', '1')); - feature_sets.insert("character_variant_12", HB_TAG('c', 'v', '1', '2')); - feature_sets.insert("character_variant_13", HB_TAG('c', 'v', '1', '3')); - feature_sets.insert("character_variant_14", HB_TAG('c', 'v', '1', '4')); - feature_sets.insert("character_variant_15", HB_TAG('c', 'v', '1', '5')); - feature_sets.insert("character_variant_16", HB_TAG('c', 'v', '1', '6')); - feature_sets.insert("character_variant_17", HB_TAG('c', 'v', '1', '7')); - feature_sets.insert("character_variant_18", HB_TAG('c', 'v', '1', '8')); - feature_sets.insert("character_variant_19", HB_TAG('c', 'v', '1', '9')); - feature_sets.insert("character_variant_20", HB_TAG('c', 'v', '2', '0')); - feature_sets.insert("character_variant_21", HB_TAG('c', 'v', '2', '1')); - feature_sets.insert("character_variant_22", HB_TAG('c', 'v', '2', '2')); - feature_sets.insert("character_variant_23", HB_TAG('c', 'v', '2', '3')); - feature_sets.insert("character_variant_24", HB_TAG('c', 'v', '2', '4')); - feature_sets.insert("character_variant_25", HB_TAG('c', 'v', '2', '5')); - feature_sets.insert("character_variant_26", HB_TAG('c', 'v', '2', '6')); - feature_sets.insert("character_variant_27", HB_TAG('c', 'v', '2', '7')); - feature_sets.insert("character_variant_28", HB_TAG('c', 'v', '2', '8')); - feature_sets.insert("character_variant_29", HB_TAG('c', 'v', '2', '9')); - feature_sets.insert("character_variant_30", HB_TAG('c', 'v', '3', '0')); - feature_sets.insert("character_variant_31", HB_TAG('c', 'v', '3', '1')); - feature_sets.insert("character_variant_32", HB_TAG('c', 'v', '3', '2')); - feature_sets.insert("character_variant_33", HB_TAG('c', 'v', '3', '3')); - feature_sets.insert("character_variant_34", HB_TAG('c', 'v', '3', '4')); - feature_sets.insert("character_variant_35", HB_TAG('c', 'v', '3', '5')); - feature_sets.insert("character_variant_36", HB_TAG('c', 'v', '3', '6')); - feature_sets.insert("character_variant_37", HB_TAG('c', 'v', '3', '7')); - feature_sets.insert("character_variant_38", HB_TAG('c', 'v', '3', '8')); - feature_sets.insert("character_variant_39", HB_TAG('c', 'v', '3', '9')); - feature_sets.insert("character_variant_40", HB_TAG('c', 'v', '4', '0')); - feature_sets.insert("character_variant_41", HB_TAG('c', 'v', '4', '1')); - feature_sets.insert("character_variant_42", HB_TAG('c', 'v', '4', '2')); - feature_sets.insert("character_variant_43", HB_TAG('c', 'v', '4', '3')); - feature_sets.insert("character_variant_44", HB_TAG('c', 'v', '4', '4')); - feature_sets.insert("character_variant_45", HB_TAG('c', 'v', '4', '5')); - feature_sets.insert("character_variant_46", HB_TAG('c', 'v', '4', '6')); - feature_sets.insert("character_variant_47", HB_TAG('c', 'v', '4', '7')); - feature_sets.insert("character_variant_48", HB_TAG('c', 'v', '4', '8')); - feature_sets.insert("character_variant_49", HB_TAG('c', 'v', '4', '9')); - feature_sets.insert("character_variant_50", HB_TAG('c', 'v', '5', '0')); - feature_sets.insert("character_variant_51", HB_TAG('c', 'v', '5', '1')); - feature_sets.insert("character_variant_52", HB_TAG('c', 'v', '5', '2')); - feature_sets.insert("character_variant_53", HB_TAG('c', 'v', '5', '3')); - feature_sets.insert("character_variant_54", HB_TAG('c', 'v', '5', '4')); - feature_sets.insert("character_variant_55", HB_TAG('c', 'v', '5', '5')); - feature_sets.insert("character_variant_56", HB_TAG('c', 'v', '5', '6')); - feature_sets.insert("character_variant_57", HB_TAG('c', 'v', '5', '7')); - feature_sets.insert("character_variant_58", HB_TAG('c', 'v', '5', '8')); - feature_sets.insert("character_variant_59", HB_TAG('c', 'v', '5', '9')); - feature_sets.insert("character_variant_60", HB_TAG('c', 'v', '6', '0')); - feature_sets.insert("character_variant_61", HB_TAG('c', 'v', '6', '1')); - feature_sets.insert("character_variant_62", HB_TAG('c', 'v', '6', '2')); - feature_sets.insert("character_variant_63", HB_TAG('c', 'v', '6', '3')); - feature_sets.insert("character_variant_64", HB_TAG('c', 'v', '6', '4')); - feature_sets.insert("character_variant_65", HB_TAG('c', 'v', '6', '5')); - feature_sets.insert("character_variant_66", HB_TAG('c', 'v', '6', '6')); - feature_sets.insert("character_variant_67", HB_TAG('c', 'v', '6', '7')); - feature_sets.insert("character_variant_68", HB_TAG('c', 'v', '6', '8')); - feature_sets.insert("character_variant_69", HB_TAG('c', 'v', '6', '9')); - feature_sets.insert("character_variant_70", HB_TAG('c', 'v', '7', '0')); - feature_sets.insert("character_variant_71", HB_TAG('c', 'v', '7', '1')); - feature_sets.insert("character_variant_72", HB_TAG('c', 'v', '7', '2')); - feature_sets.insert("character_variant_73", HB_TAG('c', 'v', '7', '3')); - feature_sets.insert("character_variant_74", HB_TAG('c', 'v', '7', '4')); - feature_sets.insert("character_variant_75", HB_TAG('c', 'v', '7', '5')); - feature_sets.insert("character_variant_76", HB_TAG('c', 'v', '7', '6')); - feature_sets.insert("character_variant_77", HB_TAG('c', 'v', '7', '7')); - feature_sets.insert("character_variant_78", HB_TAG('c', 'v', '7', '8')); - feature_sets.insert("character_variant_79", HB_TAG('c', 'v', '7', '9')); - feature_sets.insert("character_variant_80", HB_TAG('c', 'v', '8', '0')); - feature_sets.insert("character_variant_81", HB_TAG('c', 'v', '8', '1')); - feature_sets.insert("character_variant_82", HB_TAG('c', 'v', '8', '2')); - feature_sets.insert("character_variant_83", HB_TAG('c', 'v', '8', '3')); - feature_sets.insert("character_variant_84", HB_TAG('c', 'v', '8', '4')); - feature_sets.insert("character_variant_85", HB_TAG('c', 'v', '8', '5')); - feature_sets.insert("character_variant_86", HB_TAG('c', 'v', '8', '6')); - feature_sets.insert("character_variant_87", HB_TAG('c', 'v', '8', '7')); - feature_sets.insert("character_variant_88", HB_TAG('c', 'v', '8', '8')); - feature_sets.insert("character_variant_89", HB_TAG('c', 'v', '8', '9')); - feature_sets.insert("character_variant_90", HB_TAG('c', 'v', '9', '0')); - feature_sets.insert("character_variant_91", HB_TAG('c', 'v', '9', '1')); - feature_sets.insert("character_variant_92", HB_TAG('c', 'v', '9', '2')); - feature_sets.insert("character_variant_93", HB_TAG('c', 'v', '9', '3')); - feature_sets.insert("character_variant_94", HB_TAG('c', 'v', '9', '4')); - feature_sets.insert("character_variant_95", HB_TAG('c', 'v', '9', '5')); - feature_sets.insert("character_variant_96", HB_TAG('c', 'v', '9', '6')); - feature_sets.insert("character_variant_97", HB_TAG('c', 'v', '9', '7')); - feature_sets.insert("character_variant_98", HB_TAG('c', 'v', '9', '8')); - feature_sets.insert("character_variant_99", HB_TAG('c', 'v', '9', '9')); - feature_sets.insert("petite_capitals_from_capitals", HB_TAG('c', '2', 'p', 'c')); - feature_sets.insert("small_capitals_from_capitals", HB_TAG('c', '2', 's', 'c')); - feature_sets.insert("distances", HB_TAG('d', 'i', 's', 't')); - feature_sets.insert("discretionary_ligatures", HB_TAG('d', 'l', 'i', 'g')); - feature_sets.insert("denominators", HB_TAG('d', 'n', 'o', 'm')); - feature_sets.insert("dotless_forms", HB_TAG('d', 't', 'l', 's')); - feature_sets.insert("expert_forms", HB_TAG('e', 'x', 'p', 't')); - feature_sets.insert("final_glyph_on_line_alternates", HB_TAG('f', 'a', 'l', 't')); - feature_sets.insert("terminal_forms_2", HB_TAG('f', 'i', 'n', '2')); - feature_sets.insert("terminal_forms_3", HB_TAG('f', 'i', 'n', '3')); - feature_sets.insert("terminal_forms", HB_TAG('f', 'i', 'n', 'a')); - feature_sets.insert("flattened_accent_forms", HB_TAG('f', 'l', 'a', 'c')); - feature_sets.insert("fractions", HB_TAG('f', 'r', 'a', 'c')); - feature_sets.insert("full_widths", HB_TAG('f', 'w', 'i', 'd')); - feature_sets.insert("half_forms", HB_TAG('h', 'a', 'l', 'f')); - feature_sets.insert("halant_forms", HB_TAG('h', 'a', 'l', 'n')); - feature_sets.insert("alternate_half_widths", HB_TAG('h', 'a', 'l', 't')); - feature_sets.insert("historical_forms", HB_TAG('h', 'i', 's', 't')); - feature_sets.insert("horizontal_kana_alternates", HB_TAG('h', 'k', 'n', 'a')); - feature_sets.insert("historical_ligatures", HB_TAG('h', 'l', 'i', 'g')); - feature_sets.insert("hangul", HB_TAG('h', 'n', 'g', 'l')); - feature_sets.insert("hojo_kanji_forms", HB_TAG('h', 'o', 'j', 'o')); - feature_sets.insert("half_widths", HB_TAG('h', 'w', 'i', 'd')); - feature_sets.insert("initial_forms", HB_TAG('i', 'n', 'i', 't')); - feature_sets.insert("isolated_forms", HB_TAG('i', 's', 'o', 'l')); - feature_sets.insert("italics", HB_TAG('i', 't', 'a', 'l')); - feature_sets.insert("justification_alternates", HB_TAG('j', 'a', 'l', 't')); - feature_sets.insert("jis78_forms", HB_TAG('j', 'p', '7', '8')); - feature_sets.insert("jis83_forms", HB_TAG('j', 'p', '8', '3')); - feature_sets.insert("jis90_forms", HB_TAG('j', 'p', '9', '0')); - feature_sets.insert("jis2004_forms", HB_TAG('j', 'p', '0', '4')); - feature_sets.insert("kerning", HB_TAG('k', 'e', 'r', 'n')); - feature_sets.insert("left_bounds", HB_TAG('l', 'f', 'b', 'd')); - feature_sets.insert("standard_ligatures", HB_TAG('l', 'i', 'g', 'a')); - feature_sets.insert("leading_jamo_forms", HB_TAG('l', 'j', 'm', 'o')); - feature_sets.insert("lining_figures", HB_TAG('l', 'n', 'u', 'm')); - feature_sets.insert("localized_forms", HB_TAG('l', 'o', 'c', 'l')); - feature_sets.insert("left_to_right_alternates", HB_TAG('l', 't', 'r', 'a')); - feature_sets.insert("left_to_right_mirrored_forms", HB_TAG('l', 't', 'r', 'm')); - feature_sets.insert("mark_positioning", HB_TAG('m', 'a', 'r', 'k')); - feature_sets.insert("medial_forms_2", HB_TAG('m', 'e', 'd', '2')); - feature_sets.insert("medial_forms", HB_TAG('m', 'e', 'd', 'i')); - feature_sets.insert("mathematical_greek", HB_TAG('m', 'g', 'r', 'k')); - feature_sets.insert("mark_to_mark_positioning", HB_TAG('m', 'k', 'm', 'k')); - feature_sets.insert("mark_positioning_via_substitution", HB_TAG('m', 's', 'e', 't')); - feature_sets.insert("alternate_annotation_forms", HB_TAG('n', 'a', 'l', 't')); - feature_sets.insert("nlc_kanji_forms", HB_TAG('n', 'l', 'c', 'k')); - feature_sets.insert("nukta_forms", HB_TAG('n', 'u', 'k', 't')); - feature_sets.insert("numerators", HB_TAG('n', 'u', 'm', 'r')); - feature_sets.insert("oldstyle_figures", HB_TAG('o', 'n', 'u', 'm')); - feature_sets.insert("optical_bounds", HB_TAG('o', 'p', 'b', 'd')); - feature_sets.insert("ordinals", HB_TAG('o', 'r', 'd', 'n')); - feature_sets.insert("ornaments", HB_TAG('o', 'r', 'n', 'm')); - feature_sets.insert("proportional_alternate_widths", HB_TAG('p', 'a', 'l', 't')); - feature_sets.insert("petite_capitals", HB_TAG('p', 'c', 'a', 'p')); - feature_sets.insert("proportional_kana", HB_TAG('p', 'k', 'n', 'a')); - feature_sets.insert("proportional_figures", HB_TAG('p', 'n', 'u', 'm')); - feature_sets.insert("pre_base_forms", HB_TAG('p', 'r', 'e', 'f')); - feature_sets.insert("pre_base_substitutions", HB_TAG('p', 'r', 'e', 's')); - feature_sets.insert("post_base_forms", HB_TAG('p', 's', 't', 'f')); - feature_sets.insert("post_base_substitutions", HB_TAG('p', 's', 't', 's')); - feature_sets.insert("proportional_widths", HB_TAG('p', 'w', 'i', 'd')); - feature_sets.insert("quarter_widths", HB_TAG('q', 'w', 'i', 'd')); - feature_sets.insert("randomize", HB_TAG('r', 'a', 'n', 'd')); - feature_sets.insert("required_contextual_alternates", HB_TAG('r', 'c', 'l', 't')); - feature_sets.insert("rakar_forms", HB_TAG('r', 'k', 'r', 'f')); - feature_sets.insert("required_ligatures", HB_TAG('r', 'l', 'i', 'g')); - feature_sets.insert("reph_forms", HB_TAG('r', 'p', 'h', 'f')); - feature_sets.insert("right_bounds", HB_TAG('r', 't', 'b', 'd')); - feature_sets.insert("right_to_left_alternates", HB_TAG('r', 't', 'l', 'a')); - feature_sets.insert("right_to_left_mirrored_forms", HB_TAG('r', 't', 'l', 'm')); - feature_sets.insert("ruby_notation_forms", HB_TAG('r', 'u', 'b', 'y')); - feature_sets.insert("required_variation_alternates", HB_TAG('r', 'v', 'r', 'n')); - feature_sets.insert("stylistic_alternates", HB_TAG('s', 'a', 'l', 't')); - feature_sets.insert("scientific_inferiors", HB_TAG('s', 'i', 'n', 'f')); - feature_sets.insert("optical_size", HB_TAG('s', 'i', 'z', 'e')); - feature_sets.insert("small_capitals", HB_TAG('s', 'm', 'c', 'p')); - feature_sets.insert("simplified_forms", HB_TAG('s', 'm', 'p', 'l')); - feature_sets.insert("stylistic_set_01", HB_TAG('s', 's', '0', '1')); - feature_sets.insert("stylistic_set_02", HB_TAG('s', 's', '0', '2')); - feature_sets.insert("stylistic_set_03", HB_TAG('s', 's', '0', '3')); - feature_sets.insert("stylistic_set_04", HB_TAG('s', 's', '0', '4')); - feature_sets.insert("stylistic_set_05", HB_TAG('s', 's', '0', '5')); - feature_sets.insert("stylistic_set_06", HB_TAG('s', 's', '0', '6')); - feature_sets.insert("stylistic_set_07", HB_TAG('s', 's', '0', '7')); - feature_sets.insert("stylistic_set_08", HB_TAG('s', 's', '0', '8')); - feature_sets.insert("stylistic_set_09", HB_TAG('s', 's', '0', '9')); - feature_sets.insert("stylistic_set_10", HB_TAG('s', 's', '1', '0')); - feature_sets.insert("stylistic_set_11", HB_TAG('s', 's', '1', '1')); - feature_sets.insert("stylistic_set_12", HB_TAG('s', 's', '1', '2')); - feature_sets.insert("stylistic_set_13", HB_TAG('s', 's', '1', '3')); - feature_sets.insert("stylistic_set_14", HB_TAG('s', 's', '1', '4')); - feature_sets.insert("stylistic_set_15", HB_TAG('s', 's', '1', '5')); - feature_sets.insert("stylistic_set_16", HB_TAG('s', 's', '1', '6')); - feature_sets.insert("stylistic_set_17", HB_TAG('s', 's', '1', '7')); - feature_sets.insert("stylistic_set_18", HB_TAG('s', 's', '1', '8')); - feature_sets.insert("stylistic_set_19", HB_TAG('s', 's', '1', '9')); - feature_sets.insert("stylistic_set_20", HB_TAG('s', 's', '2', '0')); - feature_sets.insert("math_script_style_alternates", HB_TAG('s', 's', 't', 'y')); - feature_sets.insert("stretching_glyph_decomposition", HB_TAG('s', 't', 'c', 'h')); - feature_sets.insert("subscript", HB_TAG('s', 'u', 'b', 's')); - feature_sets.insert("superscript", HB_TAG('s', 'u', 'p', 's')); - feature_sets.insert("swash", HB_TAG('s', 'w', 's', 'h')); - feature_sets.insert("titling", HB_TAG('t', 'i', 't', 'l')); - feature_sets.insert("trailing_jamo_forms", HB_TAG('t', 'j', 'm', 'o')); - feature_sets.insert("traditional_name_forms", HB_TAG('t', 'n', 'a', 'm')); - feature_sets.insert("tabular_figures", HB_TAG('t', 'n', 'u', 'm')); - feature_sets.insert("traditional_forms", HB_TAG('t', 'r', 'a', 'd')); - feature_sets.insert("third_widths", HB_TAG('t', 'w', 'i', 'd')); - feature_sets.insert("unicase", HB_TAG('u', 'n', 'i', 'c')); - feature_sets.insert("alternate_vertical_metrics", HB_TAG('v', 'a', 'l', 't')); - feature_sets.insert("vattu_variants", HB_TAG('v', 'a', 't', 'u')); - feature_sets.insert("vertical_writing", HB_TAG('v', 'e', 'r', 't')); - feature_sets.insert("alternate_vertical_half_metrics", HB_TAG('v', 'h', 'a', 'l')); - feature_sets.insert("vowel_jamo_forms", HB_TAG('v', 'j', 'm', 'o')); - feature_sets.insert("vertical_kana_alternates", HB_TAG('v', 'k', 'n', 'a')); - feature_sets.insert("vertical_kerning", HB_TAG('v', 'k', 'r', 'n')); - feature_sets.insert("proportional_alternate_vertical_metrics", HB_TAG('v', 'p', 'a', 'l')); - feature_sets.insert("vertical_alternates_and_rotation", HB_TAG('v', 'r', 't', '2')); - feature_sets.insert("vertical_alternates_for_rotation", HB_TAG('v', 'r', 't', 'r')); - feature_sets.insert("slashed_zero", HB_TAG('z', 'e', 'r', 'o')); + _insert_feature("access_all_alternates", HB_TAG('a', 'a', 'l', 't')); + _insert_feature("above_base_forms", HB_TAG('a', 'b', 'v', 'f')); + _insert_feature("above_base_mark_positioning", HB_TAG('a', 'b', 'v', 'm')); + _insert_feature("above_base_substitutions", HB_TAG('a', 'b', 'v', 's')); + _insert_feature("alternative_fractions", HB_TAG('a', 'f', 'r', 'c')); + _insert_feature("akhands", HB_TAG('a', 'k', 'h', 'n')); + _insert_feature("below_base_forms", HB_TAG('b', 'l', 'w', 'f')); + _insert_feature("below_base_mark_positioning", HB_TAG('b', 'l', 'w', 'm')); + _insert_feature("below_base_substitutions", HB_TAG('b', 'l', 'w', 's')); + _insert_feature("contextual_alternates", HB_TAG('c', 'a', 'l', 't')); + _insert_feature("case_sensitive_forms", HB_TAG('c', 'a', 's', 'e')); + _insert_feature("glyph_composition", HB_TAG('c', 'c', 'm', 'p')); + _insert_feature("conjunct_form_after_ro", HB_TAG('c', 'f', 'a', 'r')); + _insert_feature("conjunct_forms", HB_TAG('c', 'j', 'c', 't')); + _insert_feature("contextual_ligatures", HB_TAG('c', 'l', 'i', 'g')); + _insert_feature("centered_cjk_punctuation", HB_TAG('c', 'p', 'c', 't')); + _insert_feature("capital_spacing", HB_TAG('c', 'p', 's', 'p')); + _insert_feature("contextual_swash", HB_TAG('c', 's', 'w', 'h')); + _insert_feature("cursive_positioning", HB_TAG('c', 'u', 'r', 's')); + _insert_feature("character_variant_01", HB_TAG('c', 'v', '0', '1')); + _insert_feature("character_variant_02", HB_TAG('c', 'v', '0', '2')); + _insert_feature("character_variant_03", HB_TAG('c', 'v', '0', '3')); + _insert_feature("character_variant_04", HB_TAG('c', 'v', '0', '4')); + _insert_feature("character_variant_05", HB_TAG('c', 'v', '0', '5')); + _insert_feature("character_variant_06", HB_TAG('c', 'v', '0', '6')); + _insert_feature("character_variant_07", HB_TAG('c', 'v', '0', '7')); + _insert_feature("character_variant_08", HB_TAG('c', 'v', '0', '8')); + _insert_feature("character_variant_09", HB_TAG('c', 'v', '0', '9')); + _insert_feature("character_variant_10", HB_TAG('c', 'v', '1', '0')); + _insert_feature("character_variant_11", HB_TAG('c', 'v', '1', '1')); + _insert_feature("character_variant_12", HB_TAG('c', 'v', '1', '2')); + _insert_feature("character_variant_13", HB_TAG('c', 'v', '1', '3')); + _insert_feature("character_variant_14", HB_TAG('c', 'v', '1', '4')); + _insert_feature("character_variant_15", HB_TAG('c', 'v', '1', '5')); + _insert_feature("character_variant_16", HB_TAG('c', 'v', '1', '6')); + _insert_feature("character_variant_17", HB_TAG('c', 'v', '1', '7')); + _insert_feature("character_variant_18", HB_TAG('c', 'v', '1', '8')); + _insert_feature("character_variant_19", HB_TAG('c', 'v', '1', '9')); + _insert_feature("character_variant_20", HB_TAG('c', 'v', '2', '0')); + _insert_feature("character_variant_21", HB_TAG('c', 'v', '2', '1')); + _insert_feature("character_variant_22", HB_TAG('c', 'v', '2', '2')); + _insert_feature("character_variant_23", HB_TAG('c', 'v', '2', '3')); + _insert_feature("character_variant_24", HB_TAG('c', 'v', '2', '4')); + _insert_feature("character_variant_25", HB_TAG('c', 'v', '2', '5')); + _insert_feature("character_variant_26", HB_TAG('c', 'v', '2', '6')); + _insert_feature("character_variant_27", HB_TAG('c', 'v', '2', '7')); + _insert_feature("character_variant_28", HB_TAG('c', 'v', '2', '8')); + _insert_feature("character_variant_29", HB_TAG('c', 'v', '2', '9')); + _insert_feature("character_variant_30", HB_TAG('c', 'v', '3', '0')); + _insert_feature("character_variant_31", HB_TAG('c', 'v', '3', '1')); + _insert_feature("character_variant_32", HB_TAG('c', 'v', '3', '2')); + _insert_feature("character_variant_33", HB_TAG('c', 'v', '3', '3')); + _insert_feature("character_variant_34", HB_TAG('c', 'v', '3', '4')); + _insert_feature("character_variant_35", HB_TAG('c', 'v', '3', '5')); + _insert_feature("character_variant_36", HB_TAG('c', 'v', '3', '6')); + _insert_feature("character_variant_37", HB_TAG('c', 'v', '3', '7')); + _insert_feature("character_variant_38", HB_TAG('c', 'v', '3', '8')); + _insert_feature("character_variant_39", HB_TAG('c', 'v', '3', '9')); + _insert_feature("character_variant_40", HB_TAG('c', 'v', '4', '0')); + _insert_feature("character_variant_41", HB_TAG('c', 'v', '4', '1')); + _insert_feature("character_variant_42", HB_TAG('c', 'v', '4', '2')); + _insert_feature("character_variant_43", HB_TAG('c', 'v', '4', '3')); + _insert_feature("character_variant_44", HB_TAG('c', 'v', '4', '4')); + _insert_feature("character_variant_45", HB_TAG('c', 'v', '4', '5')); + _insert_feature("character_variant_46", HB_TAG('c', 'v', '4', '6')); + _insert_feature("character_variant_47", HB_TAG('c', 'v', '4', '7')); + _insert_feature("character_variant_48", HB_TAG('c', 'v', '4', '8')); + _insert_feature("character_variant_49", HB_TAG('c', 'v', '4', '9')); + _insert_feature("character_variant_50", HB_TAG('c', 'v', '5', '0')); + _insert_feature("character_variant_51", HB_TAG('c', 'v', '5', '1')); + _insert_feature("character_variant_52", HB_TAG('c', 'v', '5', '2')); + _insert_feature("character_variant_53", HB_TAG('c', 'v', '5', '3')); + _insert_feature("character_variant_54", HB_TAG('c', 'v', '5', '4')); + _insert_feature("character_variant_55", HB_TAG('c', 'v', '5', '5')); + _insert_feature("character_variant_56", HB_TAG('c', 'v', '5', '6')); + _insert_feature("character_variant_57", HB_TAG('c', 'v', '5', '7')); + _insert_feature("character_variant_58", HB_TAG('c', 'v', '5', '8')); + _insert_feature("character_variant_59", HB_TAG('c', 'v', '5', '9')); + _insert_feature("character_variant_60", HB_TAG('c', 'v', '6', '0')); + _insert_feature("character_variant_61", HB_TAG('c', 'v', '6', '1')); + _insert_feature("character_variant_62", HB_TAG('c', 'v', '6', '2')); + _insert_feature("character_variant_63", HB_TAG('c', 'v', '6', '3')); + _insert_feature("character_variant_64", HB_TAG('c', 'v', '6', '4')); + _insert_feature("character_variant_65", HB_TAG('c', 'v', '6', '5')); + _insert_feature("character_variant_66", HB_TAG('c', 'v', '6', '6')); + _insert_feature("character_variant_67", HB_TAG('c', 'v', '6', '7')); + _insert_feature("character_variant_68", HB_TAG('c', 'v', '6', '8')); + _insert_feature("character_variant_69", HB_TAG('c', 'v', '6', '9')); + _insert_feature("character_variant_70", HB_TAG('c', 'v', '7', '0')); + _insert_feature("character_variant_71", HB_TAG('c', 'v', '7', '1')); + _insert_feature("character_variant_72", HB_TAG('c', 'v', '7', '2')); + _insert_feature("character_variant_73", HB_TAG('c', 'v', '7', '3')); + _insert_feature("character_variant_74", HB_TAG('c', 'v', '7', '4')); + _insert_feature("character_variant_75", HB_TAG('c', 'v', '7', '5')); + _insert_feature("character_variant_76", HB_TAG('c', 'v', '7', '6')); + _insert_feature("character_variant_77", HB_TAG('c', 'v', '7', '7')); + _insert_feature("character_variant_78", HB_TAG('c', 'v', '7', '8')); + _insert_feature("character_variant_79", HB_TAG('c', 'v', '7', '9')); + _insert_feature("character_variant_80", HB_TAG('c', 'v', '8', '0')); + _insert_feature("character_variant_81", HB_TAG('c', 'v', '8', '1')); + _insert_feature("character_variant_82", HB_TAG('c', 'v', '8', '2')); + _insert_feature("character_variant_83", HB_TAG('c', 'v', '8', '3')); + _insert_feature("character_variant_84", HB_TAG('c', 'v', '8', '4')); + _insert_feature("character_variant_85", HB_TAG('c', 'v', '8', '5')); + _insert_feature("character_variant_86", HB_TAG('c', 'v', '8', '6')); + _insert_feature("character_variant_87", HB_TAG('c', 'v', '8', '7')); + _insert_feature("character_variant_88", HB_TAG('c', 'v', '8', '8')); + _insert_feature("character_variant_89", HB_TAG('c', 'v', '8', '9')); + _insert_feature("character_variant_90", HB_TAG('c', 'v', '9', '0')); + _insert_feature("character_variant_91", HB_TAG('c', 'v', '9', '1')); + _insert_feature("character_variant_92", HB_TAG('c', 'v', '9', '2')); + _insert_feature("character_variant_93", HB_TAG('c', 'v', '9', '3')); + _insert_feature("character_variant_94", HB_TAG('c', 'v', '9', '4')); + _insert_feature("character_variant_95", HB_TAG('c', 'v', '9', '5')); + _insert_feature("character_variant_96", HB_TAG('c', 'v', '9', '6')); + _insert_feature("character_variant_97", HB_TAG('c', 'v', '9', '7')); + _insert_feature("character_variant_98", HB_TAG('c', 'v', '9', '8')); + _insert_feature("character_variant_99", HB_TAG('c', 'v', '9', '9')); + _insert_feature("petite_capitals_from_capitals", HB_TAG('c', '2', 'p', 'c')); + _insert_feature("small_capitals_from_capitals", HB_TAG('c', '2', 's', 'c')); + _insert_feature("distances", HB_TAG('d', 'i', 's', 't')); + _insert_feature("discretionary_ligatures", HB_TAG('d', 'l', 'i', 'g')); + _insert_feature("denominators", HB_TAG('d', 'n', 'o', 'm')); + _insert_feature("dotless_forms", HB_TAG('d', 't', 'l', 's')); + _insert_feature("expert_forms", HB_TAG('e', 'x', 'p', 't')); + _insert_feature("final_glyph_on_line_alternates", HB_TAG('f', 'a', 'l', 't')); + _insert_feature("terminal_forms_2", HB_TAG('f', 'i', 'n', '2')); + _insert_feature("terminal_forms_3", HB_TAG('f', 'i', 'n', '3')); + _insert_feature("terminal_forms", HB_TAG('f', 'i', 'n', 'a')); + _insert_feature("flattened_accent_forms", HB_TAG('f', 'l', 'a', 'c')); + _insert_feature("fractions", HB_TAG('f', 'r', 'a', 'c')); + _insert_feature("full_widths", HB_TAG('f', 'w', 'i', 'd')); + _insert_feature("half_forms", HB_TAG('h', 'a', 'l', 'f')); + _insert_feature("halant_forms", HB_TAG('h', 'a', 'l', 'n')); + _insert_feature("alternate_half_widths", HB_TAG('h', 'a', 'l', 't')); + _insert_feature("historical_forms", HB_TAG('h', 'i', 's', 't')); + _insert_feature("horizontal_kana_alternates", HB_TAG('h', 'k', 'n', 'a')); + _insert_feature("historical_ligatures", HB_TAG('h', 'l', 'i', 'g')); + _insert_feature("hangul", HB_TAG('h', 'n', 'g', 'l')); + _insert_feature("hojo_kanji_forms", HB_TAG('h', 'o', 'j', 'o')); + _insert_feature("half_widths", HB_TAG('h', 'w', 'i', 'd')); + _insert_feature("initial_forms", HB_TAG('i', 'n', 'i', 't')); + _insert_feature("isolated_forms", HB_TAG('i', 's', 'o', 'l')); + _insert_feature("italics", HB_TAG('i', 't', 'a', 'l')); + _insert_feature("justification_alternates", HB_TAG('j', 'a', 'l', 't')); + _insert_feature("jis78_forms", HB_TAG('j', 'p', '7', '8')); + _insert_feature("jis83_forms", HB_TAG('j', 'p', '8', '3')); + _insert_feature("jis90_forms", HB_TAG('j', 'p', '9', '0')); + _insert_feature("jis2004_forms", HB_TAG('j', 'p', '0', '4')); + _insert_feature("kerning", HB_TAG('k', 'e', 'r', 'n')); + _insert_feature("left_bounds", HB_TAG('l', 'f', 'b', 'd')); + _insert_feature("standard_ligatures", HB_TAG('l', 'i', 'g', 'a')); + _insert_feature("leading_jamo_forms", HB_TAG('l', 'j', 'm', 'o')); + _insert_feature("lining_figures", HB_TAG('l', 'n', 'u', 'm')); + _insert_feature("localized_forms", HB_TAG('l', 'o', 'c', 'l')); + _insert_feature("left_to_right_alternates", HB_TAG('l', 't', 'r', 'a')); + _insert_feature("left_to_right_mirrored_forms", HB_TAG('l', 't', 'r', 'm')); + _insert_feature("mark_positioning", HB_TAG('m', 'a', 'r', 'k')); + _insert_feature("medial_forms_2", HB_TAG('m', 'e', 'd', '2')); + _insert_feature("medial_forms", HB_TAG('m', 'e', 'd', 'i')); + _insert_feature("mathematical_greek", HB_TAG('m', 'g', 'r', 'k')); + _insert_feature("mark_to_mark_positioning", HB_TAG('m', 'k', 'm', 'k')); + _insert_feature("mark_positioning_via_substitution", HB_TAG('m', 's', 'e', 't')); + _insert_feature("alternate_annotation_forms", HB_TAG('n', 'a', 'l', 't')); + _insert_feature("nlc_kanji_forms", HB_TAG('n', 'l', 'c', 'k')); + _insert_feature("nukta_forms", HB_TAG('n', 'u', 'k', 't')); + _insert_feature("numerators", HB_TAG('n', 'u', 'm', 'r')); + _insert_feature("oldstyle_figures", HB_TAG('o', 'n', 'u', 'm')); + _insert_feature("optical_bounds", HB_TAG('o', 'p', 'b', 'd')); + _insert_feature("ordinals", HB_TAG('o', 'r', 'd', 'n')); + _insert_feature("ornaments", HB_TAG('o', 'r', 'n', 'm')); + _insert_feature("proportional_alternate_widths", HB_TAG('p', 'a', 'l', 't')); + _insert_feature("petite_capitals", HB_TAG('p', 'c', 'a', 'p')); + _insert_feature("proportional_kana", HB_TAG('p', 'k', 'n', 'a')); + _insert_feature("proportional_figures", HB_TAG('p', 'n', 'u', 'm')); + _insert_feature("pre_base_forms", HB_TAG('p', 'r', 'e', 'f')); + _insert_feature("pre_base_substitutions", HB_TAG('p', 'r', 'e', 's')); + _insert_feature("post_base_forms", HB_TAG('p', 's', 't', 'f')); + _insert_feature("post_base_substitutions", HB_TAG('p', 's', 't', 's')); + _insert_feature("proportional_widths", HB_TAG('p', 'w', 'i', 'd')); + _insert_feature("quarter_widths", HB_TAG('q', 'w', 'i', 'd')); + _insert_feature("randomize", HB_TAG('r', 'a', 'n', 'd')); + _insert_feature("required_contextual_alternates", HB_TAG('r', 'c', 'l', 't')); + _insert_feature("rakar_forms", HB_TAG('r', 'k', 'r', 'f')); + _insert_feature("required_ligatures", HB_TAG('r', 'l', 'i', 'g')); + _insert_feature("reph_forms", HB_TAG('r', 'p', 'h', 'f')); + _insert_feature("right_bounds", HB_TAG('r', 't', 'b', 'd')); + _insert_feature("right_to_left_alternates", HB_TAG('r', 't', 'l', 'a')); + _insert_feature("right_to_left_mirrored_forms", HB_TAG('r', 't', 'l', 'm')); + _insert_feature("ruby_notation_forms", HB_TAG('r', 'u', 'b', 'y')); + _insert_feature("required_variation_alternates", HB_TAG('r', 'v', 'r', 'n')); + _insert_feature("stylistic_alternates", HB_TAG('s', 'a', 'l', 't')); + _insert_feature("scientific_inferiors", HB_TAG('s', 'i', 'n', 'f')); + _insert_feature("optical_size", HB_TAG('s', 'i', 'z', 'e')); + _insert_feature("small_capitals", HB_TAG('s', 'm', 'c', 'p')); + _insert_feature("simplified_forms", HB_TAG('s', 'm', 'p', 'l')); + _insert_feature("stylistic_set_01", HB_TAG('s', 's', '0', '1')); + _insert_feature("stylistic_set_02", HB_TAG('s', 's', '0', '2')); + _insert_feature("stylistic_set_03", HB_TAG('s', 's', '0', '3')); + _insert_feature("stylistic_set_04", HB_TAG('s', 's', '0', '4')); + _insert_feature("stylistic_set_05", HB_TAG('s', 's', '0', '5')); + _insert_feature("stylistic_set_06", HB_TAG('s', 's', '0', '6')); + _insert_feature("stylistic_set_07", HB_TAG('s', 's', '0', '7')); + _insert_feature("stylistic_set_08", HB_TAG('s', 's', '0', '8')); + _insert_feature("stylistic_set_09", HB_TAG('s', 's', '0', '9')); + _insert_feature("stylistic_set_10", HB_TAG('s', 's', '1', '0')); + _insert_feature("stylistic_set_11", HB_TAG('s', 's', '1', '1')); + _insert_feature("stylistic_set_12", HB_TAG('s', 's', '1', '2')); + _insert_feature("stylistic_set_13", HB_TAG('s', 's', '1', '3')); + _insert_feature("stylistic_set_14", HB_TAG('s', 's', '1', '4')); + _insert_feature("stylistic_set_15", HB_TAG('s', 's', '1', '5')); + _insert_feature("stylistic_set_16", HB_TAG('s', 's', '1', '6')); + _insert_feature("stylistic_set_17", HB_TAG('s', 's', '1', '7')); + _insert_feature("stylistic_set_18", HB_TAG('s', 's', '1', '8')); + _insert_feature("stylistic_set_19", HB_TAG('s', 's', '1', '9')); + _insert_feature("stylistic_set_20", HB_TAG('s', 's', '2', '0')); + _insert_feature("math_script_style_alternates", HB_TAG('s', 's', 't', 'y')); + _insert_feature("stretching_glyph_decomposition", HB_TAG('s', 't', 'c', 'h')); + _insert_feature("subscript", HB_TAG('s', 'u', 'b', 's')); + _insert_feature("superscript", HB_TAG('s', 'u', 'p', 's')); + _insert_feature("swash", HB_TAG('s', 'w', 's', 'h')); + _insert_feature("titling", HB_TAG('t', 'i', 't', 'l')); + _insert_feature("trailing_jamo_forms", HB_TAG('t', 'j', 'm', 'o')); + _insert_feature("traditional_name_forms", HB_TAG('t', 'n', 'a', 'm')); + _insert_feature("tabular_figures", HB_TAG('t', 'n', 'u', 'm')); + _insert_feature("traditional_forms", HB_TAG('t', 'r', 'a', 'd')); + _insert_feature("third_widths", HB_TAG('t', 'w', 'i', 'd')); + _insert_feature("unicase", HB_TAG('u', 'n', 'i', 'c')); + _insert_feature("alternate_vertical_metrics", HB_TAG('v', 'a', 'l', 't')); + _insert_feature("vattu_variants", HB_TAG('v', 'a', 't', 'u')); + _insert_feature("vertical_writing", HB_TAG('v', 'e', 'r', 't')); + _insert_feature("alternate_vertical_half_metrics", HB_TAG('v', 'h', 'a', 'l')); + _insert_feature("vowel_jamo_forms", HB_TAG('v', 'j', 'm', 'o')); + _insert_feature("vertical_kana_alternates", HB_TAG('v', 'k', 'n', 'a')); + _insert_feature("vertical_kerning", HB_TAG('v', 'k', 'r', 'n')); + _insert_feature("proportional_alternate_vertical_metrics", HB_TAG('v', 'p', 'a', 'l')); + _insert_feature("vertical_alternates_and_rotation", HB_TAG('v', 'r', 't', '2')); + _insert_feature("vertical_alternates_for_rotation", HB_TAG('v', 'r', 't', 'r')); + _insert_feature("slashed_zero", HB_TAG('z', 'e', 'r', 'o')); + // Registered OpenType variation tag. - feature_sets.insert("italic", HB_TAG('i', 't', 'a', 'l')); - feature_sets.insert("optical_size", HB_TAG('o', 'p', 's', 'z')); - feature_sets.insert("slant", HB_TAG('s', 'l', 'n', 't')); - feature_sets.insert("width", HB_TAG('w', 'd', 't', 'h')); - feature_sets.insert("weight", HB_TAG('w', 'g', 'h', 't')); + _insert_feature("italic", HB_TAG('i', 't', 'a', 'l')); + _insert_feature("optical_size", HB_TAG('o', 'p', 's', 'z')); + _insert_feature("slant", HB_TAG('s', 'l', 'n', 't')); + _insert_feature("width", HB_TAG('w', 'd', 't', 'h')); + _insert_feature("weight", HB_TAG('w', 'g', 'h', 't')); } -int32_t TextServerAdvanced::name_to_tag(const String &p_name) const { +int64_t TextServerAdvanced::name_to_tag(const String &p_name) const { if (feature_sets.has(p_name)) { return feature_sets[p_name]; } @@ -686,11 +742,9 @@ int32_t TextServerAdvanced::name_to_tag(const String &p_name) const { return hb_tag_from_string(p_name.replace("custom_", "").ascii().get_data(), -1); } -String TextServerAdvanced::tag_to_name(int32_t p_tag) const { - for (const KeyValue<StringName, int32_t> &E : feature_sets) { - if (E.value == p_tag) { - return E.key; - } +String TextServerAdvanced::tag_to_name(int64_t p_tag) const { + if (feature_sets_inv.has(p_tag)) { + return feature_sets_inv[p_tag]; } // No readable name, use tag string. @@ -728,7 +782,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_ continue; } - ret.y = 0x7FFFFFFF; + ret.y = 0x7fffffff; ret.x = 0; for (int j = 0; j < ct.texture_w - mw; j++) { @@ -747,7 +801,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_ } } - if (ret.y == 0x7FFFFFFF || ret.y + mh > ct.texture_h) { + if (ret.y == 0x7fffffff || ret.y + mh > ct.texture_h) { continue; // Fail, could not fit it here. } @@ -768,7 +822,11 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_ texsize = mh; // Special case, adapt to it? } +#ifdef GDEXTENSION + texsize = Math::next_power_of_2(texsize); +#else texsize = next_power_of_2(texsize); +#endif if (p_msdf) { texsize = MIN(texsize, 2048); } else { @@ -804,8 +862,9 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_ } } tex.offsets.resize(texsize); + int32_t *offw = tex.offsets.ptrw(); for (int i = 0; i < texsize; i++) { // Zero offsets. - tex.offsets.write[i] = 0; + offw[i] = 0; } p_data->textures.push_back(tex); @@ -983,7 +1042,9 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_msdf( // Blit to image and texture. { if (RenderingServer::get_singleton() != nullptr) { - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); tex.texture->create_from_image(img); @@ -994,8 +1055,9 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_msdf( } // Update height array. + int32_t *offw = tex.offsets.ptrw(); for (int k = tex_pos.x; k < tex_pos.x + mw; k++) { - tex.offsets.write[k] = tex_pos.y + mh; + offw[k] = tex_pos.y + mh; } chr.texture_idx = tex_pos.index; @@ -1055,7 +1117,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma wr[ofs + 3] = bitmap.buffer[ofs_color + 3]; } break; default: - ERR_FAIL_V_MSG(FontGlyph(), "Font uses unsupported pixel format: " + itos(bitmap.pixel_mode) + "."); + ERR_FAIL_V_MSG(FontGlyph(), "Font uses unsupported pixel format: " + String::num_int64(bitmap.pixel_mode) + "."); break; } } @@ -1065,7 +1127,9 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma // Blit to image and texture. { if (RenderingServer::get_singleton() != nullptr) { - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); @@ -1077,8 +1141,9 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma } // Update height array. + int32_t *offw = tex.offsets.ptrw(); for (int k = tex_pos.x; k < tex_pos.x + mw; k++) { - tex.offsets.write[k] = tex_pos.y + mh; + offw[k] = tex_pos.y + mh; } FontGlyph chr; @@ -1100,7 +1165,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma _FORCE_INLINE_ bool TextServerAdvanced::_ensure_glyph(FontDataAdvanced *p_font_data, const Vector2i &p_size, int32_t p_glyph) const { ERR_FAIL_COND_V(!_ensure_cache_for_size(p_font_data, p_size), false); - int32_t glyph_index = p_glyph & 0xFFFFFF; // Remove subpixel shifts. + int32_t glyph_index = p_glyph & 0xffffff; // Remove subpixel shifts. FontDataForSizeAdvanced *fd = p_font_data->cache[p_size]; if (fd->glyph_map.has(p_glyph)) { @@ -1187,7 +1252,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_glyph(FontDataAdvanced *p_font_d } } else { FT_Stroker stroker; - if (FT_Stroker_New(library, &stroker) != 0) { + if (FT_Stroker_New(ft_library, &stroker) != 0) { fd->glyph_map[p_glyph] = FontGlyph(); ERR_FAIL_V_MSG(false, "FreeType: Failed to load glyph stroker."); } @@ -1233,8 +1298,8 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced // Init dynamic font. #ifdef MODULE_FREETYPE_ENABLED int error = 0; - if (!library) { - error = FT_Init_FreeType(&library); + if (!ft_library) { + error = FT_Init_FreeType(&ft_library); ERR_FAIL_COND_V_MSG(error != 0, false, "FreeType: Error initializing library: '" + String(FT_Error_String(error)) + "'."); } @@ -1249,7 +1314,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced fargs.memory_size = p_font_data->data_size; fargs.flags = FT_OPEN_MEMORY; fargs.stream = &fd->stream; - error = FT_Open_Face(library, &fargs, 0, &fd->face); + error = FT_Open_Face(ft_library, &fargs, 0, &fd->face); if (error) { FT_Done_Face(fd->face); fd->face = nullptr; @@ -1257,9 +1322,9 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced } if (p_font_data->msdf) { - fd->oversampling = 1.0f; + fd->oversampling = 1.0; fd->size.x = p_font_data->msdf_source_size; - } else if (p_font_data->oversampling <= 0.0f) { + } else if (p_font_data->oversampling <= 0.0) { fd->oversampling = font_get_global_oversampling(); } else { fd->oversampling = p_font_data->oversampling; @@ -1268,19 +1333,19 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced if (FT_HAS_COLOR(fd->face) && fd->face->num_fixed_sizes > 0) { int best_match = 0; int diff = ABS(fd->size.x - ((int64_t)fd->face->available_sizes[0].width)); - fd->scale = float(fd->size.x * fd->oversampling) / fd->face->available_sizes[0].width; + fd->scale = double(fd->size.x * fd->oversampling) / fd->face->available_sizes[0].width; for (int i = 1; i < fd->face->num_fixed_sizes; i++) { int ndiff = ABS(fd->size.x - ((int64_t)fd->face->available_sizes[i].width)); if (ndiff < diff) { best_match = i; diff = ndiff; - fd->scale = float(fd->size.x * fd->oversampling) / fd->face->available_sizes[i].width; + fd->scale = double(fd->size.x * fd->oversampling) / fd->face->available_sizes[i].width; } } FT_Select_Size(fd->face, best_match); } else { - FT_Set_Pixel_Sizes(fd->face, 0, float(fd->size.x * fd->oversampling)); - fd->scale = ((float)fd->size.x * fd->oversampling) / (float)fd->face->size->metrics.y_ppem; + FT_Set_Pixel_Sizes(fd->face, 0, double(fd->size.x * fd->oversampling)); + fd->scale = ((double)fd->size.x * fd->oversampling) / (double)fd->face->size->metrics.y_ppem; } fd->hb_handle = hb_ft_font_create(fd->face, nullptr); @@ -1573,7 +1638,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced for (FT_UInt i = 0; i < amaster->num_axis; i++) { p_font_data->supported_varaitions[(int32_t)amaster->axis[i].tag] = Vector3i(amaster->axis[i].minimum / 65536, amaster->axis[i].maximum / 65536, amaster->axis[i].def / 65536); } - FT_Done_MM_Var(library, amaster); + FT_Done_MM_Var(ft_library, amaster); } p_font_data->face_init = true; } @@ -1595,17 +1660,17 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced // Reset to default. var.tag = amaster->axis[i].tag; - var.value = (double)amaster->axis[i].def / 65536.f; + var.value = (double)amaster->axis[i].def / 65536.0; coords.write[i] = amaster->axis[i].def; if (p_font_data->variation_coordinates.has(var.tag)) { var.value = p_font_data->variation_coordinates[var.tag]; - coords.write[i] = CLAMP(var.value * 65536.f, amaster->axis[i].minimum, amaster->axis[i].maximum); + coords.write[i] = CLAMP(var.value * 65536.0, amaster->axis[i].minimum, amaster->axis[i].maximum); } if (p_font_data->variation_coordinates.has(tag_to_name(var.tag))) { var.value = p_font_data->variation_coordinates[tag_to_name(var.tag)]; - coords.write[i] = CLAMP(var.value * 65536.f, amaster->axis[i].minimum, amaster->axis[i].maximum); + coords.write[i] = CLAMP(var.value * 65536.0, amaster->axis[i].minimum, amaster->axis[i].maximum); } hb_vars.push_back(var); @@ -1613,7 +1678,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced FT_Set_Var_Design_Coordinates(fd->face, coords.size(), coords.ptrw()); hb_font_set_variations(fd->hb_handle, hb_vars.is_empty() ? nullptr : &hb_vars[0], hb_vars.size()); - FT_Done_MM_Var(library, amaster); + FT_Done_MM_Var(ft_library, amaster); } #else ERR_FAIL_V_MSG(false, "FreeType: Can't load dynamic font, engine is compiled without FreeType support!"); @@ -1637,7 +1702,7 @@ _FORCE_INLINE_ void TextServerAdvanced::_font_clear_cache(FontDataAdvanced *p_fo p_font_data->supported_scripts.clear(); } -hb_font_t *TextServerAdvanced::_font_get_hb_handle(RID p_font_rid, int p_size) const { +hb_font_t *TextServerAdvanced::_font_get_hb_handle(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, nullptr); @@ -1655,7 +1720,7 @@ RID TextServerAdvanced::create_font() { return font_owner.make_rid(fd); } -void TextServerAdvanced::font_set_data(RID p_font_rid, const PackedByteArray &p_data) { +void TextServerAdvanced::font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1666,18 +1731,18 @@ void TextServerAdvanced::font_set_data(RID p_font_rid, const PackedByteArray &p_ fd->data_size = fd->data.size(); } -void TextServerAdvanced::font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) { +void TextServerAdvanced::font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); - fd->data.clear(); + fd->data.resize(0); fd->data_ptr = p_data_ptr; fd->data_size = p_data_size; } -void TextServerAdvanced::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) { +void TextServerAdvanced::font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1687,7 +1752,7 @@ void TextServerAdvanced::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p fd->style_flags = p_style; } -uint32_t /*FontStyle*/ TextServerAdvanced::font_get_style(RID p_font_rid) const { +int64_t /*FontStyle*/ TextServerAdvanced::font_get_style(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -1697,7 +1762,7 @@ uint32_t /*FontStyle*/ TextServerAdvanced::font_get_style(RID p_font_rid) const return fd->style_flags; } -void TextServerAdvanced::font_set_style_name(RID p_font_rid, const String &p_name) { +void TextServerAdvanced::font_set_style_name(const RID &p_font_rid, const String &p_name) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1707,7 +1772,7 @@ void TextServerAdvanced::font_set_style_name(RID p_font_rid, const String &p_nam fd->style_name = p_name; } -String TextServerAdvanced::font_get_style_name(RID p_font_rid) const { +String TextServerAdvanced::font_get_style_name(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -1717,7 +1782,7 @@ String TextServerAdvanced::font_get_style_name(RID p_font_rid) const { return fd->style_name; } -void TextServerAdvanced::font_set_name(RID p_font_rid, const String &p_name) { +void TextServerAdvanced::font_set_name(const RID &p_font_rid, const String &p_name) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1727,7 +1792,7 @@ void TextServerAdvanced::font_set_name(RID p_font_rid, const String &p_name) { fd->font_name = p_name; } -String TextServerAdvanced::font_get_name(RID p_font_rid) const { +String TextServerAdvanced::font_get_name(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -1737,7 +1802,7 @@ String TextServerAdvanced::font_get_name(RID p_font_rid) const { return fd->font_name; } -void TextServerAdvanced::font_set_antialiased(RID p_font_rid, bool p_antialiased) { +void TextServerAdvanced::font_set_antialiased(const RID &p_font_rid, bool p_antialiased) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1748,7 +1813,7 @@ void TextServerAdvanced::font_set_antialiased(RID p_font_rid, bool p_antialiased } } -bool TextServerAdvanced::font_is_antialiased(RID p_font_rid) const { +bool TextServerAdvanced::font_is_antialiased(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1756,7 +1821,7 @@ bool TextServerAdvanced::font_is_antialiased(RID p_font_rid) const { return fd->antialiased; } -void TextServerAdvanced::font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) { +void TextServerAdvanced::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1767,7 +1832,7 @@ void TextServerAdvanced::font_set_multichannel_signed_distance_field(RID p_font_ } } -bool TextServerAdvanced::font_is_multichannel_signed_distance_field(RID p_font_rid) const { +bool TextServerAdvanced::font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1775,7 +1840,7 @@ bool TextServerAdvanced::font_is_multichannel_signed_distance_field(RID p_font_r return fd->msdf; } -void TextServerAdvanced::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) { +void TextServerAdvanced::font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1786,7 +1851,7 @@ void TextServerAdvanced::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pi } } -int TextServerAdvanced::font_get_msdf_pixel_range(RID p_font_rid) const { +int64_t TextServerAdvanced::font_get_msdf_pixel_range(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1794,7 +1859,7 @@ int TextServerAdvanced::font_get_msdf_pixel_range(RID p_font_rid) const { return fd->msdf_range; } -void TextServerAdvanced::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { +void TextServerAdvanced::font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1805,7 +1870,7 @@ void TextServerAdvanced::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { } } -int TextServerAdvanced::font_get_msdf_size(RID p_font_rid) const { +int64_t TextServerAdvanced::font_get_msdf_size(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1813,7 +1878,7 @@ int TextServerAdvanced::font_get_msdf_size(RID p_font_rid) const { return fd->msdf_source_size; } -void TextServerAdvanced::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { +void TextServerAdvanced::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1823,7 +1888,7 @@ void TextServerAdvanced::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { } } -int TextServerAdvanced::font_get_fixed_size(RID p_font_rid) const { +int64_t TextServerAdvanced::font_get_fixed_size(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1831,7 +1896,7 @@ int TextServerAdvanced::font_get_fixed_size(RID p_font_rid) const { return fd->fixed_size; } -void TextServerAdvanced::font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) { +void TextServerAdvanced::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1842,7 +1907,7 @@ void TextServerAdvanced::font_set_force_autohinter(RID p_font_rid, bool p_force_ } } -bool TextServerAdvanced::font_is_force_autohinter(RID p_font_rid) const { +bool TextServerAdvanced::font_is_force_autohinter(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1850,7 +1915,7 @@ bool TextServerAdvanced::font_is_force_autohinter(RID p_font_rid) const { return fd->force_autohinter; } -void TextServerAdvanced::font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) { +void TextServerAdvanced::font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1861,7 +1926,7 @@ void TextServerAdvanced::font_set_hinting(RID p_font_rid, TextServer::Hinting p_ } } -TextServer::Hinting TextServerAdvanced::font_get_hinting(RID p_font_rid) const { +TextServer::Hinting TextServerAdvanced::font_get_hinting(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, HINTING_NONE); @@ -1869,7 +1934,7 @@ TextServer::Hinting TextServerAdvanced::font_get_hinting(RID p_font_rid) const { return fd->hinting; } -void TextServerAdvanced::font_set_subpixel_positioning(RID p_font_rid, TextServer::SubpixelPositioning p_subpixel) { +void TextServerAdvanced::font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1879,7 +1944,7 @@ void TextServerAdvanced::font_set_subpixel_positioning(RID p_font_rid, TextServe } } -TextServer::SubpixelPositioning TextServerAdvanced::font_get_subpixel_positioning(RID p_font_rid) const { +TextServer::SubpixelPositioning TextServerAdvanced::font_get_subpixel_positioning(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, SUBPIXEL_POSITIONING_DISABLED); @@ -1887,7 +1952,7 @@ TextServer::SubpixelPositioning TextServerAdvanced::font_get_subpixel_positionin return fd->subpixel_positioning; } -void TextServerAdvanced::font_set_embolden(RID p_font_rid, float p_strength) { +void TextServerAdvanced::font_set_embolden(const RID &p_font_rid, double p_strength) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1898,15 +1963,15 @@ void TextServerAdvanced::font_set_embolden(RID p_font_rid, float p_strength) { } } -float TextServerAdvanced::font_get_embolden(RID p_font_rid) const { +double TextServerAdvanced::font_get_embolden(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); return fd->embolden; } -void TextServerAdvanced::font_set_transform(RID p_font_rid, Transform2D p_transform) { +void TextServerAdvanced::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1917,7 +1982,7 @@ void TextServerAdvanced::font_set_transform(RID p_font_rid, Transform2D p_transf } } -Transform2D TextServerAdvanced::font_get_transform(RID p_font_rid) const { +Transform2D TextServerAdvanced::font_get_transform(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Transform2D()); @@ -1925,7 +1990,7 @@ Transform2D TextServerAdvanced::font_get_transform(RID p_font_rid) const { return fd->transform; } -void TextServerAdvanced::font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) { +void TextServerAdvanced::font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1936,7 +2001,7 @@ void TextServerAdvanced::font_set_variation_coordinates(RID p_font_rid, const Di } } -Dictionary TextServerAdvanced::font_get_variation_coordinates(RID p_font_rid) const { +Dictionary TextServerAdvanced::font_get_variation_coordinates(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -1944,7 +2009,7 @@ Dictionary TextServerAdvanced::font_get_variation_coordinates(RID p_font_rid) co return fd->variation_coordinates; } -void TextServerAdvanced::font_set_oversampling(RID p_font_rid, float p_oversampling) { +void TextServerAdvanced::font_set_oversampling(const RID &p_font_rid, double p_oversampling) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1955,27 +2020,27 @@ void TextServerAdvanced::font_set_oversampling(RID p_font_rid, float p_oversampl } } -float TextServerAdvanced::font_get_oversampling(RID p_font_rid) const { +double TextServerAdvanced::font_get_oversampling(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); return fd->oversampling; } -Array TextServerAdvanced::font_get_size_cache_list(RID p_font_rid) const { +Array TextServerAdvanced::font_get_size_cache_list(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); MutexLock lock(fd->mutex); Array ret; - for (const Map<Vector2i, FontDataForSizeAdvanced *>::Element *E = fd->cache.front(); E; E = E->next()) { - ret.push_back(E->key()); + for (const KeyValue<Vector2i, FontDataForSizeAdvanced *> &E : fd->cache) { + ret.push_back(E.key); } return ret; } -void TextServerAdvanced::font_clear_size_cache(RID p_font_rid) { +void TextServerAdvanced::font_clear_size_cache(const RID &p_font_rid) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1986,7 +2051,7 @@ void TextServerAdvanced::font_clear_size_cache(RID p_font_rid) { fd->cache.clear(); } -void TextServerAdvanced::font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) { +void TextServerAdvanced::font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1997,7 +2062,7 @@ void TextServerAdvanced::font_remove_size_cache(RID p_font_rid, const Vector2i & } } -void TextServerAdvanced::font_set_ascent(RID p_font_rid, int p_size, float p_ascent) { +void TextServerAdvanced::font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2008,23 +2073,23 @@ void TextServerAdvanced::font_set_ascent(RID p_font_rid, int p_size, float p_asc fd->cache[size]->ascent = p_ascent; } -float TextServerAdvanced::font_get_ascent(RID p_font_rid, int p_size) const { +double TextServerAdvanced::font_get_ascent(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->ascent * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->ascent * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->ascent; } } -void TextServerAdvanced::font_set_descent(RID p_font_rid, int p_size, float p_descent) { +void TextServerAdvanced::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2034,23 +2099,23 @@ void TextServerAdvanced::font_set_descent(RID p_font_rid, int p_size, float p_de fd->cache[size]->descent = p_descent; } -float TextServerAdvanced::font_get_descent(RID p_font_rid, int p_size) const { +double TextServerAdvanced::font_get_descent(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->descent * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->descent * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->descent; } } -void TextServerAdvanced::font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) { +void TextServerAdvanced::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2061,23 +2126,23 @@ void TextServerAdvanced::font_set_underline_position(RID p_font_rid, int p_size, fd->cache[size]->underline_position = p_underline_position; } -float TextServerAdvanced::font_get_underline_position(RID p_font_rid, int p_size) const { +double TextServerAdvanced::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->underline_position * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->underline_position * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->underline_position; } } -void TextServerAdvanced::font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) { +void TextServerAdvanced::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2088,23 +2153,23 @@ void TextServerAdvanced::font_set_underline_thickness(RID p_font_rid, int p_size fd->cache[size]->underline_thickness = p_underline_thickness; } -float TextServerAdvanced::font_get_underline_thickness(RID p_font_rid, int p_size) const { +double TextServerAdvanced::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->underline_thickness * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->underline_thickness * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->underline_thickness; } } -void TextServerAdvanced::font_set_scale(RID p_font_rid, int p_size, float p_scale) { +void TextServerAdvanced::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2115,23 +2180,23 @@ void TextServerAdvanced::font_set_scale(RID p_font_rid, int p_size, float p_scal fd->cache[size]->scale = p_scale; } -float TextServerAdvanced::font_get_scale(RID p_font_rid, int p_size) const { +double TextServerAdvanced::font_get_scale(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->scale * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->scale * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->scale / fd->cache[size]->oversampling; } } -void TextServerAdvanced::font_set_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing, int p_value) { +void TextServerAdvanced::font_set_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing, int64_t p_value) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2147,12 +2212,12 @@ void TextServerAdvanced::font_set_spacing(RID p_font_rid, int p_size, TextServer fd->cache[size]->spacing_space = p_value; } break; default: { - ERR_FAIL_MSG("Invalid spacing type: " + itos(p_spacing)); + ERR_FAIL_MSG("Invalid spacing type: " + String::num_int64(p_spacing)); } break; } } -int TextServerAdvanced::font_get_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing) const { +int64_t TextServerAdvanced::font_get_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -2164,26 +2229,26 @@ int TextServerAdvanced::font_get_spacing(RID p_font_rid, int p_size, TextServer: switch (p_spacing) { case TextServer::SPACING_GLYPH: { if (fd->msdf) { - return fd->cache[size]->spacing_glyph * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->spacing_glyph * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->spacing_glyph; } } break; case TextServer::SPACING_SPACE: { if (fd->msdf) { - return fd->cache[size]->spacing_space * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->spacing_space * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->spacing_space; } } break; default: { - ERR_FAIL_V_MSG(0, "Invalid spacing type: " + itos(p_spacing)); + ERR_FAIL_V_MSG(0, "Invalid spacing type: " + String::num_int64(p_spacing)); } break; } return 0; } -int TextServerAdvanced::font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const { +int64_t TextServerAdvanced::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -2195,7 +2260,7 @@ int TextServerAdvanced::font_get_texture_count(RID p_font_rid, const Vector2i &p return fd->cache[size]->textures.size(); } -void TextServerAdvanced::font_clear_textures(RID p_font_rid, const Vector2i &p_size) { +void TextServerAdvanced::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); @@ -2205,7 +2270,7 @@ void TextServerAdvanced::font_clear_textures(RID p_font_rid, const Vector2i &p_s fd->cache[size]->textures.clear(); } -void TextServerAdvanced::font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) { +void TextServerAdvanced::font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2217,7 +2282,7 @@ void TextServerAdvanced::font_remove_texture(RID p_font_rid, const Vector2i &p_s fd->cache[size]->textures.remove_at(p_texture_index); } -void TextServerAdvanced::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { +void TextServerAdvanced::font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); ERR_FAIL_COND(p_image.is_null()); @@ -2237,13 +2302,16 @@ void TextServerAdvanced::font_set_texture_image(RID p_font_rid, const Vector2i & tex.texture_h = p_image->get_height(); tex.format = p_image->get_format(); - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + tex.texture = Ref<ImageTexture>(); tex.texture.instantiate(); tex.texture->create_from_image(img); } -Ref<Image> TextServerAdvanced::font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +Ref<Image> TextServerAdvanced::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Ref<Image>()); @@ -2252,13 +2320,15 @@ Ref<Image> TextServerAdvanced::font_get_texture_image(RID p_font_rid, const Vect ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Ref<Image>()); ERR_FAIL_INDEX_V(p_texture_index, fd->cache[size]->textures.size(), Ref<Image>()); - const FontTexture &tex = fd->cache[size]->textures.write[p_texture_index]; - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata)); + const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); return img; } -void TextServerAdvanced::font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) { +void TextServerAdvanced::font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2274,7 +2344,7 @@ void TextServerAdvanced::font_set_texture_offsets(RID p_font_rid, const Vector2i tex.offsets = p_offset; } -PackedInt32Array TextServerAdvanced::font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +PackedInt32Array TextServerAdvanced::font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, PackedInt32Array()); @@ -2283,11 +2353,11 @@ PackedInt32Array TextServerAdvanced::font_get_texture_offsets(RID p_font_rid, co ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), PackedInt32Array()); ERR_FAIL_INDEX_V(p_texture_index, fd->cache[size]->textures.size(), PackedInt32Array()); - const FontTexture &tex = fd->cache[size]->textures.write[p_texture_index]; + const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; return tex.offsets; } -Array TextServerAdvanced::font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const { +Array TextServerAdvanced::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); @@ -2304,7 +2374,7 @@ Array TextServerAdvanced::font_get_glyph_list(RID p_font_rid, const Vector2i &p_ return ret; } -void TextServerAdvanced::font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) { +void TextServerAdvanced::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2315,7 +2385,7 @@ void TextServerAdvanced::font_clear_glyphs(RID p_font_rid, const Vector2i &p_siz fd->cache[size]->glyph_map.clear(); } -void TextServerAdvanced::font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) { +void TextServerAdvanced::font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2326,7 +2396,7 @@ void TextServerAdvanced::font_remove_glyph(RID p_font_rid, const Vector2i &p_siz fd->cache[size]->glyph_map.erase(p_glyph); } -float TextServerAdvanced::_get_extra_advance(RID p_font_rid, int p_font_size) const { +double TextServerAdvanced::_get_extra_advance(RID p_font_rid, int p_font_size) const { const FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0.0); @@ -2334,13 +2404,13 @@ float TextServerAdvanced::_get_extra_advance(RID p_font_rid, int p_font_size) co Vector2i size = _get_size(fd, p_font_size); if (fd->embolden != 0.0) { - return fd->embolden * float(size.x) / 64.0; + return fd->embolden * double(size.x) / 64.0; } else { return 0.0; } } -Vector2 TextServerAdvanced::font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const { +Vector2 TextServerAdvanced::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -2356,11 +2426,11 @@ Vector2 TextServerAdvanced::font_get_glyph_advance(RID p_font_rid, int p_size, i Vector2 ea; if (fd->embolden != 0.0) { - ea.x = fd->embolden * float(size.x) / 64.0; + ea.x = fd->embolden * double(size.x) / 64.0; } if (fd->msdf) { - return (gl[p_glyph].advance + ea) * (float)p_size / (float)fd->msdf_source_size; + return (gl[p_glyph].advance + ea) * (double)p_size / (double)fd->msdf_source_size; } else if ((fd->subpixel_positioning == SUBPIXEL_POSITIONING_DISABLED) || (fd->subpixel_positioning == SUBPIXEL_POSITIONING_AUTO && size.x > SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE)) { return (gl[p_glyph].advance + ea).round(); } else { @@ -2368,7 +2438,7 @@ Vector2 TextServerAdvanced::font_get_glyph_advance(RID p_font_rid, int p_size, i } } -void TextServerAdvanced::font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) { +void TextServerAdvanced::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2383,7 +2453,7 @@ void TextServerAdvanced::font_set_glyph_advance(RID p_font_rid, int p_size, int3 gl[p_glyph].found = true; } -Vector2 TextServerAdvanced::font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerAdvanced::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -2398,13 +2468,13 @@ Vector2 TextServerAdvanced::font_get_glyph_offset(RID p_font_rid, const Vector2i const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.position * (float)p_size.x / (float)fd->msdf_source_size; + return gl[p_glyph].rect.position * (double)p_size.x / (double)fd->msdf_source_size; } else { return gl[p_glyph].rect.position; } } -void TextServerAdvanced::font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) { +void TextServerAdvanced::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2419,7 +2489,7 @@ void TextServerAdvanced::font_set_glyph_offset(RID p_font_rid, const Vector2i &p gl[p_glyph].found = true; } -Vector2 TextServerAdvanced::font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerAdvanced::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -2434,13 +2504,13 @@ Vector2 TextServerAdvanced::font_get_glyph_size(RID p_font_rid, const Vector2i & const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.size * (float)p_size.x / (float)fd->msdf_source_size; + return gl[p_glyph].rect.size * (double)p_size.x / (double)fd->msdf_source_size; } else { return gl[p_glyph].rect.size; } } -void TextServerAdvanced::font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) { +void TextServerAdvanced::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2455,7 +2525,7 @@ void TextServerAdvanced::font_set_glyph_size(RID p_font_rid, const Vector2i &p_s gl[p_glyph].found = true; } -Rect2 TextServerAdvanced::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Rect2 TextServerAdvanced::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Rect2()); @@ -2471,7 +2541,7 @@ Rect2 TextServerAdvanced::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i return gl[p_glyph].uv_rect; } -void TextServerAdvanced::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) { +void TextServerAdvanced::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2486,7 +2556,7 @@ void TextServerAdvanced::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i & gl[p_glyph].found = true; } -int TextServerAdvanced::font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +int64_t TextServerAdvanced::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, -1); @@ -2502,7 +2572,7 @@ int TextServerAdvanced::font_get_glyph_texture_idx(RID p_font_rid, const Vector2 return gl[p_glyph].texture_idx; } -void TextServerAdvanced::font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) { +void TextServerAdvanced::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2517,7 +2587,7 @@ void TextServerAdvanced::font_set_glyph_texture_idx(RID p_font_rid, const Vector gl[p_glyph].found = true; } -Dictionary TextServerAdvanced::font_get_glyph_contours(RID p_font_rid, int p_size, int32_t p_index) const { +Dictionary TextServerAdvanced::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -2526,20 +2596,19 @@ Dictionary TextServerAdvanced::font_get_glyph_contours(RID p_font_rid, int p_siz ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Dictionary()); - Vector<Vector3> points; - Vector<int32_t> contours; + PackedVector3Array points; + PackedInt32Array contours; bool orientation; #ifdef MODULE_FREETYPE_ENABLED - int error = FT_Load_Glyph(fd->cache[size]->face, p_index, FT_LOAD_NO_BITMAP | (fd->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)); - ERR_FAIL_COND_V(error, Dictionary()); + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. - points.clear(); - contours.clear(); + int error = FT_Load_Glyph(fd->cache[size]->face, index, FT_LOAD_NO_BITMAP | (fd->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)); + ERR_FAIL_COND_V(error, Dictionary()); - float h = fd->cache[size]->ascent; - float scale = (1.0 / 64.0) / fd->cache[size]->oversampling * fd->cache[size]->scale; + double h = fd->cache[size]->ascent; + double scale = (1.0 / 64.0) / fd->cache[size]->oversampling * fd->cache[size]->scale; if (fd->msdf) { - scale = scale * (float)p_size / (float)fd->msdf_source_size; + scale = scale * (double)p_size / (double)fd->msdf_source_size; } for (short i = 0; i < fd->cache[size]->face->glyph->outline.n_points; i++) { points.push_back(Vector3(fd->cache[size]->face->glyph->outline.points[i].x * scale, h - fd->cache[size]->face->glyph->outline.points[i].y * scale, FT_CURVE_TAG(fd->cache[size]->face->glyph->outline.tags[i]))); @@ -2559,7 +2628,7 @@ Dictionary TextServerAdvanced::font_get_glyph_contours(RID p_font_rid, int p_siz return out; } -Array TextServerAdvanced::font_get_kerning_list(RID p_font_rid, int p_size) const { +Array TextServerAdvanced::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); @@ -2569,13 +2638,13 @@ Array TextServerAdvanced::font_get_kerning_list(RID p_font_rid, int p_size) cons ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Array()); Array ret; - for (const Map<Vector2i, Vector2>::Element *E = fd->cache[size]->kerning_map.front(); E; E = E->next()) { - ret.push_back(E->key()); + for (const KeyValue<Vector2i, FontDataForSizeAdvanced *> &E : fd->cache) { + ret.push_back(E.key); } return ret; } -void TextServerAdvanced::font_clear_kerning_map(RID p_font_rid, int p_size) { +void TextServerAdvanced::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2586,7 +2655,7 @@ void TextServerAdvanced::font_clear_kerning_map(RID p_font_rid, int p_size) { fd->cache[size]->kerning_map.clear(); } -void TextServerAdvanced::font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) { +void TextServerAdvanced::font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2597,7 +2666,7 @@ void TextServerAdvanced::font_remove_kerning(RID p_font_rid, int p_size, const V fd->cache[size]->kerning_map.erase(p_glyph_pair); } -void TextServerAdvanced::font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { +void TextServerAdvanced::font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2608,7 +2677,7 @@ void TextServerAdvanced::font_set_kerning(RID p_font_rid, int p_size, const Vect fd->cache[size]->kerning_map[p_glyph_pair] = p_kerning; } -Vector2 TextServerAdvanced::font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const { +Vector2 TextServerAdvanced::font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -2621,7 +2690,7 @@ Vector2 TextServerAdvanced::font_get_kerning(RID p_font_rid, int p_size, const V if (kern.has(p_glyph_pair)) { if (fd->msdf) { - return kern[p_glyph_pair] * (float)p_size / (float)fd->msdf_source_size; + return kern[p_glyph_pair] * (double)p_size / (double)fd->msdf_source_size; } else { return kern[p_glyph_pair]; } @@ -2631,7 +2700,7 @@ Vector2 TextServerAdvanced::font_get_kerning(RID p_font_rid, int p_size, const V FT_Vector delta; FT_Get_Kerning(fd->cache[size]->face, p_glyph_pair.x, p_glyph_pair.y, FT_KERNING_DEFAULT, &delta); if (fd->msdf) { - return Vector2(delta.x, delta.y) * (float)p_size / (float)fd->msdf_source_size; + return Vector2(delta.x, delta.y) * (double)p_size / (double)fd->msdf_source_size; } else { return Vector2(delta.x, delta.y); } @@ -2641,7 +2710,7 @@ Vector2 TextServerAdvanced::font_get_kerning(RID p_font_rid, int p_size, const V return Vector2(); } -int32_t TextServerAdvanced::font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector) const { +int64_t TextServerAdvanced::font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); ERR_FAIL_COND_V_MSG((p_char >= 0xd800 && p_char <= 0xdfff) || (p_char > 0x10ffff), 0, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_char, 16) + "."); @@ -2659,14 +2728,14 @@ int32_t TextServerAdvanced::font_get_glyph_index(RID p_font_rid, int p_size, cha return FT_Get_Char_Index(fd->cache[size]->face, p_char); } } else { - return (int32_t)p_char; + return (int64_t)p_char; } #else - return (int32_t)p_char; + return (int64_t)p_char; #endif } -bool TextServerAdvanced::font_has_char(RID p_font_rid, char32_t p_char) const { +bool TextServerAdvanced::font_has_char(const RID &p_font_rid, int64_t p_char) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); ERR_FAIL_COND_V_MSG((p_char >= 0xd800 && p_char <= 0xdfff) || (p_char > 0x10ffff), false, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_char, 16) + "."); @@ -2685,7 +2754,7 @@ bool TextServerAdvanced::font_has_char(RID p_font_rid, char32_t p_char) const { return (at_size) ? at_size->glyph_map.has((int32_t)p_char) : false; } -String TextServerAdvanced::font_get_supported_chars(RID p_font_rid) const { +String TextServerAdvanced::font_get_supported_chars(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -2702,7 +2771,7 @@ String TextServerAdvanced::font_get_supported_chars(RID p_font_rid) const { FT_ULong charcode = FT_Get_First_Char(at_size->face, &gindex); while (gindex != 0) { if (charcode != 0) { - chars += char32_t(charcode); + chars = chars + String::chr(charcode); } charcode = FT_Get_Next_Char(at_size->face, charcode, &gindex); } @@ -2713,13 +2782,13 @@ String TextServerAdvanced::font_get_supported_chars(RID p_font_rid) const { const HashMap<int32_t, FontGlyph> &gl = at_size->glyph_map; const int32_t *E = nullptr; while ((E = gl.next(E))) { - chars += char32_t(*E); + chars = chars + String::chr(*E); } } return chars; } -void TextServerAdvanced::font_render_range(RID p_font_rid, const Vector2i &p_size, char32_t p_start, char32_t p_end) { +void TextServerAdvanced::font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); ERR_FAIL_COND_MSG((p_start >= 0xd800 && p_start <= 0xdfff) || (p_start > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_start, 16) + "."); @@ -2728,7 +2797,7 @@ void TextServerAdvanced::font_render_range(RID p_font_rid, const Vector2i &p_siz MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - for (char32_t i = p_start; i <= p_end; i++) { + for (int64_t i = p_start; i <= p_end; i++) { #ifdef MODULE_FREETYPE_ENABLED int32_t idx = FT_Get_Char_Index(fd->cache[size]->face, i); if (fd->cache[size]->face) { @@ -2752,7 +2821,7 @@ void TextServerAdvanced::font_render_range(RID p_font_rid, const Vector2i &p_siz } } -void TextServerAdvanced::font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) { +void TextServerAdvanced::font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2760,7 +2829,7 @@ void TextServerAdvanced::font_render_glyph(RID p_font_rid, const Vector2i &p_siz Vector2i size = _get_size_outline(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); #ifdef MODULE_FREETYPE_ENABLED - int32_t idx = p_index; + int32_t idx = p_index & 0xffffff; // Remove subpixel shifts. if (fd->cache[size]->face) { if (fd->msdf) { _ensure_glyph(fd, size, (int32_t)idx); @@ -2781,7 +2850,7 @@ void TextServerAdvanced::font_render_glyph(RID p_font_rid, const Vector2i &p_siz #endif } -void TextServerAdvanced::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { +void TextServerAdvanced::font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2789,7 +2858,7 @@ void TextServerAdvanced::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz Vector2i size = _get_size(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - int32_t index = p_index; + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. #ifdef MODULE_FREETYPE_ENABLED if (!fd->msdf && fd->cache[size]->face) { @@ -2822,8 +2891,8 @@ void TextServerAdvanced::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz RID texture = fd->cache[size]->textures[gl.texture_idx].texture->get_rid(); if (fd->msdf) { Point2 cpos = p_pos; - cpos += gl.rect.position * (float)p_size / (float)fd->msdf_source_size; - Size2 csize = gl.rect.size * (float)p_size / (float)fd->msdf_source_size; + cpos += gl.rect.position * (double)p_size / (double)fd->msdf_source_size; + Size2 csize = gl.rect.size * (double)p_size / (double)fd->msdf_source_size; RenderingServer::get_singleton()->canvas_item_add_msdf_texture_rect_region(p_canvas, Rect2(cpos, csize), texture, gl.uv_rect, modulate, 0, fd->msdf_range); } else { Point2 cpos = p_pos; @@ -2844,7 +2913,7 @@ void TextServerAdvanced::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz } } -void TextServerAdvanced::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { +void TextServerAdvanced::font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2852,7 +2921,7 @@ void TextServerAdvanced::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i Vector2i size = _get_size_outline(fd, Vector2i(p_size, p_outline_size)); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - int32_t index = p_index; + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. #ifdef MODULE_FREETYPE_ENABLED if (!fd->msdf && fd->cache[size]->face) { @@ -2885,8 +2954,8 @@ void TextServerAdvanced::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i RID texture = fd->cache[size]->textures[gl.texture_idx].texture->get_rid(); if (fd->msdf) { Point2 cpos = p_pos; - cpos += gl.rect.position * (float)p_size / (float)fd->msdf_source_size; - Size2 csize = gl.rect.size * (float)p_size / (float)fd->msdf_source_size; + cpos += gl.rect.position * (double)p_size / (double)fd->msdf_source_size; + Size2 csize = gl.rect.size * (double)p_size / (double)fd->msdf_source_size; RenderingServer::get_singleton()->canvas_item_add_msdf_texture_rect_region(p_canvas, Rect2(cpos, csize), texture, gl.uv_rect, modulate, p_outline_size * 2, fd->msdf_range); } else { Point2 cpos = p_pos; @@ -2907,7 +2976,7 @@ void TextServerAdvanced::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i } } -bool TextServerAdvanced::font_is_language_supported(RID p_font_rid, const String &p_language) const { +bool TextServerAdvanced::font_is_language_supported(const RID &p_font_rid, const String &p_language) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2919,7 +2988,7 @@ bool TextServerAdvanced::font_is_language_supported(RID p_font_rid, const String } } -void TextServerAdvanced::font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) { +void TextServerAdvanced::font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2927,7 +2996,7 @@ void TextServerAdvanced::font_set_language_support_override(RID p_font_rid, cons fd->language_support_overrides[p_language] = p_supported; } -bool TextServerAdvanced::font_get_language_support_override(RID p_font_rid, const String &p_language) { +bool TextServerAdvanced::font_get_language_support_override(const RID &p_font_rid, const String &p_language) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2935,7 +3004,7 @@ bool TextServerAdvanced::font_get_language_support_override(RID p_font_rid, cons return fd->language_support_overrides[p_language]; } -void TextServerAdvanced::font_remove_language_support_override(RID p_font_rid, const String &p_language) { +void TextServerAdvanced::font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2943,19 +3012,19 @@ void TextServerAdvanced::font_remove_language_support_override(RID p_font_rid, c fd->language_support_overrides.erase(p_language); } -Vector<String> TextServerAdvanced::font_get_language_support_overrides(RID p_font_rid) { +PackedStringArray TextServerAdvanced::font_get_language_support_overrides(const RID &p_font_rid) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector<String>()); + ERR_FAIL_COND_V(!fd, PackedStringArray()); MutexLock lock(fd->mutex); - Vector<String> out; + PackedStringArray out; for (const KeyValue<String, bool> &E : fd->language_support_overrides) { out.push_back(E.key); } return out; } -bool TextServerAdvanced::font_is_script_supported(RID p_font_rid, const String &p_script) const { +bool TextServerAdvanced::font_is_script_supported(const RID &p_font_rid, const String &p_script) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2969,7 +3038,7 @@ bool TextServerAdvanced::font_is_script_supported(RID p_font_rid, const String & } } -void TextServerAdvanced::font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) { +void TextServerAdvanced::font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2977,7 +3046,7 @@ void TextServerAdvanced::font_set_script_support_override(RID p_font_rid, const fd->script_support_overrides[p_script] = p_supported; } -bool TextServerAdvanced::font_get_script_support_override(RID p_font_rid, const String &p_script) { +bool TextServerAdvanced::font_get_script_support_override(const RID &p_font_rid, const String &p_script) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2985,7 +3054,7 @@ bool TextServerAdvanced::font_get_script_support_override(RID p_font_rid, const return fd->script_support_overrides[p_script]; } -void TextServerAdvanced::font_remove_script_support_override(RID p_font_rid, const String &p_script) { +void TextServerAdvanced::font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2993,19 +3062,19 @@ void TextServerAdvanced::font_remove_script_support_override(RID p_font_rid, con fd->script_support_overrides.erase(p_script); } -Vector<String> TextServerAdvanced::font_get_script_support_overrides(RID p_font_rid) { +PackedStringArray TextServerAdvanced::font_get_script_support_overrides(const RID &p_font_rid) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector<String>()); + ERR_FAIL_COND_V(!fd, PackedStringArray()); MutexLock lock(fd->mutex); - Vector<String> out; - for (const Map<String, bool>::Element *E = fd->script_support_overrides.front(); E; E = E->next()) { - out.push_back(E->key()); + PackedStringArray out; + for (const KeyValue<String, bool> &E : fd->script_support_overrides) { + out.push_back(E.key); } return out; } -void TextServerAdvanced::font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) { +void TextServerAdvanced::font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -3015,7 +3084,7 @@ void TextServerAdvanced::font_set_opentype_feature_overrides(RID p_font_rid, con fd->feature_overrides = p_overrides; } -Dictionary TextServerAdvanced::font_get_opentype_feature_overrides(RID p_font_rid) const { +Dictionary TextServerAdvanced::font_get_opentype_feature_overrides(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -3023,7 +3092,7 @@ Dictionary TextServerAdvanced::font_get_opentype_feature_overrides(RID p_font_ri return fd->feature_overrides; } -Dictionary TextServerAdvanced::font_supported_feature_list(RID p_font_rid) const { +Dictionary TextServerAdvanced::font_supported_feature_list(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -3033,7 +3102,7 @@ Dictionary TextServerAdvanced::font_supported_feature_list(RID p_font_rid) const return fd->supported_features; } -Dictionary TextServerAdvanced::font_supported_variation_list(RID p_font_rid) const { +Dictionary TextServerAdvanced::font_supported_variation_list(const RID &p_font_rid) const { FontDataAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -3043,11 +3112,11 @@ Dictionary TextServerAdvanced::font_supported_variation_list(RID p_font_rid) con return fd->supported_varaitions; } -float TextServerAdvanced::font_get_global_oversampling() const { +double TextServerAdvanced::font_get_global_oversampling() const { return oversampling; } -void TextServerAdvanced::font_set_global_oversampling(float p_oversampling) { +void TextServerAdvanced::font_set_global_oversampling(double p_oversampling) { _THREAD_SAFE_METHOD_ if (oversampling != p_oversampling) { oversampling = p_oversampling; @@ -3075,10 +3144,10 @@ void TextServerAdvanced::font_set_global_oversampling(float p_oversampling) { /* Shaped text buffer interface */ /*************************************************************************/ -int TextServerAdvanced::_convert_pos(const ShapedTextDataAdvanced *p_sd, int p_pos) const { - int32_t limit = p_pos; +int64_t TextServerAdvanced::_convert_pos(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const { + int64_t limit = p_pos; if (p_sd->text.length() != p_sd->utf16.length()) { - const UChar *data = p_sd->utf16.ptr(); + const UChar *data = p_sd->utf16.get_data(); for (int i = 0; i < p_pos; i++) { if (U16_IS_LEAD(data[i])) { limit--; @@ -3088,11 +3157,11 @@ int TextServerAdvanced::_convert_pos(const ShapedTextDataAdvanced *p_sd, int p_p return limit; } -int TextServerAdvanced::_convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int p_pos) const { - int32_t limit = p_pos; +int64_t TextServerAdvanced::_convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const { + int64_t limit = p_pos; if (p_sd->text.length() != p_sd->utf16.length()) { for (int i = 0; i < p_pos; i++) { - if (p_sd->text[i] > 0xFFFF) { + if (p_sd->text[i] > 0xffff) { limit++; } } @@ -3106,11 +3175,11 @@ void TextServerAdvanced::invalidate(TextServerAdvanced::ShapedTextDataAdvanced * p_shaped->line_breaks_valid = false; p_shaped->justification_ops_valid = false; p_shaped->text_trimmed = false; - p_shaped->ascent = 0.f; - p_shaped->descent = 0.f; - p_shaped->width = 0.f; - p_shaped->upos = 0.f; - p_shaped->uthk = 0.f; + p_shaped->ascent = 0.0; + p_shaped->descent = 0.0; + p_shaped->width = 0.0; + p_shaped->upos = 0.0; + p_shaped->uthk = 0.0; p_shaped->glyphs.clear(); p_shaped->glyphs_logical.clear(); p_shaped->overrun_trim_data = TrimData(); @@ -3161,7 +3230,7 @@ RID TextServerAdvanced::create_shaped_text(TextServer::Direction p_direction, Te return shaped_owner.make_rid(sd); } -void TextServerAdvanced::shaped_text_clear(RID p_shaped) { +void TextServerAdvanced::shaped_text_clear(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3176,7 +3245,7 @@ void TextServerAdvanced::shaped_text_clear(RID p_shaped) { invalidate(sd, true); } -void TextServerAdvanced::shaped_text_set_direction(RID p_shaped, TextServer::Direction p_direction) { +void TextServerAdvanced::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3190,7 +3259,7 @@ void TextServerAdvanced::shaped_text_set_direction(RID p_shaped, TextServer::Dir } } -TextServer::Direction TextServerAdvanced::shaped_text_get_direction(RID p_shaped) const { +TextServer::Direction TextServerAdvanced::shaped_text_get_direction(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, TextServer::DIRECTION_LTR); @@ -3198,7 +3267,7 @@ TextServer::Direction TextServerAdvanced::shaped_text_get_direction(RID p_shaped return sd->direction; } -TextServer::Direction TextServerAdvanced::shaped_text_get_inferred_direction(RID p_shaped) const { +TextServer::Direction TextServerAdvanced::shaped_text_get_inferred_direction(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, TextServer::DIRECTION_LTR); @@ -3206,7 +3275,7 @@ TextServer::Direction TextServerAdvanced::shaped_text_get_inferred_direction(RID return sd->para_direction; } -void TextServerAdvanced::shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) { +void TextServerAdvanced::shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3220,14 +3289,14 @@ void TextServerAdvanced::shaped_text_set_custom_punctuation(RID p_shaped, const } } -String TextServerAdvanced::shaped_text_get_custom_punctuation(RID p_shaped) const { +String TextServerAdvanced::shaped_text_get_custom_punctuation(const RID &p_shaped) const { _THREAD_SAFE_METHOD_ const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, String()); return sd->custom_punct; } -void TextServerAdvanced::shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) { +void TextServerAdvanced::shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3242,7 +3311,7 @@ void TextServerAdvanced::shaped_text_set_bidi_override(RID p_shaped, const Array invalidate(sd, false); } -void TextServerAdvanced::shaped_text_set_orientation(RID p_shaped, TextServer::Orientation p_orientation) { +void TextServerAdvanced::shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3256,7 +3325,7 @@ void TextServerAdvanced::shaped_text_set_orientation(RID p_shaped, TextServer::O } } -void TextServerAdvanced::shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) { +void TextServerAdvanced::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3268,7 +3337,7 @@ void TextServerAdvanced::shaped_text_set_preserve_invalid(RID p_shaped, bool p_e } } -bool TextServerAdvanced::shaped_text_get_preserve_invalid(RID p_shaped) const { +bool TextServerAdvanced::shaped_text_get_preserve_invalid(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3276,7 +3345,7 @@ bool TextServerAdvanced::shaped_text_get_preserve_invalid(RID p_shaped) const { return sd->preserve_invalid; } -void TextServerAdvanced::shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) { +void TextServerAdvanced::shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -3290,7 +3359,7 @@ void TextServerAdvanced::shaped_text_set_preserve_control(RID p_shaped, bool p_e } } -bool TextServerAdvanced::shaped_text_get_preserve_control(RID p_shaped) const { +bool TextServerAdvanced::shaped_text_get_preserve_control(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3298,7 +3367,7 @@ bool TextServerAdvanced::shaped_text_get_preserve_control(RID p_shaped) const { return sd->preserve_control; } -TextServer::Orientation TextServerAdvanced::shaped_text_get_orientation(RID p_shaped) const { +TextServer::Orientation TextServerAdvanced::shaped_text_get_orientation(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, TextServer::ORIENTATION_HORIZONTAL); @@ -3306,25 +3375,25 @@ TextServer::Orientation TextServerAdvanced::shaped_text_get_orientation(RID p_sh return sd->orientation; } -int TextServerAdvanced::shaped_get_span_count(RID p_shaped) const { +int64_t TextServerAdvanced::shaped_get_span_count(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, 0); return sd->spans.size(); } -Variant TextServerAdvanced::shaped_get_span_meta(RID p_shaped, int p_index) const { +Variant TextServerAdvanced::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Variant()); ERR_FAIL_INDEX_V(p_index, sd->spans.size(), Variant()); return sd->spans[p_index].meta; } -void TextServerAdvanced::shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features) { +void TextServerAdvanced::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); - ShapedTextDataAdvanced::Span &span = sd->spans.write[p_index]; + ShapedTextDataAdvanced::Span &span = sd->spans.ptrw()[p_index]; bool changed = (span.font_size != p_size) || (span.features != p_opentype_features) || (p_fonts.size() != span.fonts.size()); if (!changed) { for (int i = 0; i < p_fonts.size(); i++) { @@ -3340,7 +3409,7 @@ void TextServerAdvanced::shaped_set_span_update_font(RID p_shaped, int p_index, } } -bool TextServerAdvanced::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { +bool TextServerAdvanced::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); ERR_FAIL_COND_V(p_size <= 0, false); @@ -3368,14 +3437,14 @@ bool TextServerAdvanced::shaped_text_add_string(RID p_shaped, const String &p_te span.meta = p_meta; sd->spans.push_back(span); - sd->text += p_text; + sd->text = sd->text + p_text; sd->end += p_text.length(); invalidate(sd, true); return true; } -bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) { +bool TextServerAdvanced::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3397,7 +3466,7 @@ bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, con obj.pos = span.start; sd->spans.push_back(span); - sd->text += String::chr(0xfffc).repeat(p_length); + sd->text = sd->text + String::chr(0xfffc).repeat(p_length); sd->end += p_length; sd->objects[p_key] = obj; invalidate(sd, true); @@ -3405,7 +3474,7 @@ bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, con return true; } -bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) { +bool TextServerAdvanced::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3459,8 +3528,8 @@ bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, if (sd->orientation == ORIENTATION_HORIZONTAL) { sd->ascent = MAX(sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y); } else { - sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); - sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); + sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); + sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); } } sd->width += gl.advance * gl.repeat; @@ -3473,8 +3542,8 @@ bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, void TextServerAdvanced::_realign(ShapedTextDataAdvanced *p_sd) const { // Align embedded objects to baseline. - float full_ascent = p_sd->ascent; - float full_descent = p_sd->descent; + double full_ascent = p_sd->ascent; + double full_descent = p_sd->descent; for (KeyValue<Variant, ShapedTextDataAdvanced::EmbeddedObject> &E : p_sd->objects) { if ((E.value.pos >= p_sd->start) && (E.value.pos < p_sd->end)) { if (p_sd->orientation == ORIENTATION_HORIZONTAL) { @@ -3540,7 +3609,7 @@ void TextServerAdvanced::_realign(ShapedTextDataAdvanced *p_sd) const { p_sd->descent = full_descent; } -RID TextServerAdvanced::shaped_text_substr(RID p_shaped, int p_start, int p_length) const { +RID TextServerAdvanced::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, RID()); @@ -3571,7 +3640,7 @@ RID TextServerAdvanced::shaped_text_substr(RID p_shaped, int p_start, int p_leng return shaped_owner.make_rid(new_sd); } -bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int p_start, int p_length) const { +bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_length) const { if (p_new_sd->valid) { return true; } @@ -3661,8 +3730,8 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S if (p_new_sd->orientation == ORIENTATION_HORIZONTAL) { p_new_sd->ascent = MAX(p_new_sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y); } else { - p_new_sd->ascent = MAX(p_new_sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); - p_new_sd->descent = MAX(p_new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); + p_new_sd->ascent = MAX(p_new_sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); + p_new_sd->descent = MAX(p_new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); } } p_new_sd->width += gl.advance * gl.repeat; @@ -3680,7 +3749,7 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S return true; } -RID TextServerAdvanced::shaped_text_get_parent(RID p_shaped) const { +RID TextServerAdvanced::shaped_text_get_parent(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, RID()); @@ -3688,9 +3757,9 @@ RID TextServerAdvanced::shaped_text_get_parent(RID p_shaped) const { return sd->parent; } -float TextServerAdvanced::shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags) { +double TextServerAdvanced::shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3729,7 +3798,7 @@ float TextServerAdvanced::shaped_text_fit_to_width(RID p_shaped, float p_width, } } - float justification_width; + double justification_width; if ((p_jst_flags & JUSTIFICATION_CONSTRAIN_ELLIPSIS) == JUSTIFICATION_CONSTRAIN_ELLIPSIS) { if (sd->overrun_trim_data.trim_pos >= 0) { if (sd->para_direction == DIRECTION_RTL) { @@ -3785,7 +3854,7 @@ float TextServerAdvanced::shaped_text_fit_to_width(RID p_shaped, float p_width, } if ((elongation_count > 0) && ((p_jst_flags & JUSTIFICATION_KASHIDA) == JUSTIFICATION_KASHIDA)) { - float delta_width_per_kashida = (p_width - justification_width) / elongation_count; + double delta_width_per_kashida = (p_width - justification_width) / elongation_count; for (int i = start_pos; i <= end_pos; i++) { Glyph &gl = sd->glyphs.write[i]; if (gl.count > 0) { @@ -3805,17 +3874,17 @@ float TextServerAdvanced::shaped_text_fit_to_width(RID p_shaped, float p_width, } } } - float adv_remain = 0; + double adv_remain = 0; if ((space_count > 0) && ((p_jst_flags & JUSTIFICATION_WORD_BOUND) == JUSTIFICATION_WORD_BOUND)) { - float delta_width_per_space = (p_width - justification_width) / space_count; + double delta_width_per_space = (p_width - justification_width) / space_count; for (int i = start_pos; i <= end_pos; i++) { Glyph &gl = sd->glyphs.write[i]; if (gl.count > 0) { if ((gl.flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE) { - float old_adv = gl.advance; - float new_advance; + double old_adv = gl.advance; + double new_advance; if ((gl.flags & GRAPHEME_IS_VIRTUAL) == GRAPHEME_IS_VIRTUAL) { - new_advance = MAX(gl.advance + delta_width_per_space, 0.f); + new_advance = MAX(gl.advance + delta_width_per_space, 0.0); } else { new_advance = MAX(gl.advance + delta_width_per_space, 0.1 * gl.font_size); } @@ -3845,9 +3914,9 @@ float TextServerAdvanced::shaped_text_fit_to_width(RID p_shaped, float p_width, return Math::ceil(justification_width); } -float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) { +double TextServerAdvanced::shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3859,12 +3928,12 @@ float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat3 for (int i = 0; i < p_tab_stops.size(); i++) { if (p_tab_stops[i] <= 0) { - return 0.f; + return 0.0; } } int tab_index = 0; - float off = 0.f; + double off = 0.0; int start, end, delta; if (sd->para_direction == DIRECTION_LTR) { @@ -3881,7 +3950,7 @@ float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat3 for (int i = start; i != end; i += delta) { if ((gl[i].flags & GRAPHEME_IS_TAB) == GRAPHEME_IS_TAB) { - float tab_off = 0.f; + double tab_off = 0.0; while (tab_off <= off) { tab_off += p_tab_stops[tab_index]; tab_index++; @@ -3889,7 +3958,7 @@ float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat3 tab_index = 0; } } - float old_adv = gl[i].advance; + double old_adv = gl[i].advance; gl[i].advance = tab_off - off; sd->width += gl[i].advance - old_adv; off = 0; @@ -3898,10 +3967,10 @@ float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat3 off += gl[i].advance * gl[i].repeat; } - return 0.f; + return 0.0; } -void TextServerAdvanced::shaped_text_overrun_trim_to_width(RID p_shaped_line, float p_width, uint16_t p_trim_flags) { +void TextServerAdvanced::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, int64_t p_trim_flags) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped_line); ERR_FAIL_COND_MSG(!sd, "ShapedTextDataAdvanced invalid."); @@ -3947,20 +4016,20 @@ void TextServerAdvanced::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl // Find usable fonts, if fonts from the last glyph do not have required chars. RID dot_gl_font_rid = sd_glyphs[sd_size - 1].font_rid; if (!font_has_char(dot_gl_font_rid, '.')) { - const Vector<RID> &fonts = spans[spans.size() - 1].fonts; - for (const RID &font : fonts) { - if (font_has_char(font, '.')) { - dot_gl_font_rid = font; + const Array &fonts = spans[spans.size() - 1].fonts; + for (int i = 0; i < fonts.size(); i++) { + if (font_has_char(fonts[i], '.')) { + dot_gl_font_rid = fonts[i]; break; } } } RID whitespace_gl_font_rid = sd_glyphs[sd_size - 1].font_rid; if (!font_has_char(whitespace_gl_font_rid, '.')) { - const Vector<RID> &fonts = spans[spans.size() - 1].fonts; - for (const RID &font : fonts) { - if (font_has_char(font, ' ')) { - whitespace_gl_font_rid = font; + const Array &fonts = spans[spans.size() - 1].fonts; + for (int i = 0; i < fonts.size(); i++) { + if (font_has_char(fonts[i], ' ')) { + whitespace_gl_font_rid = fonts[i]; break; } } @@ -3977,7 +4046,7 @@ void TextServerAdvanced::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl } int ell_min_characters = 6; - float width = sd->width; + double width = sd->width; bool is_rtl = sd->para_direction == DIRECTION_RTL; @@ -4063,7 +4132,7 @@ void TextServerAdvanced::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl } } -int TextServerAdvanced::shaped_text_get_trim_pos(RID p_shaped) const { +int64_t TextServerAdvanced::shaped_text_get_trim_pos(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataAdvanced invalid."); @@ -4071,7 +4140,7 @@ int TextServerAdvanced::shaped_text_get_trim_pos(RID p_shaped) const { return sd->overrun_trim_data.trim_pos; } -int TextServerAdvanced::shaped_text_get_ellipsis_pos(RID p_shaped) const { +int64_t TextServerAdvanced::shaped_text_get_ellipsis_pos(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataAdvanced invalid."); @@ -4079,7 +4148,7 @@ int TextServerAdvanced::shaped_text_get_ellipsis_pos(RID p_shaped) const { return sd->overrun_trim_data.ellipsis_pos; } -const Glyph *TextServerAdvanced::shaped_text_get_ellipsis_glyphs(RID p_shaped) const { +const Glyph *TextServerAdvanced::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, nullptr, "ShapedTextDataAdvanced invalid."); @@ -4087,7 +4156,7 @@ const Glyph *TextServerAdvanced::shaped_text_get_ellipsis_glyphs(RID p_shaped) c return sd->overrun_trim_data.ellipsis_glyph_buf.ptr(); } -int TextServerAdvanced::shaped_text_get_ellipsis_glyph_count(RID p_shaped) const { +int64_t TextServerAdvanced::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, 0, "ShapedTextDataAdvanced invalid."); @@ -4095,7 +4164,7 @@ int TextServerAdvanced::shaped_text_get_ellipsis_glyph_count(RID p_shaped) const return sd->overrun_trim_data.ellipsis_glyph_buf.size(); } -bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { +bool TextServerAdvanced::shaped_text_update_breaks(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -4108,7 +4177,7 @@ bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { return true; // Nothing to do. } - const UChar *data = sd->utf16.ptr(); + const UChar *data = sd->utf16.get_data(); if (!sd->break_ops_valid) { sd->breaks.clear(); @@ -4171,7 +4240,7 @@ bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { sd_glyphs[i].flags |= GRAPHEME_IS_SPACE; } if (c_punct_size == 0) { - if (u_ispunct(c) && c != 0x005F) { + if (u_ispunct(c) && c != 0x005f) { sd_glyphs[i].flags |= GRAPHEME_IS_PUNCTUATION; } } else { @@ -4237,10 +4306,10 @@ bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { return sd->line_breaks_valid; } -_FORCE_INLINE_ int _generate_kashida_justification_opportunies(const String &p_data, int p_start, int p_end) { - int kashida_pos = -1; +_FORCE_INLINE_ int64_t _generate_kashida_justification_opportunies(const String &p_data, int64_t p_start, int64_t p_end) { + int64_t kashida_pos = -1; int8_t priority = 100; - int i = p_start; + int64_t i = p_start; char32_t pc = 0; @@ -4256,7 +4325,7 @@ _FORCE_INLINE_ int _generate_kashida_justification_opportunies(const String &p_d priority = 0; } if (priority >= 1 && i < p_end - 1) { - if (is_seen_sad(c) && (p_data[i + 1] != 0x200C)) { + if (is_seen_sad(c) && (p_data[i + 1] != 0x200c)) { kashida_pos = i; priority = 1; } @@ -4312,7 +4381,7 @@ _FORCE_INLINE_ int _generate_kashida_justification_opportunies(const String &p_d return kashida_pos; } -bool TextServerAdvanced::shaped_text_update_justification_ops(RID p_shaped) { +bool TextServerAdvanced::shaped_text_update_justification_ops(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -4328,8 +4397,8 @@ bool TextServerAdvanced::shaped_text_update_justification_ops(RID p_shaped) { return true; // Nothing to do. } - const UChar *data = sd->utf16.ptr(); - int32_t data_size = sd->utf16.length(); + const UChar *data = sd->utf16.get_data(); + int data_size = sd->utf16.length(); if (!sd->js_ops_valid) { sd->jstops.clear(); @@ -4459,7 +4528,7 @@ bool TextServerAdvanced::shaped_text_update_justification_ops(RID p_shaped) { return sd->justification_ops_valid; } -Glyph TextServerAdvanced::_shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, RID p_font, int p_font_size) { +Glyph TextServerAdvanced::_shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, const RID &p_font, int64_t p_font_size) { hb_font_t *hb_font = _font_get_hb_handle(p_font, p_font_size); bool subpos = (font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_ONE_HALF) || (font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_AUTO && p_font_size <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE); ERR_FAIL_COND_V(hb_font == nullptr, Glyph()); @@ -4487,7 +4556,7 @@ Glyph TextServerAdvanced::_shape_single_glyph(ShapedTextDataAdvanced *p_sd, char gl.font_size = p_font_size; if (glyph_count > 0) { - float scale = font_get_scale(p_font, p_font_size); + double scale = font_get_scale(p_font, p_font_size); if (p_sd->orientation == ORIENTATION_HORIZONTAL) { if (subpos) { gl.advance = glyph_pos[0].x_advance / (64.0 / scale) + _get_extra_advance(p_font, p_font_size); @@ -4515,16 +4584,18 @@ Glyph TextServerAdvanced::_shape_single_glyph(ShapedTextDataAdvanced *p_sd, char } _FORCE_INLINE_ void TextServerAdvanced::_add_featuers(const Dictionary &p_source, Vector<hb_feature_t> &r_ftrs) { - for (const Variant *ftr = p_source.next(nullptr); ftr != nullptr; ftr = p_source.next(ftr)) { - int32_t values = p_source[*ftr]; - if (values >= 0) { + Array keys = p_source.keys(); + Array values = p_source.values(); + for (int i = 0; i < keys.size(); i++) { + int32_t value = values[i]; + if (value >= 0) { hb_feature_t feature; - if (ftr->get_type() == Variant::STRING) { - feature.tag = name_to_tag(*ftr); + if (keys[i].get_type() == Variant::STRING) { + feature.tag = name_to_tag(keys[i]); } else { - feature.tag = *ftr; + feature.tag = keys[i]; } - feature.value = values; + feature.value = value; feature.start = 0; feature.end = -1; r_ftrs.push_back(feature); @@ -4532,7 +4603,7 @@ _FORCE_INLINE_ void TextServerAdvanced::_add_featuers(const Dictionary &p_source } } -void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_start, int32_t p_end, hb_script_t p_script, hb_direction_t p_direction, Vector<RID> p_fonts, int p_span, int p_fb_index) { +void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, Array p_fonts, int64_t p_span, int64_t p_fb_index) { int fs = p_sd->spans[p_span].font_size; if (p_fb_index >= p_fonts.size()) { // Add fallback glyphs. @@ -4553,8 +4624,8 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_star p_sd->ascent = MAX(p_sd->ascent, get_hex_code_box_size(fs, gl.index).y); } else { gl.advance = get_hex_code_box_size(fs, gl.index).y; - p_sd->ascent = MAX(p_sd->ascent, Math::round(get_hex_code_box_size(fs, gl.index).x * 0.5f)); - p_sd->descent = MAX(p_sd->descent, Math::round(get_hex_code_box_size(fs, gl.index).x * 0.5f)); + p_sd->ascent = MAX(p_sd->ascent, Math::round(get_hex_code_box_size(fs, gl.index).x * 0.5)); + p_sd->descent = MAX(p_sd->descent, Math::round(get_hex_code_box_size(fs, gl.index).x * 0.5)); } p_sd->width += gl.advance; @@ -4566,10 +4637,10 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_star RID f = p_fonts[p_fb_index]; hb_font_t *hb_font = _font_get_hb_handle(f, fs); - float scale = font_get_scale(f, fs); - float sp_sp = font_get_spacing(f, fs, SPACING_SPACE); - float sp_gl = font_get_spacing(f, fs, SPACING_GLYPH); - float ea = _get_extra_advance(f, fs); + double scale = font_get_scale(f, fs); + double sp_sp = font_get_spacing(f, fs, SPACING_SPACE); + double sp_gl = font_get_spacing(f, fs, SPACING_GLYPH); + double ea = _get_extra_advance(f, fs); bool subpos = (font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_ONE_HALF) || (font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_AUTO && fs <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE); ERR_FAIL_COND(hb_font == nullptr); @@ -4703,7 +4774,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_star p_sd->ascent = MAX(p_sd->ascent, -w[i + j].y_off); p_sd->descent = MAX(p_sd->descent, w[i + j].y_off); } else { - float gla = Math::round(font_get_glyph_advance(f, fs, w[i + j].index).x * 0.5); + double gla = Math::round(font_get_glyph_advance(f, fs, w[i + j].index).x * 0.5); p_sd->ascent = MAX(p_sd->ascent, gla); p_sd->descent = MAX(p_sd->descent, gla); } @@ -4733,7 +4804,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_star } } -bool TextServerAdvanced::shaped_text_shape(RID p_shaped) { +bool TextServerAdvanced::shaped_text_shape(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -4757,7 +4828,7 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) { } sd->utf16 = sd->text.utf16(); - const UChar *data = sd->utf16.ptr(); + const UChar *data = sd->utf16.get_data(); // Create script iterator. if (sd->script_iter == nullptr) { @@ -4876,9 +4947,9 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) { } sd->glyphs.push_back(gl); } else { - Vector<RID> fonts; - Vector<RID> fonts_scr_only; - Vector<RID> fonts_no_match; + Array fonts; + Array fonts_scr_only; + Array fonts_no_match; int font_count = span.fonts.size(); for (int l = 0; l < font_count; l++) { if (font_is_script_supported(span.fonts[l], script)) { @@ -4906,7 +4977,7 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) { return sd->valid; } -bool TextServerAdvanced::shaped_text_is_ready(RID p_shaped) const { +bool TextServerAdvanced::shaped_text_is_ready(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -4914,7 +4985,7 @@ bool TextServerAdvanced::shaped_text_is_ready(RID p_shaped) const { return sd->valid; } -const Glyph *TextServerAdvanced::shaped_text_get_glyphs(RID p_shaped) const { +const Glyph *TextServerAdvanced::shaped_text_get_glyphs(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, nullptr); @@ -4925,7 +4996,7 @@ const Glyph *TextServerAdvanced::shaped_text_get_glyphs(RID p_shaped) const { return sd->glyphs.ptr(); } -int TextServerAdvanced::shaped_text_get_glyph_count(RID p_shaped) const { +int64_t TextServerAdvanced::shaped_text_get_glyph_count(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, 0); @@ -4936,7 +5007,7 @@ int TextServerAdvanced::shaped_text_get_glyph_count(RID p_shaped) const { return sd->glyphs.size(); } -const Glyph *TextServerAdvanced::shaped_text_sort_logical(RID p_shaped) { +const Glyph *TextServerAdvanced::shaped_text_sort_logical(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, nullptr); @@ -4954,7 +5025,7 @@ const Glyph *TextServerAdvanced::shaped_text_sort_logical(RID p_shaped) { return sd->glyphs_logical.ptr(); } -Vector2i TextServerAdvanced::shaped_text_get_range(RID p_shaped) const { +Vector2i TextServerAdvanced::shaped_text_get_range(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Vector2i()); @@ -4962,7 +5033,7 @@ Vector2i TextServerAdvanced::shaped_text_get_range(RID p_shaped) const { return Vector2(sd->start, sd->end); } -Array TextServerAdvanced::shaped_text_get_objects(RID p_shaped) const { +Array TextServerAdvanced::shaped_text_get_objects(const RID &p_shaped) const { Array ret; const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, ret); @@ -4975,7 +5046,7 @@ Array TextServerAdvanced::shaped_text_get_objects(RID p_shaped) const { return ret; } -Rect2 TextServerAdvanced::shaped_text_get_object_rect(RID p_shaped, Variant p_key) const { +Rect2 TextServerAdvanced::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Rect2()); @@ -4987,7 +5058,7 @@ Rect2 TextServerAdvanced::shaped_text_get_object_rect(RID p_shaped, Variant p_ke return sd->objects[p_key].rect; } -Size2 TextServerAdvanced::shaped_text_get_size(RID p_shaped) const { +Size2 TextServerAdvanced::shaped_text_get_size(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Size2()); @@ -5002,9 +5073,9 @@ Size2 TextServerAdvanced::shaped_text_get_size(RID p_shaped) const { } } -float TextServerAdvanced::shaped_text_get_ascent(RID p_shaped) const { +double TextServerAdvanced::shaped_text_get_ascent(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5013,9 +5084,9 @@ float TextServerAdvanced::shaped_text_get_ascent(RID p_shaped) const { return sd->ascent; } -float TextServerAdvanced::shaped_text_get_descent(RID p_shaped) const { +double TextServerAdvanced::shaped_text_get_descent(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5024,9 +5095,9 @@ float TextServerAdvanced::shaped_text_get_descent(RID p_shaped) const { return sd->descent; } -float TextServerAdvanced::shaped_text_get_width(RID p_shaped) const { +double TextServerAdvanced::shaped_text_get_width(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5035,9 +5106,9 @@ float TextServerAdvanced::shaped_text_get_width(RID p_shaped) const { return Math::ceil(sd->text_trimmed ? sd->width_trimmed : sd->width); } -float TextServerAdvanced::shaped_text_get_underline_position(RID p_shaped) const { +double TextServerAdvanced::shaped_text_get_underline_position(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5047,9 +5118,9 @@ float TextServerAdvanced::shaped_text_get_underline_position(RID p_shaped) const return sd->upos; } -float TextServerAdvanced::shaped_text_get_underline_thickness(RID p_shaped) const { +double TextServerAdvanced::shaped_text_get_underline_thickness(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5246,7 +5317,7 @@ String TextServerAdvanced::format_number(const String &p_string, const String &p res.replace("e", num_systems[i].exp); res.replace("E", num_systems[i].exp); char32_t *data = res.ptrw(); - for (int j = 0; j < res.size(); j++) { + for (int j = 0; j < res.length(); j++) { if (data[j] >= 0x30 && data[j] <= 0x39) { data[j] = num_systems[i].digits[data[j] - 0x30]; } else if (data[j] == '.' || data[j] == ',') { @@ -5270,7 +5341,7 @@ String TextServerAdvanced::parse_number(const String &p_string, const String &p_ } res.replace(num_systems[i].exp, "e"); char32_t *data = res.ptrw(); - for (int j = 0; j < res.size(); j++) { + for (int j = 0; j < res.length(); j++) { if (data[j] == num_systems[i].digits[10]) { data[j] = '.'; } else { @@ -5312,13 +5383,13 @@ String TextServerAdvanced::strip_diacritics(const String &p_string) const { Char16String utf16 = p_string.utf16(); // Normalize. - Char16String normalized; + Vector<char16_t> normalized; err = U_ZERO_ERROR; - int32_t len = unorm2_normalize(unorm, utf16.ptr(), -1, nullptr, 0, &err); + int32_t len = unorm2_normalize(unorm, utf16.get_data(), -1, nullptr, 0, &err); ERR_FAIL_COND_V_MSG(err != U_BUFFER_OVERFLOW_ERROR, TextServer::strip_diacritics(p_string), u_errorName(err)); normalized.resize(len); err = U_ZERO_ERROR; - unorm2_normalize(unorm, utf16.ptr(), -1, normalized.ptrw(), len, &err); + unorm2_normalize(unorm, utf16.get_data(), -1, normalized.ptrw(), len, &err); ERR_FAIL_COND_V_MSG(U_FAILURE(err), TextServer::strip_diacritics(p_string), u_errorName(err)); // Convert back to UTF-32. @@ -5328,7 +5399,7 @@ String TextServerAdvanced::strip_diacritics(const String &p_string) const { String result; for (int i = 0; i < normalized_string.length(); i++) { if (u_getCombiningClass(normalized_string[i]) == 0) { - result += normalized_string[i]; + result = result + normalized_string[i]; } } return result; @@ -5338,13 +5409,13 @@ String TextServerAdvanced::string_to_upper(const String &p_string, const String // Convert to UTF-16. Char16String utf16 = p_string.utf16(); - Char16String upper; + Vector<char16_t> upper; UErrorCode err = U_ZERO_ERROR; - int32_t len = u_strToUpper(nullptr, 0, utf16.ptr(), -1, p_language.ascii().get_data(), &err); + int32_t len = u_strToUpper(nullptr, 0, utf16.get_data(), -1, p_language.ascii().get_data(), &err); ERR_FAIL_COND_V_MSG(err != U_BUFFER_OVERFLOW_ERROR, p_string, u_errorName(err)); upper.resize(len); err = U_ZERO_ERROR; - u_strToUpper(upper.ptrw(), len, utf16.ptr(), -1, p_language.ascii().get_data(), &err); + u_strToUpper(upper.ptrw(), len, utf16.get_data(), -1, p_language.ascii().get_data(), &err); ERR_FAIL_COND_V_MSG(U_FAILURE(err), p_string, u_errorName(err)); // Convert back to UTF-32. @@ -5355,13 +5426,13 @@ String TextServerAdvanced::string_to_lower(const String &p_string, const String // Convert to UTF-16. Char16String utf16 = p_string.utf16(); - Char16String lower; + Vector<char16_t> lower; UErrorCode err = U_ZERO_ERROR; - int32_t len = u_strToLower(nullptr, 0, utf16.ptr(), -1, p_language.ascii().get_data(), &err); + int32_t len = u_strToLower(nullptr, 0, utf16.get_data(), -1, p_language.ascii().get_data(), &err); ERR_FAIL_COND_V_MSG(err != U_BUFFER_OVERFLOW_ERROR, p_string, u_errorName(err)); lower.resize(len); err = U_ZERO_ERROR; - u_strToLower(lower.ptrw(), len, utf16.ptr(), -1, p_language.ascii().get_data(), &err); + u_strToLower(lower.ptrw(), len, utf16.get_data(), -1, p_language.ascii().get_data(), &err); ERR_FAIL_COND_V_MSG(U_FAILURE(err), p_string, u_errorName(err)); // Convert back to UTF-32. @@ -5376,14 +5447,8 @@ TextServerAdvanced::TextServerAdvanced() { TextServerAdvanced::~TextServerAdvanced() { _bmp_free_font_funcs(); - if (library != nullptr) { - FT_Done_FreeType(library); + if (ft_library != nullptr) { + FT_Done_FreeType(ft_library); } u_cleanup(); -#ifndef ICU_STATIC_DATA - if (icu_data != nullptr) { - memfree(icu_data); - icu_data = nullptr; - } -#endif } diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index e5958fc162..bb3968ee3f 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -36,13 +36,61 @@ /* shaping and advanced font features support. */ /*************************************************************************/ -#include "servers/text_server.h" +#ifdef GDEXTENSION +// Headers for building as GDExtension plug-in. + +#include <godot_cpp/godot.hpp> + +#include <godot_cpp/core/class_db.hpp> +#include <godot_cpp/core/mutex_lock.hpp> + +#include <godot_cpp/variant/array.hpp> +#include <godot_cpp/variant/dictionary.hpp> +#include <godot_cpp/variant/packed_int32_array.hpp> +#include <godot_cpp/variant/packed_string_array.hpp> +#include <godot_cpp/variant/packed_vector2_array.hpp> +#include <godot_cpp/variant/rect2.hpp> +#include <godot_cpp/variant/rid.hpp> +#include <godot_cpp/variant/string.hpp> +#include <godot_cpp/variant/vector2.hpp> +#include <godot_cpp/variant/vector2i.hpp> + +#include <godot_cpp/classes/text_server.hpp> +#include <godot_cpp/classes/text_server_extension.hpp> +#include <godot_cpp/classes/text_server_manager.hpp> + +#include <godot_cpp/classes/caret_info.hpp> +#include <godot_cpp/classes/global_constants_binds.hpp> +#include <godot_cpp/classes/glyph.hpp> +#include <godot_cpp/classes/image.hpp> +#include <godot_cpp/classes/image_texture.hpp> +#include <godot_cpp/classes/ref.hpp> + +#include <godot_cpp/templates/hash_map.hpp> +#include <godot_cpp/templates/map.hpp> +#include <godot_cpp/templates/rid_owner.hpp> +#include <godot_cpp/templates/set.hpp> +#include <godot_cpp/templates/thread_work_pool.hpp> +#include <godot_cpp/templates/vector.hpp> + +using namespace godot; + +#else +// Headers for building as built-in module. #include "core/templates/rid_owner.h" #include "core/templates/thread_work_pool.h" #include "scene/resources/texture.h" +#include "servers/text/text_server_extension.h" + +#include "modules/modules_enabled.gen.h" // For freetype, msdfgen. + +#endif + #include "script_iterator.h" +// Thirdparty headers. + #include <unicode/ubidi.h> #include <unicode/ubrk.h> #include <unicode/uchar.h> @@ -55,8 +103,6 @@ #include <unicode/ustring.h> #include <unicode/utypes.h> -#include "modules/modules_enabled.gen.h" // For freetype, msdfgen. - #ifdef MODULE_FREETYPE_ENABLED #include <ft2build.h> #include FT_FREETYPE_H @@ -73,12 +119,11 @@ #include <hb-icu.h> #include <hb.h> -class TextServerAdvanced : public TextServer { - GDCLASS(TextServerAdvanced, TextServer); - _THREAD_SAFE_CLASS_ +/*************************************************************************/ - static String interface_name; - static uint32_t interface_features; +class TextServerAdvanced : public TextServerExtension { + GDCLASS(TextServerAdvanced, TextServerExtension); + _THREAD_SAFE_CLASS_ struct NumSystemData { Set<StringName> lang; @@ -89,21 +134,23 @@ class TextServerAdvanced : public TextServer { Vector<NumSystemData> num_systems; Map<StringName, int32_t> feature_sets; + Map<int32_t, StringName> feature_sets_inv; void _insert_num_systems_lang(); void _insert_feature_sets(); + _FORCE_INLINE_ void _insert_feature(const StringName &p_name, int32_t p_tag); // ICU support data. - uint8_t *icu_data = nullptr; + bool icu_data_loaded = false; // Font cache data. #ifdef MODULE_FREETYPE_ENABLED - mutable FT_Library library = nullptr; + mutable FT_Library ft_library = nullptr; #endif - const int rect_range = 2; + const int rect_range = 1; struct FontTexture { Image::Format format; @@ -129,12 +176,12 @@ class TextServerAdvanced : public TextServer { }; struct FontDataForSizeAdvanced { - float ascent = 0.f; - float descent = 0.f; - float underline_position = 0.f; - float underline_thickness = 0.f; - float scale = 1.f; - float oversampling = 1.f; + double ascent = 0.0; + double descent = 0.0; + double underline_position = 0.0; + double underline_thickness = 0.0; + double scale = 1.0; + double oversampling = 1.0; int spacing_glyph = 0; int spacing_space = 0; @@ -176,8 +223,8 @@ class TextServerAdvanced : public TextServer { TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; Dictionary variation_coordinates; - float oversampling = 0.f; - float embolden = 0.f; + double oversampling = 0.0; + double embolden = 0.0; Transform2D transform; uint32_t style_flags = 0; @@ -203,8 +250,8 @@ class TextServerAdvanced : public TextServer { ~FontDataAdvanced() { work_pool.finish(); - for (const Map<Vector2i, FontDataForSizeAdvanced *>::Element *E = cache.front(); E; E = E->next()) { - memdelete(E->get()); + for (const KeyValue<Vector2i, FontDataForSizeAdvanced *> &E : cache) { + memdelete(E.value); } cache.clear(); } @@ -242,16 +289,34 @@ class TextServerAdvanced : public TextServer { } } - _FORCE_INLINE_ float _get_extra_advance(RID p_font_rid, int p_font_size) const; + _FORCE_INLINE_ double _get_extra_advance(RID p_font_rid, int p_font_size) const; // Shaped text cache data. + struct TrimData { + int trim_pos = -1; + int ellipsis_pos = -1; + Vector<Glyph> ellipsis_glyph_buf; + }; + + struct ShapedTextDataAdvanced { + Mutex mutex; + + /* Source data */ + RID parent; // Substring parent ShapedTextData. + + int start = 0; // Substring start offset in the parent string. + int end = 0; // Substring end offset in the parent string. + + String text; + String custom_punct; + TextServer::Direction direction = DIRECTION_LTR; // Desired text direction. + TextServer::Orientation orientation = ORIENTATION_HORIZONTAL; - struct ShapedTextDataAdvanced : public ShapedTextData { struct Span { int start = -1; int end = -1; - Vector<RID> fonts; + Array fonts; int font_size = 0; Variant embedded_key; @@ -262,6 +327,38 @@ class TextServerAdvanced : public TextServer { }; Vector<Span> spans; + struct EmbeddedObject { + int pos = 0; + InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; + Rect2 rect; + }; + Map<Variant, EmbeddedObject> objects; + + /* Shaped data */ + TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. + bool valid = false; // String is shaped. + bool line_breaks_valid = false; // Line and word break flags are populated (and virtual zero width spaces inserted). + bool justification_ops_valid = false; // Virtual elongation glyphs are added to the string. + bool sort_valid = false; + bool text_trimmed = false; + + bool preserve_invalid = true; // Draw hex code box instead of missing characters. + bool preserve_control = false; // Draw control characters. + + double ascent = 0.0; // Ascent for horizontal layout, 1/2 of width for vertical. + double descent = 0.0; // Descent for horizontal layout, 1/2 of width for vertical. + double width = 0.0; // Width for horizontal layout, height for vertical. + double width_trimmed = 0.0; + + double upos = 0.0; + double uthk = 0.0; + + TrimData overrun_trim_data; + bool fit_width_minimum_reached = false; + + Vector<Glyph> glyphs; + Vector<Glyph> glyphs_logical; + /* Intermediate data */ Char16String utf16; Vector<UBiDi *> bidi_iter; @@ -289,16 +386,16 @@ class TextServerAdvanced : public TextServer { // Common data. - float oversampling = 1.f; + double oversampling = 1.0; mutable RID_PtrOwner<FontDataAdvanced> font_owner; mutable RID_PtrOwner<ShapedTextDataAdvanced> shaped_owner; void _realign(ShapedTextDataAdvanced *p_sd) const; - int _convert_pos(const ShapedTextDataAdvanced *p_sd, int p_pos) const; - int _convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int p_pos) const; - bool _shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int p_start, int p_length) const; - void _shape_run(ShapedTextDataAdvanced *p_sd, int32_t p_start, int32_t p_end, hb_script_t p_script, hb_direction_t p_direction, Vector<RID> p_fonts, int p_span, int p_fb_index); - Glyph _shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, RID p_font, int p_font_size); + int64_t _convert_pos(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; + int64_t _convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; + bool _shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_length) const; + void _shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, Array p_fonts, int64_t p_span, int64_t p_fb_index); + Glyph _shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, const RID &p_font, int64_t p_font_size); _FORCE_INLINE_ void _add_featuers(const Dictionary &p_source, Vector<hb_feature_t> &r_ftrs); // HarfBuzz bitmap font interface. @@ -324,6 +421,25 @@ class TextServerAdvanced : public TextServer { static void _bmp_font_set_funcs(hb_font_t *p_font, TextServerAdvanced::FontDataForSizeAdvanced *p_face, bool p_unref); static hb_font_t *_bmp_font_create(TextServerAdvanced::FontDataForSizeAdvanced *p_face, hb_destroy_func_t p_destroy); + hb_font_t *_font_get_hb_handle(const RID &p_font, int64_t p_font_size) const; + + struct GlyphCompare { // For line breaking reordering. + _FORCE_INLINE_ bool operator()(const Glyph &l, const Glyph &r) const { + if (l.start == r.start) { + if (l.count == r.count) { + if ((l.flags & TextServer::GRAPHEME_IS_VIRTUAL) == TextServer::GRAPHEME_IS_VIRTUAL) { + return false; + } else { + return true; + } + } + return l.count > r.count; // Sort first glyph with count & flags, order of the rest are irrelevant. + } else { + return l.start < r.start; + } + } + }; + protected: static void _bind_methods(){}; @@ -333,10 +449,10 @@ protected: public: virtual bool has_feature(Feature p_feature) const override; virtual String get_name() const override; - virtual uint32_t get_features() const override; + virtual int64_t get_features() const override; - virtual void free(RID p_rid) override; - virtual bool has(RID p_rid) override; + virtual void free_rid(const RID &p_rid) override; + virtual bool has(const RID &p_rid) override; virtual bool load_support_data(const String &p_filename) override; virtual String get_support_data_filename() const override; @@ -345,220 +461,218 @@ public: virtual bool is_locale_right_to_left(const String &p_locale) const override; - virtual int32_t name_to_tag(const String &p_name) const override; - virtual String tag_to_name(int32_t p_tag) const override; + virtual int64_t name_to_tag(const String &p_name) const override; + virtual String tag_to_name(int64_t p_tag) const override; /* Font interface */ virtual RID create_font() override; - virtual void font_set_data(RID p_font_rid, const PackedByteArray &p_data) override; - virtual void font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) override; - - virtual void font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) override; - virtual uint32_t /*FontStyle*/ font_get_style(RID p_font_rid) const override; + virtual void font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) override; + virtual void font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) override; - virtual void font_set_style_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_style_name(RID p_font_rid) const override; + virtual void font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) override; + virtual int64_t /*FontStyle*/ font_get_style(const RID &p_font_rid) const override; - virtual void font_set_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_name(RID p_font_rid) const override; + virtual void font_set_style_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_style_name(const RID &p_font_rid) const override; - virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) override; - virtual bool font_is_antialiased(RID p_font_rid) const override; + virtual void font_set_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_name(const RID &p_font_rid) const override; - virtual void font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) override; - virtual bool font_is_multichannel_signed_distance_field(RID p_font_rid) const override; + virtual void font_set_antialiased(const RID &p_font_rid, bool p_antialiased) override; + virtual bool font_is_antialiased(const RID &p_font_rid) const override; - virtual void font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) override; - virtual int font_get_msdf_pixel_range(RID p_font_rid) const override; + virtual void font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) override; + virtual bool font_is_multichannel_signed_distance_field(const RID &p_font_rid) const override; - virtual void font_set_msdf_size(RID p_font_rid, int p_msdf_size) override; - virtual int font_get_msdf_size(RID p_font_rid) const override; + virtual void font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) override; + virtual int64_t font_get_msdf_pixel_range(const RID &p_font_rid) const override; - virtual void font_set_fixed_size(RID p_font_rid, int p_fixed_size) override; - virtual int font_get_fixed_size(RID p_font_rid) const override; + virtual void font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) override; + virtual int64_t font_get_msdf_size(const RID &p_font_rid) const override; - virtual void font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) override; - virtual bool font_is_force_autohinter(RID p_font_rid) const override; + virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) override; + virtual int64_t font_get_fixed_size(const RID &p_font_rid) const override; - virtual void font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) override; - virtual TextServer::Hinting font_get_hinting(RID p_font_rid) const override; + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) override; + virtual bool font_is_force_autohinter(const RID &p_font_rid) const override; - virtual void font_set_subpixel_positioning(RID p_font_rid, SubpixelPositioning p_subpixel) override; - virtual SubpixelPositioning font_get_subpixel_positioning(RID p_font_rid) const override; + virtual void font_set_subpixel_positioning(const RID &p_font_rid, SubpixelPositioning p_subpixel) override; + virtual SubpixelPositioning font_get_subpixel_positioning(const RID &p_font_rid) const override; - virtual void font_set_embolden(RID p_font_rid, float p_strength) override; - virtual float font_get_embolden(RID p_font_rid) const override; + virtual void font_set_embolden(const RID &p_font_rid, double p_strength) override; + virtual double font_get_embolden(const RID &p_font_rid) const override; - virtual void font_set_transform(RID p_font_rid, Transform2D p_transform) override; - virtual Transform2D font_get_transform(RID p_font_rid) const override; + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) override; + virtual Transform2D font_get_transform(const RID &p_font_rid) const override; - virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) override; - virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const override; + virtual void font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) override; + virtual Dictionary font_get_variation_coordinates(const RID &p_font_rid) const override; - virtual void font_set_oversampling(RID p_font_rid, float p_oversampling) override; - virtual float font_get_oversampling(RID p_font_rid) const override; + virtual void font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) override; + virtual TextServer::Hinting font_get_hinting(const RID &p_font_rid) const override; - virtual Array font_get_size_cache_list(RID p_font_rid) const override; - virtual void font_clear_size_cache(RID p_font_rid) override; - virtual void font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) override; + virtual void font_set_oversampling(const RID &p_font_rid, double p_oversampling) override; + virtual double font_get_oversampling(const RID &p_font_rid) const override; - hb_font_t *_font_get_hb_handle(RID p_font, int p_font_size) const; + virtual Array font_get_size_cache_list(const RID &p_font_rid) const override; + virtual void font_clear_size_cache(const RID &p_font_rid) override; + virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) override; - virtual void font_set_ascent(RID p_font_rid, int p_size, float p_ascent) override; - virtual float font_get_ascent(RID p_font_rid, int p_size) const override; + virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) override; + virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_descent(RID p_font_rid, int p_size, float p_descent) override; - virtual float font_get_descent(RID p_font_rid, int p_size) const override; + virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) override; + virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) override; - virtual float font_get_underline_position(RID p_font_rid, int p_size) const override; + virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) override; + virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) override; - virtual float font_get_underline_thickness(RID p_font_rid, int p_size) const override; + virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) override; + virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_scale(RID p_font_rid, int p_size, float p_scale) override; - virtual float font_get_scale(RID p_font_rid, int p_size) const override; + virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) override; + virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_spacing(RID p_font_rid, int p_size, SpacingType p_spacing, int p_value) override; - virtual int font_get_spacing(RID p_font_rid, int p_size, SpacingType p_spacing) const override; + virtual void font_set_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing, int64_t p_value) override; + virtual int64_t font_get_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing) const override; - virtual int font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_textures(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) override; + virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) override; - virtual void font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) override; - virtual Ref<Image> font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) override; + virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; - virtual void font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) override; - virtual PackedInt32Array font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + virtual void font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) override; + virtual PackedInt32Array font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; - virtual Array font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) override; + virtual Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) override; - virtual Vector2 font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) override; + virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) override; - virtual Vector2 font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) override; + virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) override; - virtual Vector2 font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) override; + virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) override; - virtual Rect2 font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) override; + virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) override; - virtual int font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) override; + virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) override; - virtual Dictionary font_get_glyph_contours(RID p_font, int p_size, int32_t p_index) const override; + virtual Dictionary font_get_glyph_contours(const RID &p_font, int64_t p_size, int64_t p_index) const override; - virtual Array font_get_kerning_list(RID p_font_rid, int p_size) const override; - virtual void font_clear_kerning_map(RID p_font_rid, int p_size) override; - virtual void font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) override; + virtual Array font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const override; + virtual void font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) override; + virtual void font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) override; - virtual void font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; - virtual Vector2 font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const override; + virtual void font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; + virtual Vector2 font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const override; - virtual int32_t font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector = 0) const override; + virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector = 0) const override; - virtual bool font_has_char(RID p_font_rid, char32_t p_char) const override; - virtual String font_get_supported_chars(RID p_font_rid) const override; + virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override; + virtual String font_get_supported_chars(const RID &p_font_rid) const override; - virtual void font_render_range(RID p_font, const Vector2i &p_size, char32_t p_start, char32_t p_end) override; - virtual void font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) override; + virtual void font_render_range(const RID &p_font, const Vector2i &p_size, int64_t p_start, int64_t p_end) override; + virtual void font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) override; - virtual void font_draw_glyph(RID p_font, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - virtual void font_draw_glyph_outline(RID p_font, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph(const RID &p_font, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph_outline(const RID &p_font, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - virtual bool font_is_language_supported(RID p_font_rid, const String &p_language) const override; - virtual void font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) override; - virtual bool font_get_language_support_override(RID p_font_rid, const String &p_language) override; - virtual void font_remove_language_support_override(RID p_font_rid, const String &p_language) override; - virtual Vector<String> font_get_language_support_overrides(RID p_font_rid) override; + virtual bool font_is_language_supported(const RID &p_font_rid, const String &p_language) const override; + virtual void font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) override; + virtual bool font_get_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual void font_remove_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual PackedStringArray font_get_language_support_overrides(const RID &p_font_rid) override; - virtual bool font_is_script_supported(RID p_font_rid, const String &p_script) const override; - virtual void font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) override; - virtual bool font_get_script_support_override(RID p_font_rid, const String &p_script) override; - virtual void font_remove_script_support_override(RID p_font_rid, const String &p_script) override; - virtual Vector<String> font_get_script_support_overrides(RID p_font_rid) override; + virtual bool font_is_script_supported(const RID &p_font_rid, const String &p_script) const override; + virtual void font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) override; + virtual bool font_get_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual void font_remove_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual PackedStringArray font_get_script_support_overrides(const RID &p_font_rid) override; - virtual void font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) override; - virtual Dictionary font_get_opentype_feature_overrides(RID p_font_rid) const override; + virtual void font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) override; + virtual Dictionary font_get_opentype_feature_overrides(const RID &p_font_rid) const override; - virtual Dictionary font_supported_feature_list(RID p_font_rid) const override; - virtual Dictionary font_supported_variation_list(RID p_font_rid) const override; + virtual Dictionary font_supported_feature_list(const RID &p_font_rid) const override; + virtual Dictionary font_supported_variation_list(const RID &p_font_rid) const override; - virtual float font_get_global_oversampling() const override; - virtual void font_set_global_oversampling(float p_oversampling) override; + virtual double font_get_global_oversampling() const override; + virtual void font_set_global_oversampling(double p_oversampling) override; /* Shaped text buffer interface */ virtual RID create_shaped_text(Direction p_direction = DIRECTION_AUTO, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - virtual void shaped_text_clear(RID p_shaped) override; + virtual void shaped_text_clear(const RID &p_shaped) override; - virtual void shaped_text_set_direction(RID p_shaped, Direction p_direction = DIRECTION_AUTO) override; - virtual Direction shaped_text_get_direction(RID p_shaped) const override; - virtual Direction shaped_text_get_inferred_direction(RID p_shaped) const override; + virtual void shaped_text_set_direction(const RID &p_shaped, Direction p_direction = DIRECTION_AUTO) override; + virtual Direction shaped_text_get_direction(const RID &p_shaped) const override; + virtual Direction shaped_text_get_inferred_direction(const RID &p_shaped) const override; - virtual void shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) override; + virtual void shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) override; - virtual void shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) override; - virtual String shaped_text_get_custom_punctuation(RID p_shaped) const override; + virtual void shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) override; + virtual String shaped_text_get_custom_punctuation(const RID &p_shaped) const override; - virtual void shaped_text_set_orientation(RID p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - virtual Orientation shaped_text_get_orientation(RID p_shaped) const override; + virtual void shaped_text_set_orientation(const RID &p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; + virtual Orientation shaped_text_get_orientation(const RID &p_shaped) const override; - virtual void shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_invalid(RID p_shaped) const override; + virtual void shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_invalid(const RID &p_shaped) const override; - virtual void shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_control(RID p_shaped) const override; + virtual void shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_control(const RID &p_shaped) const override; - virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; - virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override; - virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) override; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; - virtual int shaped_get_span_count(RID p_shaped) const override; - virtual Variant shaped_get_span_meta(RID p_shaped, int p_index) const override; - virtual void shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary()) override; + virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; + virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; - virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override; - virtual RID shaped_text_get_parent(RID p_shaped) const override; + virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override; + virtual RID shaped_text_get_parent(const RID &p_shaped) const override; - virtual float shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; - virtual float shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) override; + virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; + virtual double shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) override; - virtual bool shaped_text_shape(RID p_shaped) override; - virtual bool shaped_text_update_breaks(RID p_shaped) override; - virtual bool shaped_text_update_justification_ops(RID p_shaped) override; + virtual bool shaped_text_shape(const RID &p_shaped) override; + virtual bool shaped_text_update_breaks(const RID &p_shaped) override; + virtual bool shaped_text_update_justification_ops(const RID &p_shaped) override; - virtual int shaped_text_get_trim_pos(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_pos(RID p_shaped) const override; - virtual const Glyph *shaped_text_get_ellipsis_glyphs(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_glyph_count(RID p_shaped) const override; + virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override; - virtual void shaped_text_overrun_trim_to_width(RID p_shaped, float p_width, uint16_t p_trim_flags) override; + virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, int64_t p_trim_flags) override; - virtual bool shaped_text_is_ready(RID p_shaped) const override; + virtual bool shaped_text_is_ready(const RID &p_shaped) const override; - virtual const Glyph *shaped_text_get_glyphs(RID p_shaped) const override; - virtual const Glyph *shaped_text_sort_logical(RID p_shaped) override; - virtual int shaped_text_get_glyph_count(RID p_shaped) const override; + virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override; + virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override; - virtual Vector2i shaped_text_get_range(RID p_shaped) const override; + virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override; - virtual Array shaped_text_get_objects(RID p_shaped) const override; - virtual Rect2 shaped_text_get_object_rect(RID p_shaped, Variant p_key) const override; + virtual Array shaped_text_get_objects(const RID &p_shaped) const override; + virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override; - virtual Size2 shaped_text_get_size(RID p_shaped) const override; - virtual float shaped_text_get_ascent(RID p_shaped) const override; - virtual float shaped_text_get_descent(RID p_shaped) const override; - virtual float shaped_text_get_width(RID p_shaped) const override; - virtual float shaped_text_get_underline_position(RID p_shaped) const override; - virtual float shaped_text_get_underline_thickness(RID p_shaped) const override; + virtual Size2 shaped_text_get_size(const RID &p_shaped) const override; + virtual double shaped_text_get_ascent(const RID &p_shaped) const override; + virtual double shaped_text_get_descent(const RID &p_shaped) const override; + virtual double shaped_text_get_width(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_position(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override; virtual String format_number(const String &p_string, const String &p_language = "") const override; virtual String parse_number(const String &p_string, const String &p_language = "") const override; diff --git a/modules/text_server_fb/.gitignore b/modules/text_server_fb/.gitignore new file mode 100644 index 0000000000..15cc38b59c --- /dev/null +++ b/modules/text_server_fb/.gitignore @@ -0,0 +1,2 @@ +# Godot-cpp headers +gdextension_build/godot-cpp diff --git a/modules/text_server_fb/doc_classes/TextServerFallback.xml b/modules/text_server_fb/doc_classes/TextServerFallback.xml index 76194a7bda..950b64e49f 100644 --- a/modules/text_server_fb/doc_classes/TextServerFallback.xml +++ b/modules/text_server_fb/doc_classes/TextServerFallback.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextServerFallback" inherits="TextServer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> +<class name="TextServerFallback" inherits="TextServerExtension" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> Fallback implementation of the Text Server, without BiDi and complex text layout support. </brief_description> diff --git a/modules/text_server_fb/gdextension_build/SConstruct b/modules/text_server_fb/gdextension_build/SConstruct new file mode 100644 index 0000000000..1753bc8b86 --- /dev/null +++ b/modules/text_server_fb/gdextension_build/SConstruct @@ -0,0 +1,205 @@ +#!/usr/bin/env python +import atexit +import os +import sys +import methods +import time + +# For the reference: +# - CCFLAGS are compilation flags shared between C and C++ +# - CFLAGS are for C-specific compilation flags +# - CXXFLAGS are for C++-specific compilation flags +# - CPPFLAGS are for pre-processor flags +# - CPPDEFINES are for pre-processor defines +# - LINKFLAGS are for linking flags + +time_at_start = time.time() + +env = SConscript("./godot-cpp/SConstruct") +env.__class__.disable_warnings = methods.disable_warnings + +opts = Variables([], ARGUMENTS) +opts.Add(BoolVariable("freetype_enabled", "Use FreeType library", True)) +opts.Add(BoolVariable("msdfgen_enabled", "Use MSDFgen library (require FreeType)", True)) +opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) + +opts.Update(env) + +if not env["verbose"]: + methods.no_verbose(sys, env) + +# MSDFGEN +if env["msdfgen_enabled"] and env["freetype_enabled"]: + env_msdfgen = env.Clone() + env_msdfgen.disable_warnings() + + thirdparty_msdfgen_dir = "../../../thirdparty/msdfgen/" + thirdparty_msdfgen_sources = [ + "core/Contour.cpp", + "core/EdgeHolder.cpp", + "core/MSDFErrorCorrection.cpp", + "core/Projection.cpp", + "core/Scanline.cpp", + "core/Shape.cpp", + "core/SignedDistance.cpp", + "core/Vector2.cpp", + "core/contour-combiners.cpp", + "core/edge-coloring.cpp", + "core/edge-segments.cpp", + "core/edge-selectors.cpp", + "core/equation-solver.cpp", + "core/msdf-error-correction.cpp", + "core/msdfgen.cpp", + "core/rasterization.cpp", + "core/render-sdf.cpp", + "core/sdf-error-estimation.cpp", + "core/shape-description.cpp", + ] + thirdparty_msdfgen_sources = [thirdparty_msdfgen_dir + file for file in thirdparty_msdfgen_sources] + + env_msdfgen.Append(CPPPATH=["../../../thirdparty/freetype/include", "../../../thirdparty/msdfgen"]) + env.Append(CPPPATH=["../../../thirdparty/msdfgen"]) + env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"]) + + lib = env_msdfgen.Library( + f'msdfgen_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_msdfgen_sources, + ) + env.Append(LIBS=[lib]) + +# FreeType +if env["freetype_enabled"]: + env_freetype = env.Clone() + env_freetype.disable_warnings() + + thirdparty_freetype_dir = "../../../thirdparty/freetype/" + thirdparty_freetype_sources = [ + "src/autofit/autofit.c", + "src/base/ftbase.c", + "src/base/ftbbox.c", + "src/base/ftbdf.c", + "src/base/ftbitmap.c", + "src/base/ftcid.c", + "src/base/ftdebug.c", + "src/base/ftfstype.c", + "src/base/ftgasp.c", + "src/base/ftglyph.c", + "src/base/ftgxval.c", + "src/base/ftinit.c", + "src/base/ftmm.c", + "src/base/ftotval.c", + "src/base/ftpatent.c", + "src/base/ftpfr.c", + "src/base/ftstroke.c", + "src/base/ftsynth.c", + "src/base/ftsystem.c", + "src/base/fttype1.c", + "src/base/ftwinfnt.c", + "src/bdf/bdf.c", + "src/bzip2/ftbzip2.c", + "src/cache/ftcache.c", + "src/cff/cff.c", + "src/cid/type1cid.c", + "src/gxvalid/gxvalid.c", + "src/gzip/ftgzip.c", + "src/lzw/ftlzw.c", + "src/otvalid/otvalid.c", + "src/pcf/pcf.c", + "src/pfr/pfr.c", + "src/psaux/psaux.c", + "src/pshinter/pshinter.c", + "src/psnames/psnames.c", + "src/raster/raster.c", + "src/sdf/sdf.c", + "src/smooth/smooth.c", + "src/truetype/truetype.c", + "src/type1/type1.c", + "src/type42/type42.c", + "src/winfonts/winfnt.c", + "src/sfnt/sfnt.c", + ] + thirdparty_freetype_sources = [thirdparty_freetype_dir + file for file in thirdparty_freetype_sources] + + thirdparty_png_dir = "../../../thirdparty/libpng/" + thirdparty_png_sources = [ + "png.c", + "pngerror.c", + "pngget.c", + "pngmem.c", + "pngpread.c", + "pngread.c", + "pngrio.c", + "pngrtran.c", + "pngrutil.c", + "pngset.c", + "pngtrans.c", + "pngwio.c", + "pngwrite.c", + "pngwtran.c", + "pngwutil.c", + ] + thirdparty_freetype_sources += [thirdparty_png_dir + file for file in thirdparty_png_sources] + + thirdparty_zlib_dir = "../../../thirdparty/zlib/" + thirdparty_zlib_sources = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + ] + thirdparty_freetype_sources += [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] + + env_freetype.Append(CPPPATH=[thirdparty_freetype_dir + "/include", thirdparty_zlib_dir, thirdparty_png_dir]) + env.Append(CPPPATH=[thirdparty_freetype_dir + "/include"]) + + env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", ("PNG_ARM_NEON_OPT", 0)]) + if env["target"] == "debug": + env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"]) + + env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"]) + + lib = env_freetype.Library( + f'freetype_builtin.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["LIBSUFFIX"]}', + thirdparty_freetype_sources, + ) + env.Append(LIBS=[lib]) + + +env.Append(CPPDEFINES=["GDEXTENSION"]) +env.Append(CPPPATH=["../"]) +sources = Glob("../*.cpp") + +if env["platform"] == "osx": + methods.write_osx_plist( + f'./bin/libtextserver_fallback.osx.{env["target"]}.framework', + f'libtextserver_fallback.osx.{env["target"]}', + "org.godotengine.textserver_fallback", + "Fallback Text Server", + ) + library = env.SharedLibrary( + f'./bin/libtextserver_fallback.osx.{env["target"]}.framework/libtextserver_fallback.osx.{env["target"]}', + source=sources, + ) +else: + library = env.SharedLibrary( + f'./bin/libtextserver_fallback.{env["platform"]}.{env["target"]}.{env["arch_suffix"]}{env["SHLIBSUFFIX"]}', + source=sources, + ) + +Default(library) + + +def print_elapsed_time(): + elapsed_time_sec = round(time.time() - time_at_start, 3) + time_ms = round((elapsed_time_sec % 1) * 1000) + print("[Time elapsed: {}.{:03}]".format(time.strftime("%H:%M:%S", time.gmtime(elapsed_time_sec)), time_ms)) + + +atexit.register(print_elapsed_time) diff --git a/modules/text_server_fb/gdextension_build/methods.py b/modules/text_server_fb/gdextension_build/methods.py new file mode 100644 index 0000000000..d404f2851e --- /dev/null +++ b/modules/text_server_fb/gdextension_build/methods.py @@ -0,0 +1,130 @@ +import os +import sys + + +def no_verbose(sys, env): + colors = {} + + # Colors are disabled in non-TTY environments such as pipes. This means + # that if output is redirected to a file, it will not contain color codes + if sys.stdout.isatty(): + colors["blue"] = "\033[0;94m" + colors["bold_blue"] = "\033[1;94m" + colors["reset"] = "\033[0m" + else: + colors["blue"] = "" + colors["bold_blue"] = "" + colors["reset"] = "" + + # There is a space before "..." to ensure that source file names can be + # Ctrl + clicked in the VS Code terminal. + compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + java_compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + compile_shared_source_message = "{}Compiling shared {}$SOURCE{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_program_message = "{}Linking Program {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_library_message = "{}Linking Static Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + ranlib_library_message = "{}Ranlib Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + link_shared_library_message = "{}Linking Shared Library {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format( + colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] + ) + + env.Append(CXXCOMSTR=[compile_source_message]) + env.Append(CCCOMSTR=[compile_source_message]) + env.Append(SHCCCOMSTR=[compile_shared_source_message]) + env.Append(SHCXXCOMSTR=[compile_shared_source_message]) + env.Append(ARCOMSTR=[link_library_message]) + env.Append(RANLIBCOMSTR=[ranlib_library_message]) + env.Append(SHLINKCOMSTR=[link_shared_library_message]) + env.Append(LINKCOMSTR=[link_program_message]) + env.Append(JARCOMSTR=[java_library_message]) + env.Append(JAVACCOMSTR=[java_compile_source_message]) + + +def disable_warnings(self): + # 'self' is the environment + if self["platform"] == "windows" and not self["use_mingw"]: + # We have to remove existing warning level defines before appending /w, + # otherwise we get: "warning D9025 : overriding '/W3' with '/w'" + warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"] + self.Append(CCFLAGS=["/w"]) + self.Append(CFLAGS=["/w"]) + self.Append(CXXFLAGS=["/w"]) + self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags] + self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags] + self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags] + else: + self.Append(CCFLAGS=["-w"]) + self.Append(CFLAGS=["-w"]) + self.Append(CXXFLAGS=["-w"]) + + +def make_icu_data(target, source, env): + dst = target[0].srcnode().abspath + g = open(dst, "w", encoding="utf-8") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n") + g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n") + g.write("#ifndef _ICU_DATA_H\n") + g.write("#define _ICU_DATA_H\n") + g.write('#include "unicode/utypes.h"\n') + g.write('#include "unicode/udata.h"\n') + g.write('#include "unicode/uversion.h"\n') + + f = open(source[0].srcnode().abspath, "rb") + buf = f.read() + + g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n") + g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n') + for i in range(len(buf)): + g.write("\t" + str(buf[i]) + ",\n") + + g.write("};\n") + g.write("#endif") + + +def write_osx_plist(target, binary_name, identifier, name): + os.makedirs(f"{target}/Resourece/", exist_ok=True) + f = open(f"{target}/Resourece/Info.plist", "w") + + f.write(f'<?xml version="1.0" encoding="UTF-8"?>\n') + f.write(f'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n') + f.write(f'<plist version="1.0">\n') + f.write(f"<dict>\n") + f.write(f"\t<key>CFBundleExecutable</key>\n") + f.write(f"\t<string>{binary_name}</string>\n") + f.write(f"\t<key>CFBundleIdentifier</key>\n") + f.write(f"\t<string>{identifier}</string>\n") + f.write(f"\t<key>CFBundleInfoDictionaryVersion</key>\n") + f.write(f"\t<string>6.0</string>\n") + f.write(f"\t<key>CFBundleName</key>\n") + f.write(f"\t<string>{name}</string>\n") + f.write(f"\t<key>CFBundlePackageType</key>\n") + f.write(f"\t<string>FMWK</string>\n") + f.write(f"\t<key>CFBundleShortVersionString</key>\n") + f.write(f"\t<string>1.0.0</string>\n") + f.write(f"\t<key>CFBundleSupportedPlatforms</key>\n") + f.write(f"\t<array>\n") + f.write(f"\t\t<string>MacOSX</string>\n") + f.write(f"\t</array>\n") + f.write(f"\t<key>CFBundleVersion</key>\n") + f.write(f"\t<string>1.0.0</string>\n") + f.write(f"\t<key>LSMinimumSystemVersion</key>\n") + f.write(f"\t<string>10.14</string>\n") + f.write(f"</dict>\n") + f.write(f"</plist>\n") diff --git a/modules/text_server_fb/gdextension_build/text_server_fb.gdextension b/modules/text_server_fb/gdextension_build/text_server_fb.gdextension new file mode 100644 index 0000000000..1026c6cb85 --- /dev/null +++ b/modules/text_server_fb/gdextension_build/text_server_fb.gdextension @@ -0,0 +1,12 @@ +[configuration] + +entry_symbol = "textserver_fallback_init" + +[libraries] + +linux.64.debug = "bin/libtextserver_fallback.linux.debug.64.so" +linux.64.release = "bin/libtextserver_fallback.linux.release.64.so" +windows.64.debug = "bin/libtextserver_fallback.windows.debug.64.dll" +windows.64.release = "bin/libtextserver_fallback.windows.release.64.dll" +macos.debug = "bin/libtextserver_fallback.osx.debug.framework" +macos.release = "bin/libtextserver_fallback.osx.release.framework" diff --git a/modules/text_server_fb/register_types.cpp b/modules/text_server_fb/register_types.cpp index a545f84939..1044c3f872 100644 --- a/modules/text_server_fb/register_types.cpp +++ b/modules/text_server_fb/register_types.cpp @@ -34,10 +34,11 @@ void preregister_text_server_fb_types() { GDREGISTER_CLASS(TextServerFallback); - if (TextServerManager::get_singleton()) { + TextServerManager *tsman = TextServerManager::get_singleton(); + if (tsman) { Ref<TextServerFallback> ts; ts.instantiate(); - TextServerManager::get_singleton()->add_interface(ts); + tsman->add_interface(ts); } } @@ -46,3 +47,26 @@ void register_text_server_fb_types() { void unregister_text_server_fb_types() { } + +#ifdef GDEXTENSION + +#include <godot_cpp/core/class_db.hpp> +#include <godot_cpp/core/defs.hpp> +#include <godot_cpp/core/memory.hpp> + +using namespace godot; + +extern "C" { + +GDNativeBool GDN_EXPORT textserver_fallback_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) { + GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); + + init_obj.register_server_initializer(&preregister_text_server_fb_types); + init_obj.register_server_terminator(&unregister_text_server_fb_types); + + return init_obj.init(); +} + +} // ! extern "C" + +#endif // ! GDEXTENSION diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 0d7a9d0db8..6c2e5a6084 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -30,12 +30,29 @@ #include "text_server_fb.h" +#ifdef GDEXTENSION +// Headers for building as GDExtension plug-in. + +#include <godot_cpp/classes/file.hpp> +#include <godot_cpp/classes/rendering_server.hpp> +#include <godot_cpp/classes/translation_server.hpp> +#include <godot_cpp/core/error_macros.hpp> + +using namespace godot; + +#else +// Headers for building as built-in module. + #include "core/error/error_macros.h" #include "core/string/print_string.h" #include "core/string/ucaps.h" #include "modules/modules_enabled.gen.h" // For freetype, msdfgen. +#endif + +// Thirdparty headers. + #ifdef MODULE_MSDFGEN_ENABLED #include "core/ShapeDistanceFinder.h" #include "core/contour-combiners.h" @@ -45,22 +62,46 @@ /*************************************************************************/ -String TextServerFallback::interface_name = "Fallback"; -uint32_t TextServerFallback::interface_features = 0; // Nothing is supported. +#define OT_TAG(c1, c2, c3, c4) ((int32_t)((((uint32_t)(c1)&0xff) << 24) | (((uint32_t)(c2)&0xff) << 16) | (((uint32_t)(c3)&0xff) << 8) | ((uint32_t)(c4)&0xff))) bool TextServerFallback::has_feature(Feature p_feature) const { - return (interface_features & p_feature) == p_feature; + switch (p_feature) { + case FEATURE_SIMPLE_LAYOUT: + case FEATURE_FONT_BITMAP: +#ifdef MODULE_FREETYPE_ENABLED + case FEATURE_FONT_DYNAMIC: +#endif +#ifdef MODULE_MSDFGEN_ENABLED + case FEATURE_FONT_MSDF: +#endif + return true; + default: { + } + } + return false; } String TextServerFallback::get_name() const { - return interface_name; +#ifdef GDEXTENSION + return "Fallback (GDExtension)"; +#else + return "Fallback (Built-in)"; +#endif } -uint32_t TextServerFallback::get_features() const { +int64_t TextServerFallback::get_features() const { + int64_t interface_features = FEATURE_SIMPLE_LAYOUT | FEATURE_FONT_BITMAP; +#ifdef MODULE_FREETYPE_ENABLED + interface_features |= FEATURE_FONT_DYNAMIC; +#endif +#ifdef MODULE_MSDFGEN_ENABLED + interface_features |= FEATURE_FONT_MSDF; +#endif + return interface_features; } -void TextServerFallback::free(RID p_rid) { +void TextServerFallback::free_rid(const RID &p_rid) { _THREAD_SAFE_METHOD_ if (font_owner.owns(p_rid)) { FontDataFallback *fd = font_owner.get_or_null(p_rid); @@ -73,7 +114,7 @@ void TextServerFallback::free(RID p_rid) { } } -bool TextServerFallback::has(RID p_rid) { +bool TextServerFallback::has(const RID &p_rid) { _THREAD_SAFE_METHOD_ return font_owner.owns(p_rid) || shaped_owner.owns(p_rid); } @@ -90,13 +131,18 @@ bool TextServerFallback::is_locale_right_to_left(const String &p_locale) const { return false; // No RTL support. } +_FORCE_INLINE_ void TextServerFallback::_insert_feature(const StringName &p_name, int32_t p_tag) { + feature_sets.insert(p_name, p_tag); + feature_sets_inv.insert(p_tag, p_name); +} + void TextServerFallback::_insert_feature_sets() { // Registered OpenType variation tag. - feature_sets.insert("italic", OT_TAG('i', 't', 'a', 'l')); - feature_sets.insert("optical_size", OT_TAG('o', 'p', 's', 'z')); - feature_sets.insert("slant", OT_TAG('s', 'l', 'n', 't')); - feature_sets.insert("width", OT_TAG('w', 'd', 't', 'h')); - feature_sets.insert("weight", OT_TAG('w', 'g', 'h', 't')); + _insert_feature("italic", OT_TAG('i', 't', 'a', 'l')); + _insert_feature("optical_size", OT_TAG('o', 'p', 's', 'z')); + _insert_feature("slant", OT_TAG('s', 'l', 'n', 't')); + _insert_feature("width", OT_TAG('w', 'd', 't', 'h')); + _insert_feature("weight", OT_TAG('w', 'g', 'h', 't')); } _FORCE_INLINE_ int32_t ot_tag_from_string(const char *p_str, int p_len) { @@ -121,7 +167,7 @@ _FORCE_INLINE_ int32_t ot_tag_from_string(const char *p_str, int p_len) { return OT_TAG(tag[0], tag[1], tag[2], tag[3]); } -int32_t TextServerFallback::name_to_tag(const String &p_name) const { +int64_t TextServerFallback::name_to_tag(const String &p_name) const { if (feature_sets.has(p_name)) { return feature_sets[p_name]; } @@ -137,11 +183,9 @@ _FORCE_INLINE_ void ot_tag_to_string(int32_t p_tag, char *p_buf) { p_buf[3] = (char)(uint8_t)(p_tag >> 0); } -String TextServerFallback::tag_to_name(int32_t p_tag) const { - for (const KeyValue<StringName, int32_t> &E : feature_sets) { - if (E.value == p_tag) { - return E.key; - } +String TextServerFallback::tag_to_name(int64_t p_tag) const { + if (feature_sets_inv.has(p_tag)) { + return feature_sets_inv[p_tag]; } // No readable name, use tag string. @@ -179,7 +223,7 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_ continue; } - ret.y = 0x7FFFFFFF; + ret.y = 0x7fffffff; ret.x = 0; for (int j = 0; j < ct.texture_w - mw; j++) { @@ -198,7 +242,7 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_ } } - if (ret.y == 0x7FFFFFFF || ret.y + mh > ct.texture_h) { + if (ret.y == 0x7fffffff || ret.y + mh > ct.texture_h) { continue; // Fail, could not fit it here. } @@ -219,7 +263,11 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_ texsize = mh; // Special case, adapt to it? } +#ifdef GDEXTENSION + texsize = Math::next_power_of_2(texsize); +#else texsize = next_power_of_2(texsize); +#endif if (p_msdf) { texsize = MIN(texsize, 2048); @@ -256,8 +304,9 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_ } } tex.offsets.resize(texsize); + int32_t *offw = tex.offsets.ptrw(); for (int i = 0; i < texsize; i++) { // Zero offsets. - tex.offsets.write[i] = 0; + offw[i] = 0; } p_data->textures.push_back(tex); @@ -435,7 +484,9 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_msdf( // Blit to image and texture. { if (RenderingServer::get_singleton() != nullptr) { - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); tex.texture->create_from_image(img); @@ -446,8 +497,9 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_msdf( } // Update height array. + int32_t *offw = tex.offsets.ptrw(); for (int k = tex_pos.x; k < tex_pos.x + mw; k++) { - tex.offsets.write[k] = tex_pos.y + mh; + offw[k] = tex_pos.y + mh; } chr.texture_idx = tex_pos.index; @@ -507,7 +559,7 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma wr[ofs + 3] = bitmap.buffer[ofs_color + 3]; } break; default: - ERR_FAIL_V_MSG(FontGlyph(), "Font uses unsupported pixel format: " + itos(bitmap.pixel_mode) + "."); + ERR_FAIL_V_MSG(FontGlyph(), "Font uses unsupported pixel format: " + String::num_int64(bitmap.pixel_mode) + "."); break; } } @@ -517,7 +569,9 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma // Blit to image and texture. { if (RenderingServer::get_singleton() != nullptr) { - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); @@ -529,8 +583,9 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma } // Update height array. + int32_t *offw = tex.offsets.ptrw(); for (int k = tex_pos.x; k < tex_pos.x + mw; k++) { - tex.offsets.write[k] = tex_pos.y + mh; + offw[k] = tex_pos.y + mh; } FontGlyph chr; @@ -552,7 +607,7 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma _FORCE_INLINE_ bool TextServerFallback::_ensure_glyph(FontDataFallback *p_font_data, const Vector2i &p_size, int32_t p_glyph) const { ERR_FAIL_COND_V(!_ensure_cache_for_size(p_font_data, p_size), false); - int32_t glyph_index = p_glyph & 0xFFFFFF; // Remove subpixel shifts. + int32_t glyph_index = p_glyph & 0xffffff; // Remove subpixel shifts. FontDataForSizeFallback *fd = p_font_data->cache[p_size]; if (fd->glyph_map.has(p_glyph)) { @@ -641,7 +696,7 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_glyph(FontDataFallback *p_font_d } } else { FT_Stroker stroker; - if (FT_Stroker_New(library, &stroker) != 0) { + if (FT_Stroker_New(ft_library, &stroker) != 0) { fd->glyph_map[p_glyph] = FontGlyph(); ERR_FAIL_V_MSG(false, "FreeType: Failed to load glyph stroker."); } @@ -687,8 +742,8 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback // Init dynamic font. #ifdef MODULE_FREETYPE_ENABLED int error = 0; - if (!library) { - error = FT_Init_FreeType(&library); + if (!ft_library) { + error = FT_Init_FreeType(&ft_library); ERR_FAIL_COND_V_MSG(error != 0, false, "FreeType: Error initializing library: '" + String(FT_Error_String(error)) + "'."); } @@ -703,7 +758,7 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback fargs.memory_size = p_font_data->data_size; fargs.flags = FT_OPEN_MEMORY; fargs.stream = &fd->stream; - error = FT_Open_Face(library, &fargs, 0, &fd->face); + error = FT_Open_Face(ft_library, &fargs, 0, &fd->face); if (error) { FT_Done_Face(fd->face); fd->face = nullptr; @@ -711,9 +766,9 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback } if (p_font_data->msdf) { - fd->oversampling = 1.0f; + fd->oversampling = 1.0; fd->size.x = p_font_data->msdf_source_size; - } else if (p_font_data->oversampling <= 0.0f) { + } else if (p_font_data->oversampling <= 0.0) { fd->oversampling = font_get_global_oversampling(); } else { fd->oversampling = p_font_data->oversampling; @@ -722,19 +777,19 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback if (FT_HAS_COLOR(fd->face) && fd->face->num_fixed_sizes > 0) { int best_match = 0; int diff = ABS(fd->size.x - ((int64_t)fd->face->available_sizes[0].width)); - fd->scale = float(fd->size.x * fd->oversampling) / fd->face->available_sizes[0].width; + fd->scale = double(fd->size.x * fd->oversampling) / fd->face->available_sizes[0].width; for (int i = 1; i < fd->face->num_fixed_sizes; i++) { int ndiff = ABS(fd->size.x - ((int64_t)fd->face->available_sizes[i].width)); if (ndiff < diff) { best_match = i; diff = ndiff; - fd->scale = float(fd->size.x * fd->oversampling) / fd->face->available_sizes[i].width; + fd->scale = double(fd->size.x * fd->oversampling) / fd->face->available_sizes[i].width; } } FT_Select_Size(fd->face, best_match); } else { FT_Set_Pixel_Sizes(fd->face, 0, Math::round(fd->size.x * fd->oversampling)); - fd->scale = ((float)fd->size.x * fd->oversampling) / (float)fd->face->size->metrics.y_ppem; + fd->scale = ((double)fd->size.x * fd->oversampling) / (double)fd->face->size->metrics.y_ppem; } fd->ascent = (fd->face->size->metrics.ascender / 64.0) / fd->oversampling * fd->scale; @@ -768,7 +823,7 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback for (FT_UInt i = 0; i < amaster->num_axis; i++) { p_font_data->supported_varaitions[(int32_t)amaster->axis[i].tag] = Vector3i(amaster->axis[i].minimum / 65536, amaster->axis[i].maximum / 65536, amaster->axis[i].def / 65536); } - FT_Done_MM_Var(library, amaster); + FT_Done_MM_Var(ft_library, amaster); } p_font_data->face_init = true; } @@ -787,22 +842,22 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontDataFallback for (FT_UInt i = 0; i < amaster->num_axis; i++) { // Reset to default. int32_t var_tag = amaster->axis[i].tag; - float var_value = (double)amaster->axis[i].def / 65536.f; + double var_value = (double)amaster->axis[i].def / 65536.0; coords.write[i] = amaster->axis[i].def; if (p_font_data->variation_coordinates.has(var_tag)) { var_value = p_font_data->variation_coordinates[var_tag]; - coords.write[i] = CLAMP(var_value * 65536.f, amaster->axis[i].minimum, amaster->axis[i].maximum); + coords.write[i] = CLAMP(var_value * 65536.0, amaster->axis[i].minimum, amaster->axis[i].maximum); } if (p_font_data->variation_coordinates.has(tag_to_name(var_tag))) { var_value = p_font_data->variation_coordinates[tag_to_name(var_tag)]; - coords.write[i] = CLAMP(var_value * 65536.f, amaster->axis[i].minimum, amaster->axis[i].maximum); + coords.write[i] = CLAMP(var_value * 65536.0, amaster->axis[i].minimum, amaster->axis[i].maximum); } } FT_Set_Var_Design_Coordinates(fd->face, coords.size(), coords.ptrw()); - FT_Done_MM_Var(library, amaster); + FT_Done_MM_Var(ft_library, amaster); } #else ERR_FAIL_V_MSG(false, "FreeType: Can't load dynamic font, engine is compiled without FreeType support!"); @@ -828,7 +883,7 @@ RID TextServerFallback::create_font() { return font_owner.make_rid(fd); } -void TextServerFallback::font_set_data(RID p_font_rid, const PackedByteArray &p_data) { +void TextServerFallback::font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -839,18 +894,18 @@ void TextServerFallback::font_set_data(RID p_font_rid, const PackedByteArray &p_ fd->data_size = fd->data.size(); } -void TextServerFallback::font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) { +void TextServerFallback::font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); - fd->data.clear(); + fd->data.resize(0); fd->data_ptr = p_data_ptr; fd->data_size = p_data_size; } -void TextServerFallback::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) { +void TextServerFallback::font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -860,7 +915,7 @@ void TextServerFallback::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p fd->style_flags = p_style; } -uint32_t /*FontStyle*/ TextServerFallback::font_get_style(RID p_font_rid) const { +int64_t /*FontStyle*/ TextServerFallback::font_get_style(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -870,7 +925,7 @@ uint32_t /*FontStyle*/ TextServerFallback::font_get_style(RID p_font_rid) const return fd->style_flags; } -void TextServerFallback::font_set_style_name(RID p_font_rid, const String &p_name) { +void TextServerFallback::font_set_style_name(const RID &p_font_rid, const String &p_name) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -880,7 +935,7 @@ void TextServerFallback::font_set_style_name(RID p_font_rid, const String &p_nam fd->style_name = p_name; } -String TextServerFallback::font_get_style_name(RID p_font_rid) const { +String TextServerFallback::font_get_style_name(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -890,7 +945,7 @@ String TextServerFallback::font_get_style_name(RID p_font_rid) const { return fd->style_name; } -void TextServerFallback::font_set_name(RID p_font_rid, const String &p_name) { +void TextServerFallback::font_set_name(const RID &p_font_rid, const String &p_name) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -900,7 +955,7 @@ void TextServerFallback::font_set_name(RID p_font_rid, const String &p_name) { fd->font_name = p_name; } -String TextServerFallback::font_get_name(RID p_font_rid) const { +String TextServerFallback::font_get_name(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -910,7 +965,7 @@ String TextServerFallback::font_get_name(RID p_font_rid) const { return fd->font_name; } -void TextServerFallback::font_set_antialiased(RID p_font_rid, bool p_antialiased) { +void TextServerFallback::font_set_antialiased(const RID &p_font_rid, bool p_antialiased) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -921,7 +976,7 @@ void TextServerFallback::font_set_antialiased(RID p_font_rid, bool p_antialiased } } -bool TextServerFallback::font_is_antialiased(RID p_font_rid) const { +bool TextServerFallback::font_is_antialiased(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -929,7 +984,7 @@ bool TextServerFallback::font_is_antialiased(RID p_font_rid) const { return fd->antialiased; } -void TextServerFallback::font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) { +void TextServerFallback::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -940,7 +995,7 @@ void TextServerFallback::font_set_multichannel_signed_distance_field(RID p_font_ } } -bool TextServerFallback::font_is_multichannel_signed_distance_field(RID p_font_rid) const { +bool TextServerFallback::font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -948,7 +1003,7 @@ bool TextServerFallback::font_is_multichannel_signed_distance_field(RID p_font_r return fd->msdf; } -void TextServerFallback::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) { +void TextServerFallback::font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -959,7 +1014,7 @@ void TextServerFallback::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pi } } -int TextServerFallback::font_get_msdf_pixel_range(RID p_font_rid) const { +int64_t TextServerFallback::font_get_msdf_pixel_range(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -967,7 +1022,7 @@ int TextServerFallback::font_get_msdf_pixel_range(RID p_font_rid) const { return fd->msdf_range; } -void TextServerFallback::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { +void TextServerFallback::font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -978,7 +1033,7 @@ void TextServerFallback::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { } } -int TextServerFallback::font_get_msdf_size(RID p_font_rid) const { +int64_t TextServerFallback::font_get_msdf_size(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -986,7 +1041,7 @@ int TextServerFallback::font_get_msdf_size(RID p_font_rid) const { return fd->msdf_source_size; } -void TextServerFallback::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { +void TextServerFallback::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -996,7 +1051,7 @@ void TextServerFallback::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { } } -int TextServerFallback::font_get_fixed_size(RID p_font_rid) const { +int64_t TextServerFallback::font_get_fixed_size(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1004,7 +1059,7 @@ int TextServerFallback::font_get_fixed_size(RID p_font_rid) const { return fd->fixed_size; } -void TextServerFallback::font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) { +void TextServerFallback::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1015,7 +1070,7 @@ void TextServerFallback::font_set_force_autohinter(RID p_font_rid, bool p_force_ } } -bool TextServerFallback::font_is_force_autohinter(RID p_font_rid) const { +bool TextServerFallback::font_is_force_autohinter(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -1023,7 +1078,7 @@ bool TextServerFallback::font_is_force_autohinter(RID p_font_rid) const { return fd->force_autohinter; } -void TextServerFallback::font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) { +void TextServerFallback::font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1034,7 +1089,7 @@ void TextServerFallback::font_set_hinting(RID p_font_rid, TextServer::Hinting p_ } } -TextServer::Hinting TextServerFallback::font_get_hinting(RID p_font_rid) const { +TextServer::Hinting TextServerFallback::font_get_hinting(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, HINTING_NONE); @@ -1042,7 +1097,7 @@ TextServer::Hinting TextServerFallback::font_get_hinting(RID p_font_rid) const { return fd->hinting; } -void TextServerFallback::font_set_subpixel_positioning(RID p_font_rid, TextServer::SubpixelPositioning p_subpixel) { +void TextServerFallback::font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1052,7 +1107,7 @@ void TextServerFallback::font_set_subpixel_positioning(RID p_font_rid, TextServe } } -TextServer::SubpixelPositioning TextServerFallback::font_get_subpixel_positioning(RID p_font_rid) const { +TextServer::SubpixelPositioning TextServerFallback::font_get_subpixel_positioning(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, SUBPIXEL_POSITIONING_DISABLED); @@ -1060,7 +1115,7 @@ TextServer::SubpixelPositioning TextServerFallback::font_get_subpixel_positionin return fd->subpixel_positioning; } -void TextServerFallback::font_set_embolden(RID p_font_rid, float p_strength) { +void TextServerFallback::font_set_embolden(const RID &p_font_rid, double p_strength) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1071,15 +1126,15 @@ void TextServerFallback::font_set_embolden(RID p_font_rid, float p_strength) { } } -float TextServerFallback::font_get_embolden(RID p_font_rid) const { +double TextServerFallback::font_get_embolden(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); return fd->embolden; } -void TextServerFallback::font_set_transform(RID p_font_rid, Transform2D p_transform) { +void TextServerFallback::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1090,7 +1145,7 @@ void TextServerFallback::font_set_transform(RID p_font_rid, Transform2D p_transf } } -Transform2D TextServerFallback::font_get_transform(RID p_font_rid) const { +Transform2D TextServerFallback::font_get_transform(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Transform2D()); @@ -1098,7 +1153,7 @@ Transform2D TextServerFallback::font_get_transform(RID p_font_rid) const { return fd->transform; } -void TextServerFallback::font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) { +void TextServerFallback::font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1109,7 +1164,7 @@ void TextServerFallback::font_set_variation_coordinates(RID p_font_rid, const Di } } -Dictionary TextServerFallback::font_get_variation_coordinates(RID p_font_rid) const { +Dictionary TextServerFallback::font_get_variation_coordinates(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -1117,7 +1172,7 @@ Dictionary TextServerFallback::font_get_variation_coordinates(RID p_font_rid) co return fd->variation_coordinates; } -void TextServerFallback::font_set_oversampling(RID p_font_rid, float p_oversampling) { +void TextServerFallback::font_set_oversampling(const RID &p_font_rid, double p_oversampling) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1128,15 +1183,15 @@ void TextServerFallback::font_set_oversampling(RID p_font_rid, float p_oversampl } } -float TextServerFallback::font_get_oversampling(RID p_font_rid) const { +double TextServerFallback::font_get_oversampling(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); return fd->oversampling; } -Array TextServerFallback::font_get_size_cache_list(RID p_font_rid) const { +Array TextServerFallback::font_get_size_cache_list(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); @@ -1148,7 +1203,7 @@ Array TextServerFallback::font_get_size_cache_list(RID p_font_rid) const { return ret; } -void TextServerFallback::font_clear_size_cache(RID p_font_rid) { +void TextServerFallback::font_clear_size_cache(const RID &p_font_rid) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1159,7 +1214,7 @@ void TextServerFallback::font_clear_size_cache(RID p_font_rid) { fd->cache.clear(); } -void TextServerFallback::font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) { +void TextServerFallback::font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1170,7 +1225,7 @@ void TextServerFallback::font_remove_size_cache(RID p_font_rid, const Vector2i & } } -void TextServerFallback::font_set_ascent(RID p_font_rid, int p_size, float p_ascent) { +void TextServerFallback::font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1181,23 +1236,23 @@ void TextServerFallback::font_set_ascent(RID p_font_rid, int p_size, float p_asc fd->cache[size]->ascent = p_ascent; } -float TextServerFallback::font_get_ascent(RID p_font_rid, int p_size) const { +double TextServerFallback::font_get_ascent(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->ascent * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->ascent * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->ascent; } } -void TextServerFallback::font_set_descent(RID p_font_rid, int p_size, float p_descent) { +void TextServerFallback::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1207,23 +1262,23 @@ void TextServerFallback::font_set_descent(RID p_font_rid, int p_size, float p_de fd->cache[size]->descent = p_descent; } -float TextServerFallback::font_get_descent(RID p_font_rid, int p_size) const { +double TextServerFallback::font_get_descent(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->descent * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->descent * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->descent; } } -void TextServerFallback::font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) { +void TextServerFallback::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1234,23 +1289,23 @@ void TextServerFallback::font_set_underline_position(RID p_font_rid, int p_size, fd->cache[size]->underline_position = p_underline_position; } -float TextServerFallback::font_get_underline_position(RID p_font_rid, int p_size) const { +double TextServerFallback::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->underline_position * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->underline_position * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->underline_position; } } -void TextServerFallback::font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) { +void TextServerFallback::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1261,23 +1316,23 @@ void TextServerFallback::font_set_underline_thickness(RID p_font_rid, int p_size fd->cache[size]->underline_thickness = p_underline_thickness; } -float TextServerFallback::font_get_underline_thickness(RID p_font_rid, int p_size) const { +double TextServerFallback::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->underline_thickness * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->underline_thickness * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->underline_thickness; } } -void TextServerFallback::font_set_scale(RID p_font_rid, int p_size, float p_scale) { +void TextServerFallback::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1288,23 +1343,23 @@ void TextServerFallback::font_set_scale(RID p_font_rid, int p_size, float p_scal fd->cache[size]->scale = p_scale; } -float TextServerFallback::font_get_scale(RID p_font_rid, int p_size) const { +double TextServerFallback::font_get_scale(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.f); + ERR_FAIL_COND_V(!fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); - ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.f); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0.0); if (fd->msdf) { - return fd->cache[size]->scale * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->scale * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->scale / fd->cache[size]->oversampling; } } -void TextServerFallback::font_set_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing, int p_value) { +void TextServerFallback::font_set_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing, int64_t p_value) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1320,12 +1375,12 @@ void TextServerFallback::font_set_spacing(RID p_font_rid, int p_size, TextServer fd->cache[size]->spacing_space = p_value; } break; default: { - ERR_FAIL_MSG("Invalid spacing type: " + itos(p_spacing)); + ERR_FAIL_MSG("Invalid spacing type: " + String::num_int64(p_spacing)); } break; } } -int TextServerFallback::font_get_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing) const { +int64_t TextServerFallback::font_get_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -1337,26 +1392,26 @@ int TextServerFallback::font_get_spacing(RID p_font_rid, int p_size, TextServer: switch (p_spacing) { case TextServer::SPACING_GLYPH: { if (fd->msdf) { - return fd->cache[size]->spacing_glyph * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->spacing_glyph * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->spacing_glyph; } } break; case TextServer::SPACING_SPACE: { if (fd->msdf) { - return fd->cache[size]->spacing_space * (float)p_size / (float)fd->msdf_source_size; + return fd->cache[size]->spacing_space * (double)p_size / (double)fd->msdf_source_size; } else { return fd->cache[size]->spacing_space; } } break; default: { - ERR_FAIL_V_MSG(0, "Invalid spacing type: " + itos(p_spacing)); + ERR_FAIL_V_MSG(0, "Invalid spacing type: " + String::num_int64(p_spacing)); } break; } return 0; } -int TextServerFallback::font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const { +int64_t TextServerFallback::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, 0); @@ -1368,7 +1423,7 @@ int TextServerFallback::font_get_texture_count(RID p_font_rid, const Vector2i &p return fd->cache[size]->textures.size(); } -void TextServerFallback::font_clear_textures(RID p_font_rid, const Vector2i &p_size) { +void TextServerFallback::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); @@ -1378,7 +1433,7 @@ void TextServerFallback::font_clear_textures(RID p_font_rid, const Vector2i &p_s fd->cache[size]->textures.clear(); } -void TextServerFallback::font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) { +void TextServerFallback::font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1390,7 +1445,7 @@ void TextServerFallback::font_remove_texture(RID p_font_rid, const Vector2i &p_s fd->cache[size]->textures.remove_at(p_texture_index); } -void TextServerFallback::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { +void TextServerFallback::font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); ERR_FAIL_COND(p_image.is_null()); @@ -1410,13 +1465,16 @@ void TextServerFallback::font_set_texture_image(RID p_font_rid, const Vector2i & tex.texture_h = p_image->get_height(); tex.format = p_image->get_format(); - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata)); + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + tex.texture = Ref<ImageTexture>(); tex.texture.instantiate(); tex.texture->create_from_image(img); } -Ref<Image> TextServerFallback::font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +Ref<Image> TextServerFallback::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Ref<Image>()); @@ -1425,13 +1483,15 @@ Ref<Image> TextServerFallback::font_get_texture_image(RID p_font_rid, const Vect ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Ref<Image>()); ERR_FAIL_INDEX_V(p_texture_index, fd->cache[size]->textures.size(), Ref<Image>()); - const FontTexture &tex = fd->cache[size]->textures.write[p_texture_index]; - Ref<Image> img = memnew(Image(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata)); + const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; + Ref<Image> img; + img.instantiate(); + img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); return img; } -void TextServerFallback::font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) { +void TextServerFallback::font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1447,7 +1507,7 @@ void TextServerFallback::font_set_texture_offsets(RID p_font_rid, const Vector2i tex.offsets = p_offset; } -PackedInt32Array TextServerFallback::font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +PackedInt32Array TextServerFallback::font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, PackedInt32Array()); @@ -1456,11 +1516,11 @@ PackedInt32Array TextServerFallback::font_get_texture_offsets(RID p_font_rid, co ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), PackedInt32Array()); ERR_FAIL_INDEX_V(p_texture_index, fd->cache[size]->textures.size(), PackedInt32Array()); - const FontTexture &tex = fd->cache[size]->textures.write[p_texture_index]; + const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; return tex.offsets; } -Array TextServerFallback::font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const { +Array TextServerFallback::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); @@ -1477,7 +1537,7 @@ Array TextServerFallback::font_get_glyph_list(RID p_font_rid, const Vector2i &p_ return ret; } -void TextServerFallback::font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) { +void TextServerFallback::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1488,7 +1548,7 @@ void TextServerFallback::font_clear_glyphs(RID p_font_rid, const Vector2i &p_siz fd->cache[size]->glyph_map.clear(); } -void TextServerFallback::font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) { +void TextServerFallback::font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1499,7 +1559,7 @@ void TextServerFallback::font_remove_glyph(RID p_font_rid, const Vector2i &p_siz fd->cache[size]->glyph_map.erase(p_glyph); } -Vector2 TextServerFallback::font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const { +Vector2 TextServerFallback::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -1515,11 +1575,11 @@ Vector2 TextServerFallback::font_get_glyph_advance(RID p_font_rid, int p_size, i Vector2 ea; if (fd->embolden != 0.0) { - ea.x = fd->embolden * float(size.x) / 64.0; + ea.x = fd->embolden * double(size.x) / 64.0; } if (fd->msdf) { - return (gl[p_glyph].advance + ea) * (float)p_size / (float)fd->msdf_source_size; + return (gl[p_glyph].advance + ea) * (double)p_size / (double)fd->msdf_source_size; } else if ((fd->subpixel_positioning == SUBPIXEL_POSITIONING_DISABLED) || (fd->subpixel_positioning == SUBPIXEL_POSITIONING_AUTO && size.x > SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE)) { return (gl[p_glyph].advance + ea).round(); } else { @@ -1527,7 +1587,7 @@ Vector2 TextServerFallback::font_get_glyph_advance(RID p_font_rid, int p_size, i } } -void TextServerFallback::font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) { +void TextServerFallback::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1542,7 +1602,7 @@ void TextServerFallback::font_set_glyph_advance(RID p_font_rid, int p_size, int3 gl[p_glyph].found = true; } -Vector2 TextServerFallback::font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerFallback::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -1557,13 +1617,13 @@ Vector2 TextServerFallback::font_get_glyph_offset(RID p_font_rid, const Vector2i const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.position * (float)p_size.x / (float)fd->msdf_source_size; + return gl[p_glyph].rect.position * (double)p_size.x / (double)fd->msdf_source_size; } else { return gl[p_glyph].rect.position; } } -void TextServerFallback::font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) { +void TextServerFallback::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1578,7 +1638,7 @@ void TextServerFallback::font_set_glyph_offset(RID p_font_rid, const Vector2i &p gl[p_glyph].found = true; } -Vector2 TextServerFallback::font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerFallback::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -1593,13 +1653,13 @@ Vector2 TextServerFallback::font_get_glyph_size(RID p_font_rid, const Vector2i & const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.size * (float)p_size.x / (float)fd->msdf_source_size; + return gl[p_glyph].rect.size * (double)p_size.x / (double)fd->msdf_source_size; } else { return gl[p_glyph].rect.size; } } -void TextServerFallback::font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) { +void TextServerFallback::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1614,7 +1674,7 @@ void TextServerFallback::font_set_glyph_size(RID p_font_rid, const Vector2i &p_s gl[p_glyph].found = true; } -Rect2 TextServerFallback::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Rect2 TextServerFallback::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Rect2()); @@ -1630,7 +1690,7 @@ Rect2 TextServerFallback::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i return gl[p_glyph].uv_rect; } -void TextServerFallback::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) { +void TextServerFallback::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1645,7 +1705,7 @@ void TextServerFallback::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i & gl[p_glyph].found = true; } -int TextServerFallback::font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +int64_t TextServerFallback::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, -1); @@ -1661,7 +1721,7 @@ int TextServerFallback::font_get_glyph_texture_idx(RID p_font_rid, const Vector2 return gl[p_glyph].texture_idx; } -void TextServerFallback::font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) { +void TextServerFallback::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1676,7 +1736,7 @@ void TextServerFallback::font_set_glyph_texture_idx(RID p_font_rid, const Vector gl[p_glyph].found = true; } -Dictionary TextServerFallback::font_get_glyph_contours(RID p_font_rid, int p_size, int32_t p_index) const { +Dictionary TextServerFallback::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -1685,20 +1745,19 @@ Dictionary TextServerFallback::font_get_glyph_contours(RID p_font_rid, int p_siz ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Dictionary()); - Vector<Vector3> points; - Vector<int32_t> contours; + PackedVector3Array points; + PackedInt32Array contours; bool orientation; #ifdef MODULE_FREETYPE_ENABLED - int error = FT_Load_Glyph(fd->cache[size]->face, FT_Get_Char_Index(fd->cache[size]->face, p_index), FT_LOAD_NO_BITMAP | (fd->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)); - ERR_FAIL_COND_V(error, Dictionary()); + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. - points.clear(); - contours.clear(); + int error = FT_Load_Glyph(fd->cache[size]->face, FT_Get_Char_Index(fd->cache[size]->face, index), FT_LOAD_NO_BITMAP | (fd->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)); + ERR_FAIL_COND_V(error, Dictionary()); - float h = fd->cache[size]->ascent; - float scale = (1.0 / 64.0) / fd->cache[size]->oversampling * fd->cache[size]->scale; + double h = fd->cache[size]->ascent; + double scale = (1.0 / 64.0) / fd->cache[size]->oversampling * fd->cache[size]->scale; if (fd->msdf) { - scale = scale * (float)p_size / (float)fd->msdf_source_size; + scale = scale * (double)p_size / (double)fd->msdf_source_size; } for (short i = 0; i < fd->cache[size]->face->glyph->outline.n_points; i++) { points.push_back(Vector3(fd->cache[size]->face->glyph->outline.points[i].x * scale, h - fd->cache[size]->face->glyph->outline.points[i].y * scale, FT_CURVE_TAG(fd->cache[size]->face->glyph->outline.tags[i]))); @@ -1718,7 +1777,7 @@ Dictionary TextServerFallback::font_get_glyph_contours(RID p_font_rid, int p_siz return out; } -Array TextServerFallback::font_get_kerning_list(RID p_font_rid, int p_size) const { +Array TextServerFallback::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Array()); @@ -1734,7 +1793,7 @@ Array TextServerFallback::font_get_kerning_list(RID p_font_rid, int p_size) cons return ret; } -void TextServerFallback::font_clear_kerning_map(RID p_font_rid, int p_size) { +void TextServerFallback::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1745,7 +1804,7 @@ void TextServerFallback::font_clear_kerning_map(RID p_font_rid, int p_size) { fd->cache[size]->kerning_map.clear(); } -void TextServerFallback::font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) { +void TextServerFallback::font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1756,7 +1815,7 @@ void TextServerFallback::font_remove_kerning(RID p_font_rid, int p_size, const V fd->cache[size]->kerning_map.erase(p_glyph_pair); } -void TextServerFallback::font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { +void TextServerFallback::font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1767,7 +1826,7 @@ void TextServerFallback::font_set_kerning(RID p_font_rid, int p_size, const Vect fd->cache[size]->kerning_map[p_glyph_pair] = p_kerning; } -Vector2 TextServerFallback::font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const { +Vector2 TextServerFallback::font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Vector2()); @@ -1780,7 +1839,7 @@ Vector2 TextServerFallback::font_get_kerning(RID p_font_rid, int p_size, const V if (kern.has(p_glyph_pair)) { if (fd->msdf) { - return kern[p_glyph_pair] * (float)p_size / (float)fd->msdf_source_size; + return kern[p_glyph_pair] * (double)p_size / (double)fd->msdf_source_size; } else { return kern[p_glyph_pair]; } @@ -1792,7 +1851,7 @@ Vector2 TextServerFallback::font_get_kerning(RID p_font_rid, int p_size, const V int32_t glyph_b = FT_Get_Char_Index(fd->cache[size]->face, p_glyph_pair.y); FT_Get_Kerning(fd->cache[size]->face, glyph_a, glyph_b, FT_KERNING_DEFAULT, &delta); if (fd->msdf) { - return Vector2(delta.x, delta.y) * (float)p_size / (float)fd->msdf_source_size; + return Vector2(delta.x, delta.y) * (double)p_size / (double)fd->msdf_source_size; } else { return Vector2(delta.x, delta.y); } @@ -1802,12 +1861,12 @@ Vector2 TextServerFallback::font_get_kerning(RID p_font_rid, int p_size, const V return Vector2(); } -int32_t TextServerFallback::font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector) const { +int64_t TextServerFallback::font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const { ERR_FAIL_COND_V_MSG((p_char >= 0xd800 && p_char <= 0xdfff) || (p_char > 0x10ffff), 0, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_char, 16) + "."); - return (int32_t)p_char; + return (int64_t)p_char; } -bool TextServerFallback::font_has_char(RID p_font_rid, char32_t p_char) const { +bool TextServerFallback::font_has_char(const RID &p_font_rid, int64_t p_char) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); ERR_FAIL_COND_V_MSG((p_char >= 0xd800 && p_char <= 0xdfff) || (p_char > 0x10ffff), false, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_char, 16) + "."); @@ -1826,7 +1885,7 @@ bool TextServerFallback::font_has_char(RID p_font_rid, char32_t p_char) const { return (at_size) ? at_size->glyph_map.has((int32_t)p_char) : false; } -String TextServerFallback::font_get_supported_chars(RID p_font_rid) const { +String TextServerFallback::font_get_supported_chars(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, String()); @@ -1843,7 +1902,7 @@ String TextServerFallback::font_get_supported_chars(RID p_font_rid) const { FT_ULong charcode = FT_Get_First_Char(at_size->face, &gindex); while (gindex != 0) { if (charcode != 0) { - chars += char32_t(charcode); + chars = chars + String::chr(charcode); } charcode = FT_Get_Next_Char(at_size->face, charcode, &gindex); } @@ -1854,13 +1913,13 @@ String TextServerFallback::font_get_supported_chars(RID p_font_rid) const { const HashMap<int32_t, FontGlyph> &gl = at_size->glyph_map; const int32_t *E = nullptr; while ((E = gl.next(E))) { - chars += char32_t(*E); + chars = chars + String::chr(*E); } } return chars; } -void TextServerFallback::font_render_range(RID p_font_rid, const Vector2i &p_size, char32_t p_start, char32_t p_end) { +void TextServerFallback::font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); ERR_FAIL_COND_MSG((p_start >= 0xd800 && p_start <= 0xdfff) || (p_start > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_start, 16) + "."); @@ -1869,7 +1928,7 @@ void TextServerFallback::font_render_range(RID p_font_rid, const Vector2i &p_siz MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - for (char32_t i = p_start; i <= p_end; i++) { + for (int64_t i = p_start; i <= p_end; i++) { #ifdef MODULE_FREETYPE_ENABLED int32_t idx = i; if (fd->cache[size]->face) { @@ -1893,7 +1952,7 @@ void TextServerFallback::font_render_range(RID p_font_rid, const Vector2i &p_siz } } -void TextServerFallback::font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) { +void TextServerFallback::font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1901,7 +1960,7 @@ void TextServerFallback::font_render_glyph(RID p_font_rid, const Vector2i &p_siz Vector2i size = _get_size_outline(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); #ifdef MODULE_FREETYPE_ENABLED - int32_t idx = p_index; + int32_t idx = p_index & 0xffffff; // Remove subpixel shifts. if (fd->cache[size]->face) { if (fd->msdf) { _ensure_glyph(fd, size, (int32_t)idx); @@ -1922,7 +1981,7 @@ void TextServerFallback::font_render_glyph(RID p_font_rid, const Vector2i &p_siz #endif } -void TextServerFallback::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { +void TextServerFallback::font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1930,7 +1989,7 @@ void TextServerFallback::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz Vector2i size = _get_size(fd, p_size); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - int32_t index = p_index; + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. #ifdef MODULE_FREETYPE_ENABLED if (!fd->msdf && fd->cache[size]->face) { @@ -1963,8 +2022,8 @@ void TextServerFallback::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz RID texture = fd->cache[size]->textures[gl.texture_idx].texture->get_rid(); if (fd->msdf) { Point2 cpos = p_pos; - cpos += gl.rect.position * (float)p_size / (float)fd->msdf_source_size; - Size2 csize = gl.rect.size * (float)p_size / (float)fd->msdf_source_size; + cpos += gl.rect.position * (double)p_size / (double)fd->msdf_source_size; + Size2 csize = gl.rect.size * (double)p_size / (double)fd->msdf_source_size; RenderingServer::get_singleton()->canvas_item_add_msdf_texture_rect_region(p_canvas, Rect2(cpos, csize), texture, gl.uv_rect, modulate, 0, fd->msdf_range); } else { Point2 cpos = p_pos; @@ -1985,7 +2044,7 @@ void TextServerFallback::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_siz } } -void TextServerFallback::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { +void TextServerFallback::font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1993,7 +2052,7 @@ void TextServerFallback::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i Vector2i size = _get_size_outline(fd, Vector2i(p_size, p_outline_size)); ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); - int32_t index = p_index; + int32_t index = p_index & 0xffffff; // Remove subpixel shifts. #ifdef MODULE_FREETYPE_ENABLED if (!fd->msdf && fd->cache[size]->face) { @@ -2026,8 +2085,8 @@ void TextServerFallback::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i RID texture = fd->cache[size]->textures[gl.texture_idx].texture->get_rid(); if (fd->msdf) { Point2 cpos = p_pos; - cpos += gl.rect.position * (float)p_size / (float)fd->msdf_source_size; - Size2 csize = gl.rect.size * (float)p_size / (float)fd->msdf_source_size; + cpos += gl.rect.position * (double)p_size / (double)fd->msdf_source_size; + Size2 csize = gl.rect.size * (double)p_size / (double)fd->msdf_source_size; RenderingServer::get_singleton()->canvas_item_add_msdf_texture_rect_region(p_canvas, Rect2(cpos, csize), texture, gl.uv_rect, modulate, p_outline_size * 2, fd->msdf_range); } else { Point2 cpos = p_pos; @@ -2048,7 +2107,7 @@ void TextServerFallback::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, i } } -bool TextServerFallback::font_is_language_supported(RID p_font_rid, const String &p_language) const { +bool TextServerFallback::font_is_language_supported(const RID &p_font_rid, const String &p_language) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2060,7 +2119,7 @@ bool TextServerFallback::font_is_language_supported(RID p_font_rid, const String } } -void TextServerFallback::font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) { +void TextServerFallback::font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2068,7 +2127,7 @@ void TextServerFallback::font_set_language_support_override(RID p_font_rid, cons fd->language_support_overrides[p_language] = p_supported; } -bool TextServerFallback::font_get_language_support_override(RID p_font_rid, const String &p_language) { +bool TextServerFallback::font_get_language_support_override(const RID &p_font_rid, const String &p_language) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2076,7 +2135,7 @@ bool TextServerFallback::font_get_language_support_override(RID p_font_rid, cons return fd->language_support_overrides[p_language]; } -void TextServerFallback::font_remove_language_support_override(RID p_font_rid, const String &p_language) { +void TextServerFallback::font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2084,19 +2143,19 @@ void TextServerFallback::font_remove_language_support_override(RID p_font_rid, c fd->language_support_overrides.erase(p_language); } -Vector<String> TextServerFallback::font_get_language_support_overrides(RID p_font_rid) { +PackedStringArray TextServerFallback::font_get_language_support_overrides(const RID &p_font_rid) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector<String>()); + ERR_FAIL_COND_V(!fd, PackedStringArray()); MutexLock lock(fd->mutex); - Vector<String> out; + PackedStringArray out; for (const KeyValue<String, bool> &E : fd->language_support_overrides) { out.push_back(E.key); } return out; } -bool TextServerFallback::font_is_script_supported(RID p_font_rid, const String &p_script) const { +bool TextServerFallback::font_is_script_supported(const RID &p_font_rid, const String &p_script) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2108,7 +2167,7 @@ bool TextServerFallback::font_is_script_supported(RID p_font_rid, const String & } } -void TextServerFallback::font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) { +void TextServerFallback::font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2116,7 +2175,7 @@ void TextServerFallback::font_set_script_support_override(RID p_font_rid, const fd->script_support_overrides[p_script] = p_supported; } -bool TextServerFallback::font_get_script_support_override(RID p_font_rid, const String &p_script) { +bool TextServerFallback::font_get_script_support_override(const RID &p_font_rid, const String &p_script) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, false); @@ -2124,7 +2183,7 @@ bool TextServerFallback::font_get_script_support_override(RID p_font_rid, const return fd->script_support_overrides[p_script]; } -void TextServerFallback::font_remove_script_support_override(RID p_font_rid, const String &p_script) { +void TextServerFallback::font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2134,19 +2193,19 @@ void TextServerFallback::font_remove_script_support_override(RID p_font_rid, con fd->script_support_overrides.erase(p_script); } -Vector<String> TextServerFallback::font_get_script_support_overrides(RID p_font_rid) { +PackedStringArray TextServerFallback::font_get_script_support_overrides(const RID &p_font_rid) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector<String>()); + ERR_FAIL_COND_V(!fd, PackedStringArray()); MutexLock lock(fd->mutex); - Vector<String> out; + PackedStringArray out; for (const KeyValue<String, bool> &E : fd->script_support_overrides) { out.push_back(E.key); } return out; } -void TextServerFallback::font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) { +void TextServerFallback::font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2156,7 +2215,7 @@ void TextServerFallback::font_set_opentype_feature_overrides(RID p_font_rid, con fd->feature_overrides = p_overrides; } -Dictionary TextServerFallback::font_get_opentype_feature_overrides(RID p_font_rid) const { +Dictionary TextServerFallback::font_get_opentype_feature_overrides(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -2164,11 +2223,11 @@ Dictionary TextServerFallback::font_get_opentype_feature_overrides(RID p_font_ri return fd->feature_overrides; } -Dictionary TextServerFallback::font_supported_feature_list(RID p_font_rid) const { +Dictionary TextServerFallback::font_supported_feature_list(const RID &p_font_rid) const { return Dictionary(); } -Dictionary TextServerFallback::font_supported_variation_list(RID p_font_rid) const { +Dictionary TextServerFallback::font_supported_variation_list(const RID &p_font_rid) const { FontDataFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND_V(!fd, Dictionary()); @@ -2178,11 +2237,11 @@ Dictionary TextServerFallback::font_supported_variation_list(RID p_font_rid) con return fd->supported_varaitions; } -float TextServerFallback::font_get_global_oversampling() const { +double TextServerFallback::font_get_global_oversampling() const { return oversampling; } -void TextServerFallback::font_set_global_oversampling(float p_oversampling) { +void TextServerFallback::font_set_global_oversampling(double p_oversampling) { _THREAD_SAFE_METHOD_ if (oversampling != p_oversampling) { oversampling = p_oversampling; @@ -2215,11 +2274,11 @@ void TextServerFallback::invalidate(ShapedTextDataFallback *p_shaped) { p_shaped->sort_valid = false; p_shaped->line_breaks_valid = false; p_shaped->justification_ops_valid = false; - p_shaped->ascent = 0.f; - p_shaped->descent = 0.f; - p_shaped->width = 0.f; - p_shaped->upos = 0.f; - p_shaped->uthk = 0.f; + p_shaped->ascent = 0.0; + p_shaped->descent = 0.0; + p_shaped->width = 0.0; + p_shaped->upos = 0.0; + p_shaped->uthk = 0.0; p_shaped->glyphs.clear(); p_shaped->glyphs_logical.clear(); } @@ -2255,7 +2314,7 @@ RID TextServerFallback::create_shaped_text(TextServer::Direction p_direction, Te return shaped_owner.make_rid(sd); } -void TextServerFallback::shaped_text_clear(RID p_shaped) { +void TextServerFallback::shaped_text_clear(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -2269,21 +2328,21 @@ void TextServerFallback::shaped_text_clear(RID p_shaped) { invalidate(sd); } -void TextServerFallback::shaped_text_set_direction(RID p_shaped, TextServer::Direction p_direction) { +void TextServerFallback::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) { if (p_direction == DIRECTION_RTL) { ERR_PRINT_ONCE("Right-to-left layout is not supported by this text server."); } } -TextServer::Direction TextServerFallback::shaped_text_get_direction(RID p_shaped) const { +TextServer::Direction TextServerFallback::shaped_text_get_direction(const RID &p_shaped) const { return TextServer::DIRECTION_LTR; } -TextServer::Direction TextServerFallback::shaped_text_get_inferred_direction(RID p_shaped) const { +TextServer::Direction TextServerFallback::shaped_text_get_inferred_direction(const RID &p_shaped) const { return TextServer::DIRECTION_LTR; } -void TextServerFallback::shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) { +void TextServerFallback::shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) { _THREAD_SAFE_METHOD_ ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -2297,14 +2356,14 @@ void TextServerFallback::shaped_text_set_custom_punctuation(RID p_shaped, const } } -String TextServerFallback::shaped_text_get_custom_punctuation(RID p_shaped) const { +String TextServerFallback::shaped_text_get_custom_punctuation(const RID &p_shaped) const { _THREAD_SAFE_METHOD_ const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, String()); return sd->custom_punct; } -void TextServerFallback::shaped_text_set_orientation(RID p_shaped, TextServer::Orientation p_orientation) { +void TextServerFallback::shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -2318,11 +2377,11 @@ void TextServerFallback::shaped_text_set_orientation(RID p_shaped, TextServer::O } } -void TextServerFallback::shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) { +void TextServerFallback::shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) { // No BiDi support, ignore. } -TextServer::Orientation TextServerFallback::shaped_text_get_orientation(RID p_shaped) const { +TextServer::Orientation TextServerFallback::shaped_text_get_orientation(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, TextServer::ORIENTATION_HORIZONTAL); @@ -2330,7 +2389,7 @@ TextServer::Orientation TextServerFallback::shaped_text_get_orientation(RID p_sh return sd->orientation; } -void TextServerFallback::shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) { +void TextServerFallback::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); MutexLock lock(sd->mutex); @@ -2344,7 +2403,7 @@ void TextServerFallback::shaped_text_set_preserve_invalid(RID p_shaped, bool p_e } } -bool TextServerFallback::shaped_text_get_preserve_invalid(RID p_shaped) const { +bool TextServerFallback::shaped_text_get_preserve_invalid(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2352,7 +2411,7 @@ bool TextServerFallback::shaped_text_get_preserve_invalid(RID p_shaped) const { return sd->preserve_invalid; } -void TextServerFallback::shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) { +void TextServerFallback::shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); @@ -2366,7 +2425,7 @@ void TextServerFallback::shaped_text_set_preserve_control(RID p_shaped, bool p_e } } -bool TextServerFallback::shaped_text_get_preserve_control(RID p_shaped) const { +bool TextServerFallback::shaped_text_get_preserve_control(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2374,28 +2433,28 @@ bool TextServerFallback::shaped_text_get_preserve_control(RID p_shaped) const { return sd->preserve_control; } -int TextServerFallback::shaped_get_span_count(RID p_shaped) const { +int64_t TextServerFallback::shaped_get_span_count(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, 0); return sd->spans.size(); } -Variant TextServerFallback::shaped_get_span_meta(RID p_shaped, int p_index) const { +Variant TextServerFallback::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Variant()); ERR_FAIL_INDEX_V(p_index, sd->spans.size(), Variant()); return sd->spans[p_index].meta; } -void TextServerFallback::shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features) { +void TextServerFallback::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); - ShapedTextDataFallback::Span &span = sd->spans.write[p_index]; + ShapedTextDataFallback::Span &span = sd->spans.ptrw()[p_index]; span.fonts.clear(); // Pre-sort fonts, push fonts with the language support first. - Vector<RID> fonts_no_match; + Array fonts_no_match; int font_count = p_fonts.size(); for (int i = 0; i < font_count; i++) { if (font_is_language_supported(p_fonts[i], span.language)) { @@ -2411,7 +2470,7 @@ void TextServerFallback::shaped_set_span_update_font(RID p_shaped, int p_index, sd->valid = false; } -bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { +bool TextServerFallback::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2435,7 +2494,7 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te span.end = span.start + p_text.length(); // Pre-sort fonts, push fonts with the language support first. - Vector<RID> fonts_no_match; + Array fonts_no_match; int font_count = p_fonts.size(); for (int i = 0; i < font_count; i++) { if (font_is_language_supported(p_fonts[i], p_language)) { @@ -2452,14 +2511,14 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te span.meta = p_meta; sd->spans.push_back(span); - sd->text += p_text; + sd->text = sd->text + p_text; sd->end += p_text.length(); invalidate(sd); return true; } -bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) { +bool TextServerFallback::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2482,7 +2541,7 @@ bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, con obj.pos = span.start; sd->spans.push_back(span); - sd->text += String::chr(0xfffc).repeat(p_length); + sd->text = sd->text + String::chr(0xfffc).repeat(p_length); sd->end += p_length; sd->objects[p_key] = obj; invalidate(sd); @@ -2490,7 +2549,7 @@ bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, con return true; } -bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) { +bool TextServerFallback::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2544,8 +2603,8 @@ bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, if (sd->orientation == ORIENTATION_HORIZONTAL) { sd->ascent = MAX(sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y); } else { - sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); - sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); + sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); + sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); } } sd->width += gl.advance * gl.repeat; @@ -2558,8 +2617,8 @@ bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, void TextServerFallback::_realign(ShapedTextDataFallback *p_sd) const { // Align embedded objects to baseline. - float full_ascent = p_sd->ascent; - float full_descent = p_sd->descent; + double full_ascent = p_sd->ascent; + double full_descent = p_sd->descent; for (KeyValue<Variant, ShapedTextDataFallback::EmbeddedObject> &E : p_sd->objects) { if ((E.value.pos >= p_sd->start) && (E.value.pos < p_sd->end)) { if (p_sd->orientation == ORIENTATION_HORIZONTAL) { @@ -2625,7 +2684,7 @@ void TextServerFallback::_realign(ShapedTextDataFallback *p_sd) const { p_sd->descent = full_descent; } -RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_length) const { +RID TextServerFallback::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, RID()); @@ -2697,8 +2756,8 @@ RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_leng if (new_sd->orientation == ORIENTATION_HORIZONTAL) { new_sd->ascent = MAX(new_sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y); } else { - new_sd->ascent = MAX(new_sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); - new_sd->descent = MAX(new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); + new_sd->ascent = MAX(new_sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); + new_sd->descent = MAX(new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); } } new_sd->width += gl.advance * gl.repeat; @@ -2707,79 +2766,14 @@ RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_leng } } - // Align embedded objects to baseline. - float full_ascent = new_sd->ascent; - float full_descent = new_sd->descent; - for (KeyValue<Variant, ShapedTextDataFallback::EmbeddedObject> &E : new_sd->objects) { - if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) { - if (sd->orientation == ORIENTATION_HORIZONTAL) { - switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { - case INLINE_ALIGNMENT_TO_TOP: { - E.value.rect.position.y = -new_sd->ascent; - } break; - case INLINE_ALIGNMENT_TO_CENTER: { - E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2; - } break; - case INLINE_ALIGNMENT_TO_BASELINE: { - E.value.rect.position.y = 0; - } break; - case INLINE_ALIGNMENT_TO_BOTTOM: { - E.value.rect.position.y = new_sd->descent; - } break; - } - switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { - case INLINE_ALIGNMENT_BOTTOM_TO: { - E.value.rect.position.y -= E.value.rect.size.y; - } break; - case INLINE_ALIGNMENT_CENTER_TO: { - E.value.rect.position.y -= E.value.rect.size.y / 2; - } break; - case INLINE_ALIGNMENT_TOP_TO: { - // NOP - } break; - } - full_ascent = MAX(full_ascent, -E.value.rect.position.y); - full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y); - } else { - switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { - case INLINE_ALIGNMENT_TO_TOP: { - E.value.rect.position.x = -new_sd->ascent; - } break; - case INLINE_ALIGNMENT_TO_CENTER: { - E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2; - } break; - case INLINE_ALIGNMENT_TO_BASELINE: { - E.value.rect.position.x = 0; - } break; - case INLINE_ALIGNMENT_TO_BOTTOM: { - E.value.rect.position.x = new_sd->descent; - } break; - } - switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { - case INLINE_ALIGNMENT_BOTTOM_TO: { - E.value.rect.position.x -= E.value.rect.size.x; - } break; - case INLINE_ALIGNMENT_CENTER_TO: { - E.value.rect.position.x -= E.value.rect.size.x / 2; - } break; - case INLINE_ALIGNMENT_TOP_TO: { - // NOP - } break; - } - full_ascent = MAX(full_ascent, -E.value.rect.position.x); - full_descent = MAX(full_descent, E.value.rect.position.x + E.value.rect.size.x); - } - } - } - new_sd->ascent = full_ascent; - new_sd->descent = full_descent; + _realign(new_sd); } new_sd->valid = true; return shaped_owner.make_rid(new_sd); } -RID TextServerFallback::shaped_text_get_parent(RID p_shaped) const { +RID TextServerFallback::shaped_text_get_parent(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, RID()); @@ -2787,9 +2781,9 @@ RID TextServerFallback::shaped_text_get_parent(RID p_shaped) const { return sd->parent; } -float TextServerFallback::shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags) { +double TextServerFallback::shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -2827,7 +2821,7 @@ float TextServerFallback::shaped_text_fit_to_width(RID p_shaped, float p_width, } } - float justification_width; + double justification_width; if ((p_jst_flags & JUSTIFICATION_CONSTRAIN_ELLIPSIS) == JUSTIFICATION_CONSTRAIN_ELLIPSIS) { if (sd->overrun_trim_data.trim_pos >= 0) { end_pos = sd->overrun_trim_data.trim_pos; @@ -2872,12 +2866,12 @@ float TextServerFallback::shaped_text_fit_to_width(RID p_shaped, float p_width, } if ((space_count > 0) && ((p_jst_flags & JUSTIFICATION_WORD_BOUND) == JUSTIFICATION_WORD_BOUND)) { - float delta_width_per_space = (p_width - justification_width) / space_count; + double delta_width_per_space = (p_width - justification_width) / space_count; for (int i = start_pos; i <= end_pos; i++) { Glyph &gl = sd->glyphs.write[i]; if (gl.count > 0) { if ((gl.flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE) { - float old_adv = gl.advance; + double old_adv = gl.advance; gl.advance = MAX(gl.advance + delta_width_per_space, Math::round(0.1 * gl.font_size)); justification_width += (gl.advance - old_adv); } @@ -2896,9 +2890,9 @@ float TextServerFallback::shaped_text_fit_to_width(RID p_shaped, float p_width, return Math::ceil(justification_width); } -float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) { +double TextServerFallback::shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -2910,12 +2904,12 @@ float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat3 for (int i = 0; i < p_tab_stops.size(); i++) { if (p_tab_stops[i] <= 0) { - return 0.f; + return 0.0; } } int tab_index = 0; - float off = 0.f; + double off = 0.0; int start, end, delta; if (sd->para_direction == DIRECTION_LTR) { @@ -2932,7 +2926,7 @@ float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat3 for (int i = start; i != end; i += delta) { if ((gl[i].flags & GRAPHEME_IS_TAB) == GRAPHEME_IS_TAB) { - float tab_off = 0.f; + double tab_off = 0.0; while (tab_off <= off) { tab_off += p_tab_stops[tab_index]; tab_index++; @@ -2940,7 +2934,7 @@ float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat3 tab_index = 0; } } - float old_adv = gl[i].advance; + double old_adv = gl[i].advance; gl[i].advance = tab_off - off; sd->width += gl[i].advance - old_adv; off = 0; @@ -2949,10 +2943,10 @@ float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat3 off += gl[i].advance * gl[i].repeat; } - return 0.f; + return 0.0; } -bool TextServerFallback::shaped_text_update_breaks(RID p_shaped) { +bool TextServerFallback::shaped_text_update_breaks(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3008,7 +3002,7 @@ bool TextServerFallback::shaped_text_update_breaks(RID p_shaped) { return sd->line_breaks_valid; } -bool TextServerFallback::shaped_text_update_justification_ops(RID p_shaped) { +bool TextServerFallback::shaped_text_update_justification_ops(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3024,7 +3018,7 @@ bool TextServerFallback::shaped_text_update_justification_ops(RID p_shaped) { return true; } -void TextServerFallback::shaped_text_overrun_trim_to_width(RID p_shaped_line, float p_width, uint16_t p_trim_flags) { +void TextServerFallback::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, int64_t p_trim_flags) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped_line); ERR_FAIL_COND_MSG(!sd, "ShapedTextDataFallback invalid."); @@ -3070,20 +3064,20 @@ void TextServerFallback::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl // Find usable fonts, if fonts from the last glyph do not have required chars. RID dot_gl_font_rid = sd_glyphs[sd_size - 1].font_rid; if (!font_has_char(dot_gl_font_rid, '.')) { - const Vector<RID> &fonts = spans[spans.size() - 1].fonts; - for (const RID &font : fonts) { - if (font_has_char(font, '.')) { - dot_gl_font_rid = font; + const Array &fonts = spans[spans.size() - 1].fonts; + for (int i = 0; i < fonts.size(); i++) { + if (font_has_char(fonts[i], '.')) { + dot_gl_font_rid = fonts[i]; break; } } } RID whitespace_gl_font_rid = sd_glyphs[sd_size - 1].font_rid; if (!font_has_char(whitespace_gl_font_rid, '.')) { - const Vector<RID> &fonts = spans[spans.size() - 1].fonts; - for (const RID &font : fonts) { - if (font_has_char(font, ' ')) { - whitespace_gl_font_rid = font; + const Array &fonts = spans[spans.size() - 1].fonts; + for (int i = 0; i < fonts.size(); i++) { + if (font_has_char(fonts[i], ' ')) { + whitespace_gl_font_rid = fonts[i]; break; } } @@ -3100,7 +3094,7 @@ void TextServerFallback::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl } int ell_min_characters = 6; - float width = sd->width; + double width = sd->width; int trim_pos = 0; int ellipsis_pos = (enforce_ellipsis) ? 0 : -1; @@ -3176,7 +3170,7 @@ void TextServerFallback::shaped_text_overrun_trim_to_width(RID p_shaped_line, fl } } -int TextServerFallback::shaped_text_get_trim_pos(RID p_shaped) const { +int64_t TextServerFallback::shaped_text_get_trim_pos(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataFallback invalid."); @@ -3184,7 +3178,7 @@ int TextServerFallback::shaped_text_get_trim_pos(RID p_shaped) const { return sd->overrun_trim_data.trim_pos; } -int TextServerFallback::shaped_text_get_ellipsis_pos(RID p_shaped) const { +int64_t TextServerFallback::shaped_text_get_ellipsis_pos(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataFallback invalid."); @@ -3192,7 +3186,7 @@ int TextServerFallback::shaped_text_get_ellipsis_pos(RID p_shaped) const { return sd->overrun_trim_data.ellipsis_pos; } -const Glyph *TextServerFallback::shaped_text_get_ellipsis_glyphs(RID p_shaped) const { +const Glyph *TextServerFallback::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, nullptr, "ShapedTextDataFallback invalid."); @@ -3200,7 +3194,7 @@ const Glyph *TextServerFallback::shaped_text_get_ellipsis_glyphs(RID p_shaped) c return sd->overrun_trim_data.ellipsis_glyph_buf.ptr(); } -int TextServerFallback::shaped_text_get_ellipsis_glyph_count(RID p_shaped) const { +int64_t TextServerFallback::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V_MSG(!sd, 0, "ShapedTextDataFallback invalid."); @@ -3208,7 +3202,7 @@ int TextServerFallback::shaped_text_get_ellipsis_glyph_count(RID p_shaped) const return sd->overrun_trim_data.ellipsis_glyph_buf.size(); } -bool TextServerFallback::shaped_text_shape(RID p_shaped) { +bool TextServerFallback::shaped_text_shape(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3224,9 +3218,9 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) { // Cleanup. sd->justification_ops_valid = false; sd->line_breaks_valid = false; - sd->ascent = 0.f; - sd->descent = 0.f; - sd->width = 0.f; + sd->ascent = 0.0; + sd->descent = 0.0; + sd->width = 0.0; sd->glyphs.clear(); if (sd->text.length() == 0) { @@ -3327,8 +3321,8 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) { sd->ascent = MAX(sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y); } else { gl.advance = get_hex_code_box_size(gl.font_size, gl.index).y; - sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); - sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5f)); + sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); + sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5)); } } sd->width += gl.advance; @@ -3338,74 +3332,13 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) { } // Align embedded objects to baseline. - float full_ascent = sd->ascent; - float full_descent = sd->descent; - for (KeyValue<Variant, ShapedTextDataFallback::EmbeddedObject> &E : sd->objects) { - if (sd->orientation == ORIENTATION_HORIZONTAL) { - switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { - case INLINE_ALIGNMENT_TO_TOP: { - E.value.rect.position.y = -sd->ascent; - } break; - case INLINE_ALIGNMENT_TO_CENTER: { - E.value.rect.position.y = (-sd->ascent + sd->descent) / 2; - } break; - case INLINE_ALIGNMENT_TO_BASELINE: { - E.value.rect.position.y = 0; - } break; - case INLINE_ALIGNMENT_TO_BOTTOM: { - E.value.rect.position.y = sd->descent; - } break; - } - switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { - case INLINE_ALIGNMENT_BOTTOM_TO: { - E.value.rect.position.y -= E.value.rect.size.y; - } break; - case INLINE_ALIGNMENT_CENTER_TO: { - E.value.rect.position.y -= E.value.rect.size.y / 2; - } break; - case INLINE_ALIGNMENT_TOP_TO: { - // NOP - } break; - } - full_ascent = MAX(full_ascent, -E.value.rect.position.y); - full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y); - } else { - switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { - case INLINE_ALIGNMENT_TO_TOP: { - E.value.rect.position.x = -sd->ascent; - } break; - case INLINE_ALIGNMENT_TO_CENTER: { - E.value.rect.position.x = (-sd->ascent + sd->descent) / 2; - } break; - case INLINE_ALIGNMENT_TO_BASELINE: { - E.value.rect.position.x = 0; - } break; - case INLINE_ALIGNMENT_TO_BOTTOM: { - E.value.rect.position.x = sd->descent; - } break; - } - switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { - case INLINE_ALIGNMENT_BOTTOM_TO: { - E.value.rect.position.x -= E.value.rect.size.x; - } break; - case INLINE_ALIGNMENT_CENTER_TO: { - E.value.rect.position.x -= E.value.rect.size.x / 2; - } break; - case INLINE_ALIGNMENT_TOP_TO: { - // NOP - } break; - } - full_ascent = MAX(full_ascent, -E.value.rect.position.x); - full_descent = MAX(full_descent, E.value.rect.position.x + E.value.rect.size.x); - } - } - sd->ascent = full_ascent; - sd->descent = full_descent; + _realign(sd); + sd->valid = true; return sd->valid; } -bool TextServerFallback::shaped_text_is_ready(RID p_shaped) const { +bool TextServerFallback::shaped_text_is_ready(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3413,7 +3346,7 @@ bool TextServerFallback::shaped_text_is_ready(RID p_shaped) const { return sd->valid; } -const Glyph *TextServerFallback::shaped_text_get_glyphs(RID p_shaped) const { +const Glyph *TextServerFallback::shaped_text_get_glyphs(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, nullptr); @@ -3424,7 +3357,7 @@ const Glyph *TextServerFallback::shaped_text_get_glyphs(RID p_shaped) const { return sd->glyphs.ptr(); } -int TextServerFallback::shaped_text_get_glyph_count(RID p_shaped) const { +int64_t TextServerFallback::shaped_text_get_glyph_count(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, 0); @@ -3435,7 +3368,7 @@ int TextServerFallback::shaped_text_get_glyph_count(RID p_shaped) const { return sd->glyphs.size(); } -const Glyph *TextServerFallback::shaped_text_sort_logical(RID p_shaped) { +const Glyph *TextServerFallback::shaped_text_sort_logical(const RID &p_shaped) { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, nullptr); @@ -3447,7 +3380,7 @@ const Glyph *TextServerFallback::shaped_text_sort_logical(RID p_shaped) { return sd->glyphs.ptr(); // Already in the logical order, return as is. } -Vector2i TextServerFallback::shaped_text_get_range(RID p_shaped) const { +Vector2i TextServerFallback::shaped_text_get_range(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Vector2i()); @@ -3455,7 +3388,7 @@ Vector2i TextServerFallback::shaped_text_get_range(RID p_shaped) const { return Vector2(sd->start, sd->end); } -Array TextServerFallback::shaped_text_get_objects(RID p_shaped) const { +Array TextServerFallback::shaped_text_get_objects(const RID &p_shaped) const { Array ret; const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, ret); @@ -3468,7 +3401,7 @@ Array TextServerFallback::shaped_text_get_objects(RID p_shaped) const { return ret; } -Rect2 TextServerFallback::shaped_text_get_object_rect(RID p_shaped, Variant p_key) const { +Rect2 TextServerFallback::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Rect2()); @@ -3480,7 +3413,7 @@ Rect2 TextServerFallback::shaped_text_get_object_rect(RID p_shaped, Variant p_ke return sd->objects[p_key].rect; } -Size2 TextServerFallback::shaped_text_get_size(RID p_shaped) const { +Size2 TextServerFallback::shaped_text_get_size(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, Size2()); @@ -3495,9 +3428,9 @@ Size2 TextServerFallback::shaped_text_get_size(RID p_shaped) const { } } -float TextServerFallback::shaped_text_get_ascent(RID p_shaped) const { +double TextServerFallback::shaped_text_get_ascent(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3506,9 +3439,9 @@ float TextServerFallback::shaped_text_get_ascent(RID p_shaped) const { return sd->ascent; } -float TextServerFallback::shaped_text_get_descent(RID p_shaped) const { +double TextServerFallback::shaped_text_get_descent(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3517,9 +3450,9 @@ float TextServerFallback::shaped_text_get_descent(RID p_shaped) const { return sd->descent; } -float TextServerFallback::shaped_text_get_width(RID p_shaped) const { +double TextServerFallback::shaped_text_get_width(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3528,9 +3461,9 @@ float TextServerFallback::shaped_text_get_width(RID p_shaped) const { return Math::ceil(sd->width); } -float TextServerFallback::shaped_text_get_underline_position(RID p_shaped) const { +double TextServerFallback::shaped_text_get_underline_position(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3540,9 +3473,9 @@ float TextServerFallback::shaped_text_get_underline_position(RID p_shaped) const return sd->upos; } -float TextServerFallback::shaped_text_get_underline_thickness(RID p_shaped) const { +double TextServerFallback::shaped_text_get_underline_thickness(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.f); + ERR_FAIL_COND_V(!sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3555,7 +3488,7 @@ float TextServerFallback::shaped_text_get_underline_thickness(RID p_shaped) cons String TextServerFallback::string_to_upper(const String &p_string, const String &p_language) const { String upper = p_string; - for (int i = 0; i < upper.size(); i++) { + for (int i = 0; i <= upper.length(); i++) { const char32_t s = upper[i]; const char32_t t = _find_upper(s); if (s != t) { // avoid copy on write @@ -3569,7 +3502,7 @@ String TextServerFallback::string_to_upper(const String &p_string, const String String TextServerFallback::string_to_lower(const String &p_string, const String &p_language) const { String lower = p_string; - for (int i = 0; i < lower.size(); i++) { + for (int i = 0; i <= lower.length(); i++) { const char32_t s = lower[i]; const char32_t t = _find_lower(s); if (s != t) { // avoid copy on write @@ -3586,8 +3519,8 @@ TextServerFallback::TextServerFallback() { TextServerFallback::~TextServerFallback() { #ifdef MODULE_FREETYPE_ENABLED - if (library != nullptr) { - FT_Done_FreeType(library); + if (ft_library != nullptr) { + FT_Done_FreeType(ft_library); } #endif }; diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index d4c7b5666e..3944c371b7 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -36,7 +36,49 @@ /* BiDi, shaping and advanced font features support. */ /*************************************************************************/ -#include "servers/text_server.h" +#ifdef GDEXTENSION +// Headers for building as GDExtension plug-in. + +#include <godot_cpp/godot.hpp> + +#include <godot_cpp/core/class_db.hpp> +#include <godot_cpp/core/mutex_lock.hpp> + +#include <godot_cpp/variant/array.hpp> +#include <godot_cpp/variant/dictionary.hpp> +#include <godot_cpp/variant/packed_int32_array.hpp> +#include <godot_cpp/variant/packed_string_array.hpp> +#include <godot_cpp/variant/packed_vector2_array.hpp> +#include <godot_cpp/variant/rect2.hpp> +#include <godot_cpp/variant/rid.hpp> +#include <godot_cpp/variant/string.hpp> +#include <godot_cpp/variant/vector2.hpp> +#include <godot_cpp/variant/vector2i.hpp> + +#include <godot_cpp/classes/text_server.hpp> +#include <godot_cpp/classes/text_server_extension.hpp> +#include <godot_cpp/classes/text_server_manager.hpp> + +#include <godot_cpp/classes/caret_info.hpp> +#include <godot_cpp/classes/global_constants_binds.hpp> +#include <godot_cpp/classes/glyph.hpp> +#include <godot_cpp/classes/image.hpp> +#include <godot_cpp/classes/image_texture.hpp> +#include <godot_cpp/classes/ref.hpp> + +#include <godot_cpp/templates/hash_map.hpp> +#include <godot_cpp/templates/map.hpp> +#include <godot_cpp/templates/rid_owner.hpp> +#include <godot_cpp/templates/set.hpp> +#include <godot_cpp/templates/thread_work_pool.hpp> +#include <godot_cpp/templates/vector.hpp> + +using namespace godot; + +#else +// Headers for building as built-in module. + +#include "servers/text/text_server_extension.h" #include "core/templates/rid_owner.h" #include "core/templates/thread_work_pool.h" @@ -44,6 +86,10 @@ #include "modules/modules_enabled.gen.h" // For freetype, msdfgen. +#endif + +// Thirdparty headers. + #ifdef MODULE_FREETYPE_ENABLED #include <ft2build.h> #include FT_FREETYPE_H @@ -54,26 +100,25 @@ #include FT_BBOX_H #endif -#define OT_TAG(c1, c2, c3, c4) ((int32_t)((((uint32_t)(c1)&0xFF) << 24) | (((uint32_t)(c2)&0xFF) << 16) | (((uint32_t)(c3)&0xFF) << 8) | ((uint32_t)(c4)&0xFF))) +/*************************************************************************/ -class TextServerFallback : public TextServer { - GDCLASS(TextServerFallback, TextServer); +class TextServerFallback : public TextServerExtension { + GDCLASS(TextServerFallback, TextServerExtension); _THREAD_SAFE_CLASS_ - static String interface_name; - static uint32_t interface_features; - Map<StringName, int32_t> feature_sets; + Map<int32_t, StringName> feature_sets_inv; void _insert_feature_sets(); + _FORCE_INLINE_ void _insert_feature(const StringName &p_name, int32_t p_tag); // Font cache data. #ifdef MODULE_FREETYPE_ENABLED - mutable FT_Library library = nullptr; + mutable FT_Library ft_library = nullptr; #endif - const int rect_range = 2; + const int rect_range = 1; struct FontTexture { Image::Format format; @@ -99,12 +144,12 @@ class TextServerFallback : public TextServer { }; struct FontDataForSizeFallback { - float ascent = 0.f; - float descent = 0.f; - float underline_position = 0.f; - float underline_thickness = 0.f; - float scale = 1.f; - float oversampling = 1.f; + double ascent = 0.0; + double descent = 0.0; + double underline_position = 0.0; + double underline_thickness = 0.0; + double scale = 1.0; + double oversampling = 1.0; int spacing_glyph = 0; int spacing_space = 0; @@ -141,8 +186,8 @@ class TextServerFallback : public TextServer { TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; Dictionary variation_coordinates; - float oversampling = 0.f; - float embolden = 0.f; + double oversampling = 0.0; + double embolden = 0.0; Transform2D transform; uint32_t style_flags = 0; @@ -167,8 +212,8 @@ class TextServerFallback : public TextServer { ~FontDataFallback() { work_pool.finish(); - for (const Map<Vector2i, FontDataForSizeFallback *>::Element *E = cache.front(); E; E = E->next()) { - memdelete(E->get()); + for (const KeyValue<Vector2i, FontDataForSizeFallback *> &E : cache) { + memdelete(E.value); } cache.clear(); } @@ -207,13 +252,31 @@ class TextServerFallback : public TextServer { } // Shaped text cache data. + struct TrimData { + int trim_pos = -1; + int ellipsis_pos = -1; + Vector<Glyph> ellipsis_glyph_buf; + }; + + struct ShapedTextDataFallback { + Mutex mutex; + + /* Source data */ + RID parent; // Substring parent ShapedTextData. + + int start = 0; // Substring start offset in the parent string. + int end = 0; // Substring end offset in the parent string. + + String text; + String custom_punct; + TextServer::Direction direction = DIRECTION_LTR; // Desired text direction. + TextServer::Orientation orientation = ORIENTATION_HORIZONTAL; - struct ShapedTextDataFallback : public ShapedTextData { struct Span { int start = -1; int end = -1; - Vector<RID> fonts; + Array fonts; int font_size = 0; Variant embedded_key; @@ -223,11 +286,43 @@ class TextServerFallback : public TextServer { Variant meta; }; Vector<Span> spans; + + struct EmbeddedObject { + int pos = 0; + InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; + Rect2 rect; + }; + Map<Variant, EmbeddedObject> objects; + + /* Shaped data */ + TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. + bool valid = false; // String is shaped. + bool line_breaks_valid = false; // Line and word break flags are populated (and virtual zero width spaces inserted). + bool justification_ops_valid = false; // Virtual elongation glyphs are added to the string. + bool sort_valid = false; + bool text_trimmed = false; + + bool preserve_invalid = true; // Draw hex code box instead of missing characters. + bool preserve_control = false; // Draw control characters. + + double ascent = 0.0; // Ascent for horizontal layout, 1/2 of width for vertical. + double descent = 0.0; // Descent for horizontal layout, 1/2 of width for vertical. + double width = 0.0; // Width for horizontal layout, height for vertical. + double width_trimmed = 0.0; + + double upos = 0.0; + double uthk = 0.0; + + TrimData overrun_trim_data; + bool fit_width_minimum_reached = false; + + Vector<Glyph> glyphs; + Vector<Glyph> glyphs_logical; }; // Common data. - float oversampling = 1.f; + double oversampling = 1.0; mutable RID_PtrOwner<FontDataFallback> font_owner; mutable RID_PtrOwner<ShapedTextDataFallback> shaped_owner; @@ -242,10 +337,10 @@ protected: public: virtual bool has_feature(Feature p_feature) const override; virtual String get_name() const override; - virtual uint32_t get_features() const override; + virtual int64_t get_features() const override; - virtual void free(RID p_rid) override; - virtual bool has(RID p_rid) override; + virtual void free_rid(const RID &p_rid) override; + virtual bool has(const RID &p_rid) override; virtual bool load_support_data(const String &p_filename) override; virtual String get_support_data_filename() const override { return ""; }; @@ -254,218 +349,218 @@ public: virtual bool is_locale_right_to_left(const String &p_locale) const override; - virtual int32_t name_to_tag(const String &p_name) const override; - virtual String tag_to_name(int32_t p_tag) const override; + virtual int64_t name_to_tag(const String &p_name) const override; + virtual String tag_to_name(int64_t p_tag) const override; /* Font interface */ virtual RID create_font() override; - virtual void font_set_data(RID p_font_rid, const PackedByteArray &p_data) override; - virtual void font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) override; + virtual void font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) override; + virtual void font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) override; - virtual void font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) override; - virtual uint32_t /*FontStyle*/ font_get_style(RID p_font_rid) const override; + virtual void font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) override; + virtual int64_t /*FontStyle*/ font_get_style(const RID &p_font_rid) const override; - virtual void font_set_style_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_style_name(RID p_font_rid) const override; + virtual void font_set_style_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_style_name(const RID &p_font_rid) const override; - virtual void font_set_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_name(RID p_font_rid) const override; + virtual void font_set_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_name(const RID &p_font_rid) const override; - virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) override; - virtual bool font_is_antialiased(RID p_font_rid) const override; + virtual void font_set_antialiased(const RID &p_font_rid, bool p_antialiased) override; + virtual bool font_is_antialiased(const RID &p_font_rid) const override; - virtual void font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) override; - virtual bool font_is_multichannel_signed_distance_field(RID p_font_rid) const override; + virtual void font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) override; + virtual bool font_is_multichannel_signed_distance_field(const RID &p_font_rid) const override; - virtual void font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) override; - virtual int font_get_msdf_pixel_range(RID p_font_rid) const override; + virtual void font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) override; + virtual int64_t font_get_msdf_pixel_range(const RID &p_font_rid) const override; - virtual void font_set_msdf_size(RID p_font_rid, int p_msdf_size) override; - virtual int font_get_msdf_size(RID p_font_rid) const override; + virtual void font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) override; + virtual int64_t font_get_msdf_size(const RID &p_font_rid) const override; - virtual void font_set_fixed_size(RID p_font_rid, int p_fixed_size) override; - virtual int font_get_fixed_size(RID p_font_rid) const override; + virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) override; + virtual int64_t font_get_fixed_size(const RID &p_font_rid) const override; - virtual void font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) override; - virtual bool font_is_force_autohinter(RID p_font_rid) const override; + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) override; + virtual bool font_is_force_autohinter(const RID &p_font_rid) const override; - virtual void font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) override; - virtual TextServer::Hinting font_get_hinting(RID p_font_rid) const override; + virtual void font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) override; + virtual TextServer::Hinting font_get_hinting(const RID &p_font_rid) const override; - virtual void font_set_subpixel_positioning(RID p_font_rid, SubpixelPositioning p_subpixel) override; - virtual SubpixelPositioning font_get_subpixel_positioning(RID p_font_rid) const override; + virtual void font_set_subpixel_positioning(const RID &p_font_rid, SubpixelPositioning p_subpixel) override; + virtual SubpixelPositioning font_get_subpixel_positioning(const RID &p_font_rid) const override; - virtual void font_set_embolden(RID p_font_rid, float p_strength) override; - virtual float font_get_embolden(RID p_font_rid) const override; + virtual void font_set_embolden(const RID &p_font_rid, double p_strength) override; + virtual double font_get_embolden(const RID &p_font_rid) const override; - virtual void font_set_transform(RID p_font_rid, Transform2D p_transform) override; - virtual Transform2D font_get_transform(RID p_font_rid) const override; + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) override; + virtual Transform2D font_get_transform(const RID &p_font_rid) const override; - virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) override; - virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const override; + virtual void font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) override; + virtual Dictionary font_get_variation_coordinates(const RID &p_font_rid) const override; - virtual void font_set_oversampling(RID p_font_rid, float p_oversampling) override; - virtual float font_get_oversampling(RID p_font_rid) const override; + virtual void font_set_oversampling(const RID &p_font_rid, double p_oversampling) override; + virtual double font_get_oversampling(const RID &p_font_rid) const override; - virtual Array font_get_size_cache_list(RID p_font_rid) const override; - virtual void font_clear_size_cache(RID p_font_rid) override; - virtual void font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) override; + virtual Array font_get_size_cache_list(const RID &p_font_rid) const override; + virtual void font_clear_size_cache(const RID &p_font_rid) override; + virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) override; - virtual void font_set_ascent(RID p_font_rid, int p_size, float p_ascent) override; - virtual float font_get_ascent(RID p_font_rid, int p_size) const override; + virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) override; + virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_descent(RID p_font_rid, int p_size, float p_descent) override; - virtual float font_get_descent(RID p_font_rid, int p_size) const override; + virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) override; + virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) override; - virtual float font_get_underline_position(RID p_font_rid, int p_size) const override; + virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) override; + virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) override; - virtual float font_get_underline_thickness(RID p_font_rid, int p_size) const override; + virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) override; + virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_scale(RID p_font_rid, int p_size, float p_scale) override; - virtual float font_get_scale(RID p_font_rid, int p_size) const override; + virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) override; + virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const override; - virtual void font_set_spacing(RID p_font_rid, int p_size, SpacingType p_spacing, int p_value) override; - virtual int font_get_spacing(RID p_font_rid, int p_size, SpacingType p_spacing) const override; + virtual void font_set_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing, int64_t p_value) override; + virtual int64_t font_get_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing) const override; - virtual int font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_textures(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) override; + virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) override; - virtual void font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) override; - virtual Ref<Image> font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) override; + virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; - virtual void font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) override; - virtual PackedInt32Array font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + virtual void font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) override; + virtual PackedInt32Array font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; - virtual Array font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) override; + virtual Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) override; - virtual Vector2 font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) override; + virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) override; - virtual Vector2 font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) override; + virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) override; - virtual Vector2 font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) override; + virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) override; - virtual Rect2 font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) override; + virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) override; - virtual int font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) override; + virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) override; - virtual Dictionary font_get_glyph_contours(RID p_font, int p_size, int32_t p_index) const override; + virtual Dictionary font_get_glyph_contours(const RID &p_font, int64_t p_size, int64_t p_index) const override; - virtual Array font_get_kerning_list(RID p_font_rid, int p_size) const override; - virtual void font_clear_kerning_map(RID p_font_rid, int p_size) override; - virtual void font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) override; + virtual Array font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const override; + virtual void font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) override; + virtual void font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) override; - virtual void font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; - virtual Vector2 font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const override; + virtual void font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; + virtual Vector2 font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const override; - virtual int32_t font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector = 0) const override; + virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector = 0) const override; - virtual bool font_has_char(RID p_font_rid, char32_t p_char) const override; - virtual String font_get_supported_chars(RID p_font_rid) const override; + virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override; + virtual String font_get_supported_chars(const RID &p_font_rid) const override; - virtual void font_render_range(RID p_font, const Vector2i &p_size, char32_t p_start, char32_t p_end) override; - virtual void font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) override; + virtual void font_render_range(const RID &p_font, const Vector2i &p_size, int64_t p_start, int64_t p_end) override; + virtual void font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) override; - virtual void font_draw_glyph(RID p_font, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - virtual void font_draw_glyph_outline(RID p_font, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph(const RID &p_font, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph_outline(const RID &p_font, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - virtual bool font_is_language_supported(RID p_font_rid, const String &p_language) const override; - virtual void font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) override; - virtual bool font_get_language_support_override(RID p_font_rid, const String &p_language) override; - virtual void font_remove_language_support_override(RID p_font_rid, const String &p_language) override; - virtual Vector<String> font_get_language_support_overrides(RID p_font_rid) override; + virtual bool font_is_language_supported(const RID &p_font_rid, const String &p_language) const override; + virtual void font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) override; + virtual bool font_get_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual void font_remove_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual PackedStringArray font_get_language_support_overrides(const RID &p_font_rid) override; - virtual bool font_is_script_supported(RID p_font_rid, const String &p_script) const override; - virtual void font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) override; - virtual bool font_get_script_support_override(RID p_font_rid, const String &p_script) override; - virtual void font_remove_script_support_override(RID p_font_rid, const String &p_script) override; - virtual Vector<String> font_get_script_support_overrides(RID p_font_rid) override; + virtual bool font_is_script_supported(const RID &p_font_rid, const String &p_script) const override; + virtual void font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) override; + virtual bool font_get_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual void font_remove_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual PackedStringArray font_get_script_support_overrides(const RID &p_font_rid) override; - virtual void font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) override; - virtual Dictionary font_get_opentype_feature_overrides(RID p_font_rid) const override; + virtual void font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) override; + virtual Dictionary font_get_opentype_feature_overrides(const RID &p_font_rid) const override; - virtual Dictionary font_supported_feature_list(RID p_font_rid) const override; - virtual Dictionary font_supported_variation_list(RID p_font_rid) const override; + virtual Dictionary font_supported_feature_list(const RID &p_font_rid) const override; + virtual Dictionary font_supported_variation_list(const RID &p_font_rid) const override; - virtual float font_get_global_oversampling() const override; - virtual void font_set_global_oversampling(float p_oversampling) override; + virtual double font_get_global_oversampling() const override; + virtual void font_set_global_oversampling(double p_oversampling) override; /* Shaped text buffer interface */ virtual RID create_shaped_text(Direction p_direction = DIRECTION_AUTO, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - virtual void shaped_text_clear(RID p_shaped) override; + virtual void shaped_text_clear(const RID &p_shaped) override; - virtual void shaped_text_set_direction(RID p_shaped, Direction p_direction = DIRECTION_AUTO) override; - virtual Direction shaped_text_get_direction(RID p_shaped) const override; - virtual Direction shaped_text_get_inferred_direction(RID p_shaped) const override; + virtual void shaped_text_set_direction(const RID &p_shaped, Direction p_direction = DIRECTION_AUTO) override; + virtual Direction shaped_text_get_direction(const RID &p_shaped) const override; + virtual Direction shaped_text_get_inferred_direction(const RID &p_shaped) const override; - virtual void shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) override; + virtual void shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) override; - virtual void shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) override; - virtual String shaped_text_get_custom_punctuation(RID p_shaped) const override; + virtual void shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) override; + virtual String shaped_text_get_custom_punctuation(const RID &p_shaped) const override; - virtual void shaped_text_set_orientation(RID p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - virtual Orientation shaped_text_get_orientation(RID p_shaped) const override; + virtual void shaped_text_set_orientation(const RID &p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; + virtual Orientation shaped_text_get_orientation(const RID &p_shaped) const override; - virtual void shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_invalid(RID p_shaped) const override; + virtual void shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_invalid(const RID &p_shaped) const override; - virtual void shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_control(RID p_shaped) const override; + virtual void shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_control(const RID &p_shaped) const override; - virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; - virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override; - virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) override; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; - virtual int shaped_get_span_count(RID p_shaped) const override; - virtual Variant shaped_get_span_meta(RID p_shaped, int p_index) const override; - virtual void shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary()) override; + virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; + virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; - virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override; - virtual RID shaped_text_get_parent(RID p_shaped) const override; + virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override; + virtual RID shaped_text_get_parent(const RID &p_shaped) const override; - virtual float shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; - virtual float shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) override; + virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; + virtual double shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) override; - virtual bool shaped_text_shape(RID p_shaped) override; - virtual bool shaped_text_update_breaks(RID p_shaped) override; - virtual bool shaped_text_update_justification_ops(RID p_shaped) override; + virtual bool shaped_text_shape(const RID &p_shaped) override; + virtual bool shaped_text_update_breaks(const RID &p_shaped) override; + virtual bool shaped_text_update_justification_ops(const RID &p_shaped) override; - virtual int shaped_text_get_trim_pos(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_pos(RID p_shaped) const override; - virtual const Glyph *shaped_text_get_ellipsis_glyphs(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_glyph_count(RID p_shaped) const override; + virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override; - virtual void shaped_text_overrun_trim_to_width(RID p_shaped, float p_width, uint16_t p_trim_flags) override; + virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, int64_t p_trim_flags) override; - virtual bool shaped_text_is_ready(RID p_shaped) const override; + virtual bool shaped_text_is_ready(const RID &p_shaped) const override; - virtual const Glyph *shaped_text_get_glyphs(RID p_shaped) const override; - virtual const Glyph *shaped_text_sort_logical(RID p_shaped) override; - virtual int shaped_text_get_glyph_count(RID p_shaped) const override; + virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override; + virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override; - virtual Vector2i shaped_text_get_range(RID p_shaped) const override; + virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override; - virtual Array shaped_text_get_objects(RID p_shaped) const override; - virtual Rect2 shaped_text_get_object_rect(RID p_shaped, Variant p_key) const override; + virtual Array shaped_text_get_objects(const RID &p_shaped) const override; + virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override; - virtual Size2 shaped_text_get_size(RID p_shaped) const override; - virtual float shaped_text_get_ascent(RID p_shaped) const override; - virtual float shaped_text_get_descent(RID p_shaped) const override; - virtual float shaped_text_get_width(RID p_shaped) const override; - virtual float shaped_text_get_underline_position(RID p_shaped) const override; - virtual float shaped_text_get_underline_thickness(RID p_shaped) const override; + virtual Size2 shaped_text_get_size(const RID &p_shaped) const override; + virtual double shaped_text_get_ascent(const RID &p_shaped) const override; + virtual double shaped_text_get_descent(const RID &p_shaped) const override; + virtual double shaped_text_get_width(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_position(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override; virtual String string_to_upper(const String &p_string, const String &p_language = "") const override; virtual String string_to_lower(const String &p_string, const String &p_language = "") const override; diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp index f05d2faa11..e5caff2860 100644 --- a/platform/linuxbsd/export/export.cpp +++ b/platform/linuxbsd/export/export.cpp @@ -30,15 +30,10 @@ #include "export.h" -#include "core/io/file_access.h" -#include "editor/editor_export.h" -#include "platform/linuxbsd/logo.gen.h" -#include "scene/resources/texture.h" - -static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size); +#include "export_plugin.h" void register_linuxbsd_exporter() { - Ref<EditorExportPlatformPC> platform; + Ref<EditorExportPlatformLinuxBSD> platform; platform.instantiate(); Ref<Image> img = memnew(Image(_linuxbsd_logo)); @@ -55,112 +50,6 @@ void register_linuxbsd_exporter() { platform->set_debug_64("linux_x11_64_debug"); platform->set_os_name("LinuxBSD"); platform->set_chmod_flags(0755); - platform->set_fixup_embedded_pck_func(&fixup_embedded_pck); EditorExport::get_singleton()->add_export_platform(platform); } - -static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) { - // Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data - - FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE); - if (!f) { - return ERR_CANT_OPEN; - } - - // Read and check ELF magic number - { - uint32_t magic = f->get_32(); - if (magic != 0x464c457f) { // 0x7F + "ELF" - f->close(); - return ERR_FILE_CORRUPT; - } - } - - // Read program architecture bits from class field - - int bits = f->get_8() * 32; - - if (bits == 32 && p_embedded_size >= 0x100000000) { - f->close(); - ERR_FAIL_V_MSG(ERR_INVALID_DATA, "32-bit executables cannot have embedded data >= 4 GiB."); - } - - // Get info about the section header table - - int64_t section_table_pos; - int64_t section_header_size; - if (bits == 32) { - section_header_size = 40; - f->seek(0x20); - section_table_pos = f->get_32(); - f->seek(0x30); - } else { // 64 - section_header_size = 64; - f->seek(0x28); - section_table_pos = f->get_64(); - f->seek(0x3c); - } - int num_sections = f->get_16(); - int string_section_idx = f->get_16(); - - // Load the strings table - uint8_t *strings; - { - // Jump to the strings section header - f->seek(section_table_pos + string_section_idx * section_header_size); - - // Read strings data size and offset - int64_t string_data_pos; - int64_t string_data_size; - if (bits == 32) { - f->seek(f->get_position() + 0x10); - string_data_pos = f->get_32(); - string_data_size = f->get_32(); - } else { // 64 - f->seek(f->get_position() + 0x18); - string_data_pos = f->get_64(); - string_data_size = f->get_64(); - } - - // Read strings data - f->seek(string_data_pos); - strings = (uint8_t *)memalloc(string_data_size); - if (!strings) { - f->close(); - return ERR_OUT_OF_MEMORY; - } - f->get_buffer(strings, string_data_size); - } - - // Search for the "pck" section - - bool found = false; - for (int i = 0; i < num_sections; ++i) { - int64_t section_header_pos = section_table_pos + i * section_header_size; - f->seek(section_header_pos); - - uint32_t name_offset = f->get_32(); - if (strcmp((char *)strings + name_offset, "pck") == 0) { - // "pck" section found, let's patch! - - if (bits == 32) { - f->seek(section_header_pos + 0x10); - f->store_32(p_embedded_start); - f->store_32(p_embedded_size); - } else { // 64 - f->seek(section_header_pos + 0x18); - f->store_64(p_embedded_start); - f->store_64(p_embedded_size); - } - - found = true; - break; - } - } - - memfree(strings); - f->close(); - - return found ? OK : ERR_FILE_CORRUPT; -} diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp new file mode 100644 index 0000000000..08fc9c0452 --- /dev/null +++ b/platform/linuxbsd/export/export_plugin.cpp @@ -0,0 +1,200 @@ +/*************************************************************************/ +/* export_plugin.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 "export_plugin.h" + +#include "core/config/project_settings.h" +#include "editor/editor_node.h" + +Error EditorExportPlatformLinuxBSD::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) { + FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_V(!f, ERR_CANT_CREATE); + + f->store_line("#!/bin/sh"); + f->store_line("echo -ne '\\033c\\033]0;" + p_app_name + "\\a'"); + f->store_line("base_path=\"$(dirname \"$(realpath \"$0\")\")\""); + f->store_line("\"$base_path/" + p_pkg_name + "\" \"$@\""); + + return OK; +} + +Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { + Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, p_path, p_flags); + + if (err != OK) { + return err; + } + + String app_name; + if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") { + app_name = String(ProjectSettings::get_singleton()->get("application/config/name")); + } else { + app_name = "Unnamed"; + } + app_name = OS::get_singleton()->get_safe_dir_name(app_name); + + // Save console script. + if (err == OK) { + int con_scr = p_preset->get("debug/export_console_script"); + if ((con_scr == 1 && p_debug) || (con_scr == 2)) { + String scr_path = p_path.get_basename() + ".sh"; + err = _export_debug_script(p_preset, app_name, p_path.get_file(), scr_path); + FileAccess::set_unix_permissions(scr_path, 0755); + } + } + + return err; +} + +void EditorExportPlatformLinuxBSD::set_extension(const String &p_extension, const String &p_feature_key) { + extensions[p_feature_key] = p_extension; +} + +List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { + List<String> list; + for (const KeyValue<String, String> &E : extensions) { + if (p_preset->get(E.key)) { + list.push_back(extensions[E.key]); + return list; + } + } + + if (extensions.has("default")) { + list.push_back(extensions["default"]); + return list; + } + + return list; +} + +Error EditorExportPlatformLinuxBSD::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) const { + // Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data + + FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE); + if (!f) { + return ERR_CANT_OPEN; + } + + // Read and check ELF magic number + { + uint32_t magic = f->get_32(); + if (magic != 0x464c457f) { // 0x7F + "ELF" + f->close(); + return ERR_FILE_CORRUPT; + } + } + + // Read program architecture bits from class field + + int bits = f->get_8() * 32; + + if (bits == 32 && p_embedded_size >= 0x100000000) { + f->close(); + ERR_FAIL_V_MSG(ERR_INVALID_DATA, "32-bit executables cannot have embedded data >= 4 GiB."); + } + + // Get info about the section header table + + int64_t section_table_pos; + int64_t section_header_size; + if (bits == 32) { + section_header_size = 40; + f->seek(0x20); + section_table_pos = f->get_32(); + f->seek(0x30); + } else { // 64 + section_header_size = 64; + f->seek(0x28); + section_table_pos = f->get_64(); + f->seek(0x3c); + } + int num_sections = f->get_16(); + int string_section_idx = f->get_16(); + + // Load the strings table + uint8_t *strings; + { + // Jump to the strings section header + f->seek(section_table_pos + string_section_idx * section_header_size); + + // Read strings data size and offset + int64_t string_data_pos; + int64_t string_data_size; + if (bits == 32) { + f->seek(f->get_position() + 0x10); + string_data_pos = f->get_32(); + string_data_size = f->get_32(); + } else { // 64 + f->seek(f->get_position() + 0x18); + string_data_pos = f->get_64(); + string_data_size = f->get_64(); + } + + // Read strings data + f->seek(string_data_pos); + strings = (uint8_t *)memalloc(string_data_size); + if (!strings) { + f->close(); + return ERR_OUT_OF_MEMORY; + } + f->get_buffer(strings, string_data_size); + } + + // Search for the "pck" section + + bool found = false; + for (int i = 0; i < num_sections; ++i) { + int64_t section_header_pos = section_table_pos + i * section_header_size; + f->seek(section_header_pos); + + uint32_t name_offset = f->get_32(); + if (strcmp((char *)strings + name_offset, "pck") == 0) { + // "pck" section found, let's patch! + + if (bits == 32) { + f->seek(section_header_pos + 0x10); + f->store_32(p_embedded_start); + f->store_32(p_embedded_size); + } else { // 64 + f->seek(section_header_pos + 0x18); + f->store_64(p_embedded_start); + f->store_64(p_embedded_size); + } + + found = true; + break; + } + } + + memfree(strings); + f->close(); + + return found ? OK : ERR_FILE_CORRUPT; +} diff --git a/platform/linuxbsd/export/export_plugin.h b/platform/linuxbsd/export/export_plugin.h new file mode 100644 index 0000000000..593916e586 --- /dev/null +++ b/platform/linuxbsd/export/export_plugin.h @@ -0,0 +1,51 @@ +/*************************************************************************/ +/* export_plugin.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 LINUXBSD_EXPORT_PLUGIN_H +#define LINUXBSD_EXPORT_PLUGIN_H + +#include "core/io/file_access.h" +#include "editor/editor_export.h" +#include "editor/editor_settings.h" +#include "platform/linuxbsd/logo.gen.h" +#include "scene/resources/texture.h" + +class EditorExportPlatformLinuxBSD : public EditorExportPlatformPC { + Map<String, String> extensions; + Error _export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path); + +public: + void set_extension(const String &p_extension, const String &p_feature_key = "default"); + virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override; + virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override; + virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) const override; +}; + +#endif diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp index 890e66ffd5..4f06342fac 100644 --- a/platform/osx/export/export_plugin.cpp +++ b/platform/osx/export/export_plugin.cpp @@ -72,6 +72,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "debug/export_console_script", PROPERTY_HINT_ENUM, "No,Debug Only,Debug and Release"), 1)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "")); @@ -681,6 +682,19 @@ Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const Strin return OK; } +Error EditorExportPlatformOSX::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) { + FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_V(!f, ERR_CANT_CREATE); + + f->store_line("#!/bin/sh"); + f->store_line("echo -ne '\\033c\\033]0;" + p_app_name + "\\a'"); + f->store_line("function realpath() { python -c \"import os,sys; print(os.path.realpath(sys.argv[1]))\" \"$0\"; }"); + f->store_line("base_path=\"$(dirname \"$(realpath \"$0\")\")\""); + f->store_line("\"$base_path/" + p_pkg_name + "\" \"$@\""); + + return OK; +} + Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); @@ -747,22 +761,30 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p // Create our application bundle. String tmp_app_dir_name = pkg_name + ".app"; + String tmp_base_path_name; String tmp_app_path_name; + String scr_path; if (export_format == "app") { + tmp_base_path_name = p_path.get_base_dir(); tmp_app_path_name = p_path; + scr_path = p_path.get_basename() + ".command"; } else { - tmp_app_path_name = EditorPaths::get_singleton()->get_cache_dir().plus_file(tmp_app_dir_name); + tmp_base_path_name = EditorPaths::get_singleton()->get_cache_dir().plus_file(pkg_name); + tmp_app_path_name = tmp_base_path_name.plus_file(tmp_app_dir_name); + scr_path = tmp_base_path_name.plus_file(pkg_name + ".command"); } + print_verbose("Exporting to " + tmp_app_path_name); Error err = OK; - DirAccessRef tmp_app_dir = DirAccess::create_for_path(tmp_app_path_name); + DirAccessRef tmp_app_dir = DirAccess::create_for_path(tmp_base_path_name); if (!tmp_app_dir) { err = ERR_CANT_CREATE; } - if (DirAccess::exists(tmp_app_dir_name)) { + DirAccess::remove_file_or_error(scr_path); + if (DirAccess::exists(tmp_app_path_name)) { if (tmp_app_dir->change_dir(tmp_app_path_name) == OK) { tmp_app_dir->erase_contents_recursive(); } @@ -1043,6 +1065,15 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p err = ERR_FILE_NOT_FOUND; } + // Save console script. + if (err == OK) { + int con_scr = p_preset->get("debug/export_console_script"); + if ((con_scr == 1 && p_debug) || (con_scr == 2)) { + err = _export_debug_script(p_preset, pkg_name, tmp_app_path_name.get_file() + "/Contents/MacOS/" + pkg_name, scr_path); + FileAccess::set_unix_permissions(scr_path, 0755); + } + } + if (err == OK) { if (ep.step(TTR("Making PKG"), 1)) { return ERR_SKIP; @@ -1284,7 +1315,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p if (ep.step(TTR("Making DMG"), 3)) { return ERR_SKIP; } - err = _create_dmg(p_path, pkg_name, tmp_app_path_name); + err = _create_dmg(p_path, pkg_name, tmp_base_path_name); } // Sign DMG. if (err == OK && sign_enabled && !ad_hoc) { @@ -1307,7 +1338,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p zlib_filefunc_def io_dst = zipio_create_io_from_file(&dst_f); zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io_dst); - _zip_folder_recursive(zip, EditorPaths::get_singleton()->get_cache_dir(), pkg_name + ".app", pkg_name); + _zip_folder_recursive(zip, tmp_base_path_name, "", pkg_name); zipClose(zip, nullptr); } @@ -1335,10 +1366,10 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p tmp_app_dir->remove(ent_path); } if (export_format != "app") { - if (tmp_app_dir->change_dir(tmp_app_path_name) == OK) { + if (tmp_app_dir->change_dir(tmp_base_path_name) == OK) { tmp_app_dir->erase_contents_recursive(); tmp_app_dir->change_dir(".."); - tmp_app_dir->remove(tmp_app_dir_name); + tmp_app_dir->remove(pkg_name); } } } @@ -1347,7 +1378,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String &p_root_path, const String &p_folder, const String &p_pkg_name) { - String dir = p_root_path.plus_file(p_folder); + String dir = p_folder.is_empty() ? p_root_path : p_root_path.plus_file(p_folder); DirAccessRef da = DirAccess::open(dir); da->list_dir_begin(); @@ -1401,7 +1432,7 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String } else if (da->current_is_dir()) { _zip_folder_recursive(p_zip, p_root_path, p_folder.plus_file(f), p_pkg_name); } else { - bool is_executable = (p_folder.ends_with("MacOS") && (f == p_pkg_name)) || p_folder.ends_with("Helpers"); + bool is_executable = (p_folder.ends_with("MacOS") && (f == p_pkg_name)) || p_folder.ends_with("Helpers") || f.ends_with(".command"); OS::Time time = OS::get_singleton()->get_time(); OS::Date date = OS::get_singleton()->get_date(); diff --git a/platform/osx/export/export_plugin.h b/platform/osx/export/export_plugin.h index 20cdd33f86..b3edfb7f90 100644 --- a/platform/osx/export/export_plugin.h +++ b/platform/osx/export/export_plugin.h @@ -66,6 +66,7 @@ class EditorExportPlatformOSX : public EditorExportPlatform { const String &p_ent_path); Error _create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name); void _zip_folder_recursive(zipFile &p_zip, const String &p_root_path, const String &p_folder, const String &p_pkg_name); + Error _export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path); bool use_codesign() const { return true; } #ifdef OSX_ENABLED diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index d09ca52099..d243d4c05d 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2120,7 +2120,6 @@ LRESULT DisplayServerWindows::MouseProc(int code, WPARAM wParam, LPARAM lParam) case WM_NCRBUTTONDOWN: case WM_NCMBUTTONDOWN: case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: { MOUSEHOOKSTRUCT *ms = (MOUSEHOOKSTRUCT *)lParam; Point2i pos = Point2i(ms->pt.x, ms->pt.y); diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 17a24c08bf..37fdf93ecf 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -32,8 +32,6 @@ #include "export_plugin.h" -static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size); - void register_windows_exporter() { EDITOR_DEF("export/windows/rcedit", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe")); @@ -57,84 +55,11 @@ void register_windows_exporter() { logo->create_from_image(img); platform->set_logo(logo); platform->set_name("Windows Desktop"); - platform->set_extension("exe"); platform->set_release_32("windows_32_release.exe"); platform->set_debug_32("windows_32_debug.exe"); platform->set_release_64("windows_64_release.exe"); platform->set_debug_64("windows_64_debug.exe"); platform->set_os_name("Windows"); - platform->set_fixup_embedded_pck_func(&fixup_embedded_pck); EditorExport::get_singleton()->add_export_platform(platform); } - -static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) { - // Patch the header of the "pck" section in the PE file so that it corresponds to the embedded data - - FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE); - if (!f) { - return ERR_CANT_OPEN; - } - - // Jump to the PE header and check the magic number - { - f->seek(0x3c); - uint32_t pe_pos = f->get_32(); - - f->seek(pe_pos); - uint32_t magic = f->get_32(); - if (magic != 0x00004550) { - f->close(); - return ERR_FILE_CORRUPT; - } - } - - // Process header - - int num_sections; - { - int64_t header_pos = f->get_position(); - - f->seek(header_pos + 2); - num_sections = f->get_16(); - f->seek(header_pos + 16); - uint16_t opt_header_size = f->get_16(); - - // Skip rest of header + optional header to go to the section headers - f->seek(f->get_position() + 2 + opt_header_size); - } - - // Search for the "pck" section - - int64_t section_table_pos = f->get_position(); - - bool found = false; - for (int i = 0; i < num_sections; ++i) { - int64_t section_header_pos = section_table_pos + i * 40; - f->seek(section_header_pos); - - uint8_t section_name[9]; - f->get_buffer(section_name, 8); - section_name[8] = '\0'; - - if (strcmp((char *)section_name, "pck") == 0) { - // "pck" section found, let's patch! - - // Set virtual size to a little to avoid it taking memory (zero would give issues) - f->seek(section_header_pos + 8); - f->store_32(8); - - f->seek(section_header_pos + 16); - f->store_32(p_embedded_size); - f->seek(section_header_pos + 20); - f->store_32(p_embedded_start); - - found = true; - break; - } - } - - f->close(); - - return found ? OK : ERR_FILE_CORRUPT; -} diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 5ebc930735..f20cff90c1 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -41,6 +41,18 @@ Error EditorExportPlatformWindows::sign_shared_object(const Ref<EditorExportPres } } +Error EditorExportPlatformWindows::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) { + FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_V(!f, ERR_CANT_CREATE); + + f->store_line("@echo off"); + f->store_line("title \"" + p_app_name + "\""); + f->store_line("\"%~dp0" + p_pkg_name + "\" \"%*\""); + f->store_line("pause > nul"); + + return OK; +} + Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, p_path, p_flags); @@ -54,9 +66,32 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> err = _code_sign(p_preset, p_path); } + String app_name; + if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") { + app_name = String(ProjectSettings::get_singleton()->get("application/config/name")); + } else { + app_name = "Unnamed"; + } + app_name = OS::get_singleton()->get_safe_dir_name(app_name); + + // Save console script. + if (err == OK) { + int con_scr = p_preset->get("debug/export_console_script"); + if ((con_scr == 1 && p_debug) || (con_scr == 2)) { + String scr_path = p_path.get_basename() + ".cmd"; + err = _export_debug_script(p_preset, app_name, p_path.get_file(), scr_path); + } + } + return err; } +List<String> EditorExportPlatformWindows::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { + List<String> list; + list.push_back("exe"); + return list; +} + bool EditorExportPlatformWindows::get_export_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { // This option is not supported by "osslsigncode", used on non-Windows host. if (!OS::get_singleton()->has_feature("windows") && p_option == "codesign/identity_type") { @@ -374,3 +409,74 @@ bool EditorExportPlatformWindows::can_export(const Ref<EditorExportPreset> &p_pr return valid; } + +Error EditorExportPlatformWindows::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) const { + // Patch the header of the "pck" section in the PE file so that it corresponds to the embedded data + + FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE); + if (!f) { + return ERR_CANT_OPEN; + } + + // Jump to the PE header and check the magic number + { + f->seek(0x3c); + uint32_t pe_pos = f->get_32(); + + f->seek(pe_pos); + uint32_t magic = f->get_32(); + if (magic != 0x00004550) { + f->close(); + return ERR_FILE_CORRUPT; + } + } + + // Process header + + int num_sections; + { + int64_t header_pos = f->get_position(); + + f->seek(header_pos + 2); + num_sections = f->get_16(); + f->seek(header_pos + 16); + uint16_t opt_header_size = f->get_16(); + + // Skip rest of header + optional header to go to the section headers + f->seek(f->get_position() + 2 + opt_header_size); + } + + // Search for the "pck" section + + int64_t section_table_pos = f->get_position(); + + bool found = false; + for (int i = 0; i < num_sections; ++i) { + int64_t section_header_pos = section_table_pos + i * 40; + f->seek(section_header_pos); + + uint8_t section_name[9]; + f->get_buffer(section_name, 8); + section_name[8] = '\0'; + + if (strcmp((char *)section_name, "pck") == 0) { + // "pck" section found, let's patch! + + // Set virtual size to a little to avoid it taking memory (zero would give issues) + f->seek(section_header_pos + 8); + f->store_32(8); + + f->seek(section_header_pos + 16); + f->store_32(p_embedded_size); + f->seek(section_header_pos + 20); + f->store_32(p_embedded_start); + + found = true; + break; + } + } + + f->close(); + + return found ? OK : ERR_FILE_CORRUPT; +} diff --git a/platform/windows/export/export_plugin.h b/platform/windows/export/export_plugin.h index 86e9d49b05..04707a5667 100644 --- a/platform/windows/export/export_plugin.h +++ b/platform/windows/export/export_plugin.h @@ -40,13 +40,16 @@ class EditorExportPlatformWindows : public EditorExportPlatformPC { void _rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path); Error _code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path); + Error _export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path); public: virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override; virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) override; + virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override; virtual void get_export_options(List<ExportOption> *r_options) override; virtual bool get_export_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const override; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override; + virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) const override; }; #endif diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 419901d5ea..cd6fc168c2 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -115,7 +115,7 @@ void Label::_shape() { if (lines_dirty) { for (int i = 0; i < lines_rid.size(); i++) { - TS->free(lines_rid[i]); + TS->free_rid(lines_rid[i]); } lines_rid.clear(); @@ -960,8 +960,8 @@ Label::Label(const String &p_text) { Label::~Label() { for (int i = 0; i < lines_rid.size(); i++) { - TS->free(lines_rid[i]); + TS->free_rid(lines_rid[i]); } lines_rid.clear(); - TS->free(text_rid); + TS->free_rid(text_rid); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index da39a3d387..e063d3aeba 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2458,5 +2458,5 @@ LineEdit::LineEdit(const String &p_placeholder) { } LineEdit::~LineEdit() { - TS->free(text_rid); + TS->free_rid(text_rid); } diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 37d75cea6a..1e8a149e11 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -385,6 +385,12 @@ void OptionButton::get_translatable_strings(List<String> *p_strings) const { popup->get_translatable_strings(p_strings); } +void OptionButton::_validate_property(PropertyInfo &property) const { + if (property.name == "text" || property.name == "icon") { + property.usage = PROPERTY_USAGE_NONE; + } +} + void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item, DEFVAL(-1)); diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h index 0a3c8cdb17..732730e0f4 100644 --- a/scene/gui/option_button.h +++ b/scene/gui/option_button.h @@ -53,6 +53,7 @@ protected: 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; + virtual void _validate_property(PropertyInfo &property) const override; static void _bind_methods(); public: diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp index 20b3513375..50ffb3ca67 100644 --- a/scene/gui/progress_bar.cpp +++ b/scene/gui/progress_bar.cpp @@ -100,7 +100,7 @@ bool ProgressBar::is_percent_visible() const { void ProgressBar::_bind_methods() { ClassDB::bind_method(D_METHOD("set_percent_visible", "visible"), &ProgressBar::set_percent_visible); ClassDB::bind_method(D_METHOD("is_percent_visible"), &ProgressBar::is_percent_visible); - ADD_GROUP("Percent", "percent_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "percent_visible"), "set_percent_visible", "is_percent_visible"); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 0a36176c98..d585fb3a7a 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -699,7 +699,6 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o Item *it_from = l.from; Item *it_to = (p_line + 1 < p_frame->lines.size()) ? p_frame->lines[p_line + 1].from : nullptr; - Variant meta; if (it_from == nullptr) { return 0; @@ -1070,23 +1069,60 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o } } + Vector2 ul_start; + bool ul_started = false; + Color ul_color; + + Vector2 dot_ul_start; + bool dot_ul_started = false; + Color dot_ul_color; + + Vector2 st_start; + bool st_started = false; + Color st_color; + for (int i = 0; i < gl_size; i++) { bool selected = selection.active && (sel_start != -1) && (glyphs[i].start >= sel_start) && (glyphs[i].end <= sel_end); Item *it = _get_item_at_pos(it_from, it_to, glyphs[i].start); Color font_color = _find_color(it, p_base_color); - if (_find_underline(it) || (_find_meta(it, &meta) && underline_meta)) { - Color uc = font_color; - uc.a *= 0.5; + if (_find_underline(it) || (_find_meta(it, nullptr) && underline_meta)) { + if (!ul_started) { + ul_started = true; + ul_start = p_ofs + Vector2(off.x, off.y); + ul_color = font_color; + ul_color.a *= 0.5; + } + } else if (ul_started) { + ul_started = false; float y_off = TS->shaped_text_get_underline_position(rid); float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); - draw_line(p_ofs + Vector2(off.x, off.y + y_off), p_ofs + Vector2(off.x + glyphs[i].advance * glyphs[i].repeat, off.y + y_off), uc, underline_width); + draw_line(ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), ul_color, underline_width); + } + if (_find_hint(it, nullptr) && underline_hint) { + if (!dot_ul_started) { + dot_ul_started = true; + dot_ul_start = p_ofs + Vector2(off.x, off.y); + dot_ul_color = font_color; + dot_ul_color.a *= 0.5; + } + } else if (dot_ul_started) { + dot_ul_started = false; + float y_off = TS->shaped_text_get_underline_position(rid); + float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); + draw_dashed_line(dot_ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), dot_ul_color, underline_width, underline_width * 2); } if (_find_strikethrough(it)) { - Color uc = font_color; - uc.a *= 0.5; + if (!st_started) { + st_started = true; + st_start = p_ofs + Vector2(off.x, off.y); + st_color = font_color; + st_color.a *= 0.5; + } + } else if (st_started) { + st_started = false; float y_off = -TS->shaped_text_get_ascent(rid) + TS->shaped_text_get_size(rid).y / 2; float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); - draw_line(p_ofs + Vector2(off.x, off.y + y_off), p_ofs + Vector2(off.x + glyphs[i].advance * glyphs[i].repeat, off.y + y_off), uc, underline_width); + draw_line(st_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), st_color, underline_width); } // Get FX. @@ -1222,6 +1258,24 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o off.x += glyphs[i].advance; } } + if (ul_started) { + ul_started = false; + float y_off = TS->shaped_text_get_underline_position(rid); + float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); + draw_line(ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), ul_color, underline_width); + } + if (dot_ul_started) { + dot_ul_started = false; + float y_off = TS->shaped_text_get_underline_position(rid); + float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); + draw_dashed_line(dot_ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), dot_ul_color, underline_width, underline_width * 2); + } + if (st_started) { + st_started = false; + float y_off = -TS->shaped_text_get_ascent(rid) + TS->shaped_text_get_size(rid).y / 2; + float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); + draw_line(st_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), st_color, underline_width); + } // Draw foreground color box _draw_fbg_boxes(ci, rid, fbg_line_off, it_from, it_to, chr_range.x, chr_range.y, 1); @@ -1907,6 +1961,20 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) { } } +String RichTextLabel::get_tooltip(const Point2 &p_pos) const { + Item *c_item = nullptr; + bool outside; + + const_cast<RichTextLabel *>(this)->_find_click(main, p_pos, nullptr, nullptr, &c_item, nullptr, &outside); + + String description; + if (c_item && !outside && const_cast<RichTextLabel *>(this)->_find_hint(c_item, &description)) { + return description; + } else { + return Control::get_tooltip(p_pos); + } +} + void RichTextLabel::_find_frame(Item *p_item, ItemFrame **r_frame, int *r_line) { if (r_frame != nullptr) { *r_frame = nullptr; @@ -2244,6 +2312,24 @@ bool RichTextLabel::_find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item) return false; } +bool RichTextLabel::_find_hint(Item *p_item, String *r_description) { + Item *item = p_item; + + while (item) { + if (item->type == ITEM_HINT) { + ItemHint *hint = static_cast<ItemHint *>(item); + if (r_description) { + *r_description = hint->description; + } + return true; + } + + item = item->parent; + } + + return false; +} + Color RichTextLabel::_find_bgcolor(Item *p_item) { Item *item = p_item; @@ -2736,6 +2822,14 @@ void RichTextLabel::push_meta(const Variant &p_meta) { _add_item(item, true); } +void RichTextLabel::push_hint(const String &p_string) { + ERR_FAIL_COND(current->type == ITEM_TABLE); + ItemHint *item = memnew(ItemHint); + + item->description = p_string; + _add_item(item, true); +} + void RichTextLabel::push_table(int p_columns, InlineAlignment p_alignment) { ERR_FAIL_COND(p_columns < 1); ItemTable *item = memnew(ItemTable); @@ -2930,6 +3024,15 @@ bool RichTextLabel::is_meta_underlined() const { return underline_meta; } +void RichTextLabel::set_hint_underline(bool p_underline) { + underline_hint = p_underline; + update(); +} + +bool RichTextLabel::is_hint_underlined() const { + return underline_hint; +} + void RichTextLabel::set_override_selected_font_color(bool p_override_selected_font_color) { override_selected_font_color = p_override_selected_font_color; } @@ -3367,6 +3470,11 @@ void RichTextLabel::append_text(const String &p_bbcode) { push_meta(url); pos = brk_end + 1; tag_stack.push_front("url"); + } else if (tag.begins_with("hint=")) { + String description = tag.substr(5, tag.length()); + push_hint(description); + pos = brk_end + 1; + tag_stack.push_front("hint"); } else if (tag.begins_with("dropcap")) { Vector<String> subtag = tag.substr(5, tag.length()).split(" "); Ref<Font> f = get_theme_font(SNAME("normal_font")); @@ -4287,6 +4395,7 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent); ClassDB::bind_method(D_METHOD("push_list", "level", "type", "capitalize"), &RichTextLabel::push_list); ClassDB::bind_method(D_METHOD("push_meta", "data"), &RichTextLabel::push_meta); + ClassDB::bind_method(D_METHOD("push_hint", "description"), &RichTextLabel::push_hint); ClassDB::bind_method(D_METHOD("push_underline"), &RichTextLabel::push_underline); ClassDB::bind_method(D_METHOD("push_strikethrough"), &RichTextLabel::push_strikethrough); ClassDB::bind_method(D_METHOD("push_table", "columns", "inline_align"), &RichTextLabel::push_table, DEFVAL(INLINE_ALIGNMENT_TOP)); @@ -4318,6 +4427,9 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_meta_underline", "enable"), &RichTextLabel::set_meta_underline); ClassDB::bind_method(D_METHOD("is_meta_underlined"), &RichTextLabel::is_meta_underlined); + ClassDB::bind_method(D_METHOD("set_hint_underline", "enable"), &RichTextLabel::set_hint_underline); + ClassDB::bind_method(D_METHOD("is_hint_underlined"), &RichTextLabel::is_hint_underlined); + ClassDB::bind_method(D_METHOD("set_override_selected_font_color", "override"), &RichTextLabel::set_override_selected_font_color); ClassDB::bind_method(D_METHOD("is_overriding_selected_font_color"), &RichTextLabel::is_overriding_selected_font_color); @@ -4401,6 +4513,7 @@ void RichTextLabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "custom_effects", PROPERTY_HINT_ARRAY_TYPE, vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "RichTextEffect"), (PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE)), "set_effects", "get_effects"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_underlined"), "set_meta_underline", "is_meta_underlined"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hint_underlined"), "set_hint_underline", "is_hint_underlined"); ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode"); // Note: "visible_characters" and "percent_visible" should be set after "text" to be correctly applied. @@ -4454,6 +4567,7 @@ void RichTextLabel::_bind_methods() { BIND_ENUM_CONSTANT(ITEM_BGCOLOR); BIND_ENUM_CONSTANT(ITEM_FGCOLOR); BIND_ENUM_CONSTANT(ITEM_META); + BIND_ENUM_CONSTANT(ITEM_HINT); BIND_ENUM_CONSTANT(ITEM_DROPCAP); BIND_ENUM_CONSTANT(ITEM_CUSTOMFX); diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 076b68a0da..c9cbbe9d15 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -78,6 +78,7 @@ public: ITEM_BGCOLOR, ITEM_FGCOLOR, ITEM_META, + ITEM_HINT, ITEM_DROPCAP, ITEM_CUSTOMFX }; @@ -218,6 +219,11 @@ private: ItemMeta() { type = ITEM_META; } }; + struct ItemHint : public Item { + String description; + ItemHint() { type = ITEM_HINT; } + }; + struct ItemParagraph : public Item { HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT; String language; @@ -369,6 +375,7 @@ private: int tab_size = 4; bool underline_meta = true; + bool underline_hint = true; bool override_selected_font_color = false; HorizontalAlignment default_alignment = HORIZONTAL_ALIGNMENT_LEFT; @@ -452,6 +459,7 @@ private: bool _find_underline(Item *p_item); bool _find_strikethrough(Item *p_item); bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = nullptr); + bool _find_hint(Item *p_item, String *r_description); Color _find_bgcolor(Item *p_item); Color _find_fgcolor(Item *p_item); bool _find_layout_subitem(Item *from, Item *to); @@ -462,6 +470,7 @@ private: void _scroll_changed(double); virtual void gui_input(const Ref<InputEvent> &p_event) override; + virtual String get_tooltip(const Point2 &p_pos) const override; Item *_get_next_item(Item *p_item, bool p_free = false) const; Item *_get_prev_item(Item *p_item, bool p_free = false) const; @@ -505,6 +514,7 @@ public: void push_indent(int p_level); void push_list(int p_level, ListType p_list, bool p_capitalize); void push_meta(const Variant &p_meta); + void push_hint(const String &p_string); void push_table(int p_columns, InlineAlignment p_alignment = INLINE_ALIGNMENT_TOP); void push_fade(int p_start_index, int p_length); void push_shake(int p_strength, float p_rate); @@ -530,6 +540,9 @@ public: void set_meta_underline(bool p_underline); bool is_meta_underlined() const; + void set_hint_underline(bool p_underline); + bool is_hint_underlined() const; + void set_override_selected_font_color(bool p_override_selected_font_color); bool is_overriding_selected_font_color() const; diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index af314b9545..8128bbd11d 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -1530,7 +1530,7 @@ void TabBar::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "max_tab_width", PROPERTY_HINT_RANGE, "0,99999,1"), "set_max_tab_width", "get_max_tab_width"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scrolling_enabled"), "set_scrolling_enabled", "get_scrolling_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_rearrange_group"), "set_tabs_rearrange_group", "get_tabs_rearrange_group"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "tabs_rearrange_group"), "set_tabs_rearrange_group", "get_tabs_rearrange_group"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_to_selected"), "set_scroll_to_selected", "get_scroll_to_selected"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "select_with_rmb"), "set_select_with_rmb", "get_select_with_rmb"); diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index ec0821557b..15d36d8230 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -444,6 +444,25 @@ void CanvasItem::item_rect_changed(bool p_size_changed) { emit_signal(SceneStringNames::get_singleton()->item_rect_changed); } +void CanvasItem::draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width, real_t p_dash) { + ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); + + float length = (p_to - p_from).length(); + if (length < p_dash) { + RenderingServer::get_singleton()->canvas_item_add_line(canvas_item, p_from, p_to, p_color, p_width); + return; + } + + Point2 off = p_from; + Vector2 step = p_dash * (p_to - p_from).normalized(); + int steps = length / p_dash / 2; + for (int i = 0; i < steps; i++) { + RenderingServer::get_singleton()->canvas_item_add_line(canvas_item, off, (off + step), p_color, p_width); + off += 2 * step; + } + RenderingServer::get_singleton()->canvas_item_add_line(canvas_item, off, p_to, p_color, p_width); +} + void CanvasItem::draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); @@ -868,6 +887,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_is_on_top"), &CanvasItem::_is_on_top); ClassDB::bind_method(D_METHOD("draw_line", "from", "to", "color", "width"), &CanvasItem::draw_line, DEFVAL(1.0)); + ClassDB::bind_method(D_METHOD("draw_dashed_line", "from", "to", "color", "width", "dash"), &CanvasItem::draw_dashed_line, DEFVAL(1.0), DEFVAL(2.0)); ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_arc", "center", "radius", "start_angle", "end_angle", "point_count", "color", "width", "antialiased"), &CanvasItem::draw_arc, DEFVAL(1.0), DEFVAL(false)); @@ -958,6 +978,7 @@ void CanvasItem::_bind_methods() { ADD_SIGNAL(MethodInfo("item_rect_changed")); BIND_CONSTANT(NOTIFICATION_TRANSFORM_CHANGED); + BIND_CONSTANT(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); BIND_CONSTANT(NOTIFICATION_DRAW); BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED); BIND_CONSTANT(NOTIFICATION_ENTER_CANVAS); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 1b2c188fc0..dbc833aa5b 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -217,6 +217,7 @@ public: /* DRAWING API */ + void draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = 1.0, real_t p_dash = 2.0); void draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = 1.0); void draw_polyline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = 1.0, bool p_antialiased = false); void draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = 1.0, bool p_antialiased = false); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index ce2a675854..15594109e9 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -40,7 +40,7 @@ _FORCE_INLINE_ void FontData::_clear_cache() { for (int i = 0; i < cache.size(); i++) { if (cache[i].is_valid()) { - TS->free(cache[i]); + TS->free_rid(cache[i]); cache.write[i] = RID(); } } @@ -1499,7 +1499,7 @@ void FontData::clear_cache() { void FontData::remove_cache(int p_cache_index) { ERR_FAIL_INDEX(p_cache_index, cache.size()); if (cache[p_cache_index].is_valid()) { - TS->free(cache.write[p_cache_index]); + TS->free_rid(cache.write[p_cache_index]); } cache.remove_at(p_cache_index); emit_changed(); @@ -1924,6 +1924,8 @@ void Font::_bind_methods() { ClassDB::bind_method(D_METHOD("get_supported_chars"), &Font::get_supported_chars); ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes); + + ClassDB::bind_method(D_METHOD("get_rids"), &Font::get_rids); } bool Font::_set(const StringName &p_name, const Variant &p_value) { @@ -2427,11 +2429,15 @@ String Font::get_supported_chars() const { return chars; } -Vector<RID> Font::get_rids() const { +Array Font::get_rids() const { + Array _rids; for (int i = 0; i < data.size(); i++) { _ensure_rid(i); + if (rids[i].is_valid()) { + _rids.push_back(rids[i]); + } } - return rids; + return _rids; } void Font::update_changes() { diff --git a/scene/resources/font.h b/scene/resources/font.h index 0185b019f1..2aa12dd2de 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -311,7 +311,7 @@ public: virtual Size2 get_char_size(char32_t p_char, char32_t p_next = 0, int p_size = DEFAULT_FONT_SIZE) const; virtual real_t draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char, char32_t p_next = 0, int p_size = DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0)) const; - Vector<RID> get_rids() const; + Array get_rids() const; void update_changes(); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index a0e6cc28ce..430626b008 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -809,26 +809,26 @@ void BaseMaterial3D::_update_shader() { case BILLBOARD_DISABLED: { } break; case BILLBOARD_ENABLED: { - code += " MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],CAMERA_MATRIX[1],CAMERA_MATRIX[2],WORLD_MATRIX[3]);\n"; + code += " MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);\n"; if (flags[FLAG_BILLBOARD_KEEP_SCALE]) { - code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(WORLD_MATRIX[1].xyz), 0.0, 0.0),vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0),vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; } } break; case BILLBOARD_FIXED_Y: { - code += " MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(vec4(normalize(cross(vec3(0.0, 1.0, 0.0), CAMERA_MATRIX[2].xyz)),0.0),vec4(0.0, 1.0, 0.0, 0.0),vec4(normalize(cross(CAMERA_MATRIX[0].xyz, vec3(0.0, 1.0, 0.0))),0.0),WORLD_MATRIX[3]);\n"; + code += " MODELVIEW_MATRIX = VIEW_MATRIX * mat4(vec4(normalize(cross(vec3(0.0, 1.0, 0.0), INV_VIEW_MATRIX[2].xyz)), 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(normalize(cross(INV_VIEW_MATRIX[0].xyz, vec3(0.0, 1.0, 0.0))), 0.0), MODEL_MATRIX[3]);\n"; if (flags[FLAG_BILLBOARD_KEEP_SCALE]) { - code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(WORLD_MATRIX[1].xyz), 0.0, 0.0),vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0),vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; } } break; case BILLBOARD_PARTICLES: { //make billboard - code += " mat4 mat_world = mat4(normalize(CAMERA_MATRIX[0])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[1])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[2])*length(WORLD_MATRIX[2]),WORLD_MATRIX[3]);\n"; + code += " mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]),normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; //rotate by rotation - code += " mat_world = mat_world * mat4( vec4(cos(INSTANCE_CUSTOM.x),-sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0),vec4(0.0, 0.0, 1.0, 0.0),vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " mat_world = mat_world * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; //set modelview - code += " MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat_world;\n"; + code += " MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;\n"; //handle animation code += " float h_frames = float(particles_anim_h_frames);\n"; @@ -883,8 +883,8 @@ void BaseMaterial3D::_update_shader() { if (flags[FLAG_UV1_USE_TRIPLANAR]) { if (flags[FLAG_UV1_USE_WORLD_TRIPLANAR]) { - code += " uv1_power_normal=pow(abs(mat3(WORLD_MATRIX) * NORMAL),vec3(uv1_blend_sharpness));\n"; - code += " uv1_triplanar_pos = (WORLD_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv1_scale + uv1_offset;\n"; + code += " uv1_power_normal=pow(abs(mat3(MODEL_MATRIX) * NORMAL),vec3(uv1_blend_sharpness));\n"; + code += " uv1_triplanar_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv1_scale + uv1_offset;\n"; } else { code += " uv1_power_normal=pow(abs(NORMAL),vec3(uv1_blend_sharpness));\n"; code += " uv1_triplanar_pos = VERTEX * uv1_scale + uv1_offset;\n"; @@ -895,8 +895,8 @@ void BaseMaterial3D::_update_shader() { if (flags[FLAG_UV2_USE_TRIPLANAR]) { if (flags[FLAG_UV2_USE_WORLD_TRIPLANAR]) { - code += " uv2_power_normal=pow(abs(mat3(WORLD_MATRIX) * NORMAL), vec3(uv2_blend_sharpness));\n"; - code += " uv2_triplanar_pos = (WORLD_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv2_scale + uv2_offset;\n"; + code += " uv2_power_normal=pow(abs(mat3(MODEL_MATRIX) * NORMAL), vec3(uv2_blend_sharpness));\n"; + code += " uv2_triplanar_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv2_scale + uv2_offset;\n"; } else { code += " uv2_power_normal=pow(abs(NORMAL), vec3(uv2_blend_sharpness));\n"; code += " uv2_triplanar_pos = VERTEX * uv2_scale + uv2_offset;\n"; @@ -1140,7 +1140,7 @@ void BaseMaterial3D::_update_shader() { if (!RenderingServer::get_singleton()->is_low_end()) { code += " {\n"; if (distance_fade == DISTANCE_FADE_OBJECT_DITHER) { - code += " float fade_distance = abs((INV_CAMERA_MATRIX * WORLD_MATRIX[3]).z);\n"; + code += " float fade_distance = abs((VIEW_MATRIX * MODEL_MATRIX[3]).z);\n"; } else { code += " float fade_distance=-VERTEX.z;\n"; diff --git a/scene/resources/text_line.cpp b/scene/resources/text_line.cpp index c3b5bd3564..db5f1338db 100644 --- a/scene/resources/text_line.cpp +++ b/scene/resources/text_line.cpp @@ -411,5 +411,5 @@ TextLine::TextLine() { } TextLine::~TextLine() { - TS->free(rid); + TS->free_rid(rid); } diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp index 4d75874199..d74d7c88c6 100644 --- a/scene/resources/text_paragraph.cpp +++ b/scene/resources/text_paragraph.cpp @@ -140,7 +140,7 @@ void TextParagraph::_bind_methods() { void TextParagraph::_shape_lines() { if (lines_dirty) { for (int i = 0; i < lines_rid.size(); i++) { - TS->free(lines_rid[i]); + TS->free_rid(lines_rid[i]); } lines_rid.clear(); @@ -168,7 +168,7 @@ void TextParagraph::_shape_lines() { RID line = TS->shaped_text_substr(rid, line_breaks[i], line_breaks[i + 1] - line_breaks[i]); float h = (TS->shaped_text_get_orientation(line) == TextServer::ORIENTATION_HORIZONTAL) ? TS->shaped_text_get_size(line).y : TS->shaped_text_get_size(line).x; if (v_offset < h) { - TS->free(line); + TS->free_rid(line); break; } if (!tab_stops.is_empty()) { @@ -271,7 +271,7 @@ void TextParagraph::clear() { spacing_top = 0; spacing_bottom = 0; for (int i = 0; i < lines_rid.size(); i++) { - TS->free(lines_rid[i]); + TS->free_rid(lines_rid[i]); } lines_rid.clear(); TS->shaped_text_clear(rid); @@ -847,9 +847,9 @@ TextParagraph::TextParagraph() { TextParagraph::~TextParagraph() { for (int i = 0; i < lines_rid.size(); i++) { - TS->free(lines_rid[i]); + TS->free_rid(lines_rid[i]); } lines_rid.clear(); - TS->free(rid); - TS->free(dropcap_rid); + TS->free_rid(rid); + TS->free_rid(dropcap_rid); } diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index d3e61dbc84..997b523d2e 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -2576,10 +2576,10 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "instance_custom", "INSTANCE_CUSTOM.rgb" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "instance_custom_alpha", "INSTANCE_CUSTOM.a" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "roughness", "ROUGHNESS" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "world", "WORLD_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "modelview", "MODELVIEW_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "camera", "CAMERA_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_camera", "INV_CAMERA_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "model_matrix", "MODEL_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "modelview_matrix", "MODELVIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_view_matrix", "INV_VIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "view_matrix", "VIEW_MATRIX" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "projection", "PROJECTION_MATRIX" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_projection", "INV_PROJECTION_MATRIX" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, @@ -2602,11 +2602,11 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_2D, "point_coord", "POINT_COORD" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_2D, "screen_uv", "SCREEN_UV" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "world", "WORLD_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_camera", "INV_CAMERA_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "camera", "CAMERA_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "projection", "PROJECTION_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_projection", "INV_PROJECTION_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "model_matrix", "MODEL_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "view_matrix", "VIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_view_matrix", "INV_VIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "projection_matrix", "PROJECTION_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_projection_matrix", "INV_PROJECTION_MATRIX" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_2D, "viewport_size", "VIEWPORT_SIZE" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "output_is_srgb", "OUTPUT_IS_SRGB" }, @@ -2634,11 +2634,11 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "specular", "SPECULAR_LIGHT" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "roughness", "ROUGHNESS" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "metallic", "METALLIC" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "world", "WORLD_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_camera", "INV_CAMERA_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "camera", "CAMERA_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "projection", "PROJECTION_MATRIX" }, - { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_projection", "INV_PROJECTION_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "model_matrix", "MODEL_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "view_matrix", "VIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_view_matrix", "INV_VIEW_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "projection_matrix", "PROJECTION_MATRIX" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "inv_projection_matrix", "INV_PROJECTION_MATRIX" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR_2D, "viewport_size", "VIEWPORT_SIZE" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_BOOLEAN, "output_is_srgb", "OUTPUT_IS_SRGB" }, @@ -2652,9 +2652,9 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "point_size", "POINT_SIZE" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_2D, "texture_pixel_size", "TEXTURE_PIXEL_SIZE" }, - { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "world", "WORLD_MATRIX" }, - { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "canvas", "CANVAS_MATRIX" }, - { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "screen", "SCREEN_MATRIX" }, + { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "model_matrix", "MODEL_MATRIX" }, + { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "canvas_matrix", "CANVAS_MATRIX" }, + { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "screen_matrix", "SCREEN_MATRIX" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_BOOLEAN, "at_light_pass", "AT_LIGHT_PASS" }, { Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "instance_custom", "INSTANCE_CUSTOM.rgb" }, diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 7b4d7e66d4..c34aca32dc 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -6805,29 +6805,29 @@ String VisualShaderNodeBillboard::generate_code(Shader::Mode p_mode, VisualShade switch (billboard_type) { case BILLBOARD_TYPE_ENABLED: code += " {\n"; - code += " mat4 __mvm = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0], CAMERA_MATRIX[1], CAMERA_MATRIX[2], WORLD_MATRIX[3]);\n"; + code += " mat4 __mvm = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);\n"; if (keep_scale) { - code += " __mvm = __mvm * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(WORLD_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " __mvm = __mvm * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; } code += " " + p_output_vars[0] + " = __mvm;\n"; code += " }\n"; break; case BILLBOARD_TYPE_FIXED_Y: code += " {\n"; - code += " mat4 __mvm = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0], WORLD_MATRIX[1], vec4(normalize(cross(CAMERA_MATRIX[0].xyz, WORLD_MATRIX[1].xyz)), 0.0), WORLD_MATRIX[3]);\n"; + code += " mat4 __mvm = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], MODEL_MATRIX[1], vec4(normalize(cross(INV_VIEW_MATRIX[0].xyz, MODEL_MATRIX[1].xyz)), 0.0), MODEL_MATRIX[3]);\n"; if (keep_scale) { - code += " __mvm = __mvm * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " __mvm = __mvm * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; } else { - code += " __mvm = __mvm * mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0 / length(WORLD_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + code += " __mvm = __mvm * mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0 / length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; } code += " " + p_output_vars[0] + " = __mvm;\n"; code += " }\n"; break; case BILLBOARD_TYPE_PARTICLES: code += " {\n"; - code += " mat4 __wm = mat4(normalize(CAMERA_MATRIX[0]) * length(WORLD_MATRIX[0]), normalize(CAMERA_MATRIX[1]) * length(WORLD_MATRIX[0]), normalize(CAMERA_MATRIX[2]) * length(WORLD_MATRIX[2]), WORLD_MATRIX[3]);\n"; + code += " mat4 __wm = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; code += " __wm = __wm * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; - code += " " + p_output_vars[0] + " = INV_CAMERA_MATRIX * __wm;\n"; + code += " " + p_output_vars[0] + " = VIEW_MATRIX * __wm;\n"; code += " }\n"; break; default: diff --git a/servers/physics_2d/godot_space_2d.cpp b/servers/physics_2d/godot_space_2d.cpp index 04b8d3c741..99c0566fb1 100644 --- a/servers/physics_2d/godot_space_2d.cpp +++ b/servers/physics_2d/godot_space_2d.cpp @@ -158,7 +158,7 @@ bool GodotPhysicsDirectSpaceState2D::intersect_ray(const RayParameters &p_parame if (p_parameters.hit_from_inside) { // Hit shape at starting point. min_d = 0; - res_point = local_from; + res_point = begin; res_normal = Vector2(); res_shape = shape_idx; res_obj = col_obj; diff --git a/servers/physics_3d/godot_space_3d.cpp b/servers/physics_3d/godot_space_3d.cpp index e28b6da0d9..e8af2d7283 100644 --- a/servers/physics_3d/godot_space_3d.cpp +++ b/servers/physics_3d/godot_space_3d.cpp @@ -153,7 +153,7 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame if (p_parameters.hit_from_inside) { // Hit shape at starting point. min_d = 0; - res_point = local_from; + res_point = begin; res_normal = Vector3(); res_shape = shape_idx; res_obj = col_obj; diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index f73407ad34..9843492316 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -72,6 +72,7 @@ #include "rendering_server.h" #include "servers/extensions/physics_server_3d_extension.h" #include "servers/rendering/shader_types.h" +#include "text/text_server_dummy.h" #include "text/text_server_extension.h" #include "text_server.h" #include "xr/xr_interface.h" @@ -113,6 +114,7 @@ void preregister_server_types() { GDREGISTER_CLASS(TextServerManager); GDREGISTER_ABSTRACT_CLASS(TextServer); GDREGISTER_CLASS(TextServerExtension); + GDREGISTER_CLASS(TextServerDummy); GDREGISTER_NATIVE_STRUCT(Glyph, "int start = -1;int end = -1;uint8_t count = 0;uint8_t repeat = 1;uint16_t flags = 0;float x_off = 0.f;float y_off = 0.f;float advance = 0.f;RID font_rid;int font_size = 0;int32_t index = 0"); GDREGISTER_NATIVE_STRUCT(CaretInfo, "Rect2 leading_caret;Rect2 trailing_caret;TextServer::Direction leading_direction;TextServer::Direction trailing_direction"); diff --git a/servers/rendering/dummy/rasterizer_dummy.h b/servers/rendering/dummy/rasterizer_dummy.h index b3fbc18c46..219f468b2f 100644 --- a/servers/rendering/dummy/rasterizer_dummy.h +++ b/servers/rendering/dummy/rasterizer_dummy.h @@ -38,6 +38,7 @@ #include "servers/rendering/dummy/rasterizer_scene_dummy.h" #include "servers/rendering/dummy/rasterizer_storage_dummy.h" #include "servers/rendering/dummy/storage/canvas_texture_storage.h" +#include "servers/rendering/dummy/storage/decal_atlas_storage.h" #include "servers/rendering/dummy/storage/texture_storage.h" #include "servers/rendering/renderer_compositor.h" #include "servers/rendering_server.h" @@ -51,12 +52,14 @@ protected: RasterizerCanvasDummy canvas; RendererDummy::CanvasTextureStorage canvas_texture_storage; RendererDummy::TextureStorage texture_storage; + RendererDummy::DecalAtlasStorage decal_atlas_storage; RasterizerStorageDummy storage; RasterizerSceneDummy scene; public: RendererCanvasTextureStorage *get_canvas_texture_storage() override { return &canvas_texture_storage; }; RendererTextureStorage *get_texture_storage() override { return &texture_storage; }; + RendererDecalAtlasStorage *get_decal_atlas_storage() override { return &decal_atlas_storage; }; RendererStorage *get_storage() override { return &storage; } RendererCanvasRender *get_canvas() override { return &canvas; } RendererSceneRender *get_scene() override { return &scene; } diff --git a/servers/rendering/dummy/rasterizer_storage_dummy.h b/servers/rendering/dummy/rasterizer_storage_dummy.h index 39837c794f..1e753f8b6b 100644 --- a/servers/rendering/dummy/rasterizer_storage_dummy.h +++ b/servers/rendering/dummy/rasterizer_storage_dummy.h @@ -214,25 +214,6 @@ public: void base_update_dependency(RID p_base, DependencyTracker *p_instance) override {} void skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) override {} - /* DECAL API */ - - RID decal_allocate() override { return RID(); } - void decal_initialize(RID p_rid) override {} - void decal_set_extents(RID p_decal, const Vector3 &p_extents) override {} - void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override {} - void decal_set_emission_energy(RID p_decal, float p_energy) override {} - void decal_set_albedo_mix(RID p_decal, float p_mix) override {} - void decal_set_modulate(RID p_decal, const Color &p_modulate) override {} - void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override {} - void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override {} - void decal_set_fade(RID p_decal, float p_above, float p_below) override {} - void decal_set_normal_fade(RID p_decal, float p_fade) override {} - - AABB decal_get_aabb(RID p_decal) const override { return AABB(); } - - void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} - void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} - /* VOXEL GI API */ RID voxel_gi_allocate() override { return RID(); } diff --git a/servers/rendering/dummy/storage/decal_atlas_storage.h b/servers/rendering/dummy/storage/decal_atlas_storage.h new file mode 100644 index 0000000000..04ddfaca6d --- /dev/null +++ b/servers/rendering/dummy/storage/decal_atlas_storage.h @@ -0,0 +1,62 @@ +/*************************************************************************/ +/* decal_atlas_storage.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 DECAL_ATLAS_STORAGE_DUMMY_H +#define DECAL_ATLAS_STORAGE_DUMMY_H + +#include "servers/rendering/storage/decal_atlas_storage.h" + +namespace RendererDummy { + +class DecalAtlasStorage : public RendererDecalAtlasStorage { +public: + virtual RID decal_allocate() override { return RID(); } + virtual void decal_initialize(RID p_rid) override {} + virtual void decal_free(RID p_rid) override{}; + + virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override {} + virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override {} + virtual void decal_set_emission_energy(RID p_decal, float p_energy) override {} + virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override {} + virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) override {} + virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override {} + virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override {} + virtual void decal_set_fade(RID p_decal, float p_above, float p_below) override {} + virtual void decal_set_normal_fade(RID p_decal, float p_fade) override {} + + virtual AABB decal_get_aabb(RID p_decal) const override { return AABB(); } + + virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} + virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} +}; + +} // namespace RendererDummy + +#endif // !DECAL_ATLAS_STORAGE_DUMMY_H diff --git a/servers/rendering/renderer_compositor.h b/servers/rendering/renderer_compositor.h index c2bc2c03d0..8d8fcee5a4 100644 --- a/servers/rendering/renderer_compositor.h +++ b/servers/rendering/renderer_compositor.h @@ -35,6 +35,7 @@ #include "servers/rendering/renderer_scene.h" #include "servers/rendering/renderer_storage.h" #include "servers/rendering/storage/canvas_texture_storage.h" +#include "servers/rendering/storage/decal_atlas_storage.h" #include "servers/rendering/storage/texture_storage.h" #include "servers/rendering_server.h" @@ -74,6 +75,7 @@ public: virtual RendererCanvasTextureStorage *get_canvas_texture_storage() = 0; virtual RendererTextureStorage *get_texture_storage() = 0; + virtual RendererDecalAtlasStorage *get_decal_atlas_storage() = 0; virtual RendererStorage *get_storage() = 0; virtual RendererCanvasRender *get_canvas() = 0; virtual RendererSceneRender *get_scene() = 0; diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index 07298e93b7..0ae51ed876 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -30,6 +30,7 @@ #include "render_forward_clustered.h" #include "core/config/project_settings.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/renderer_rd/uniform_set_cache_rd.h" #include "servers/rendering/rendering_device.h" #include "servers/rendering/rendering_server_default.h" @@ -612,8 +613,8 @@ void RenderForwardClustered::_setup_environment(const RenderDataRD *p_render_dat //store camera into ubo RendererStorageRD::store_camera(projection, scene_state.ubo.projection_matrix); RendererStorageRD::store_camera(projection.inverse(), scene_state.ubo.inv_projection_matrix); - RendererStorageRD::store_transform(p_render_data->cam_transform, scene_state.ubo.camera_matrix); - RendererStorageRD::store_transform(p_render_data->cam_transform.affine_inverse(), scene_state.ubo.inv_camera_matrix); + RendererStorageRD::store_transform(p_render_data->cam_transform, scene_state.ubo.inv_view_matrix); + RendererStorageRD::store_transform(p_render_data->cam_transform.affine_inverse(), scene_state.ubo.view_matrix); for (uint32_t v = 0; v < p_render_data->view_count; v++) { projection = correction * p_render_data->view_projection[v]; @@ -2140,7 +2141,7 @@ void RenderForwardClustered::_update_render_base_uniform_set() { RD::Uniform u; u.binding = 11; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID decal_atlas = storage->decal_atlas_get_texture(); + RID decal_atlas = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture(); u.append_id(decal_atlas); uniforms.push_back(u); } @@ -2148,7 +2149,7 @@ void RenderForwardClustered::_update_render_base_uniform_set() { RD::Uniform u; u.binding = 12; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID decal_atlas = storage->decal_atlas_get_texture_srgb(); + RID decal_atlas = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture_srgb(); u.append_id(decal_atlas); uniforms.push_back(u); } diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h index a219b98204..b770cc8f0e 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h @@ -219,8 +219,8 @@ class RenderForwardClustered : public RendererSceneRenderRD { struct UBO { float projection_matrix[16]; float inv_projection_matrix[16]; - float camera_matrix[16]; - float inv_camera_matrix[16]; + float inv_view_matrix[16]; + float view_matrix[16]; float projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; float inv_projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index 2c42366959..33ad2c2c31 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -531,10 +531,10 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin //shader compiler ShaderCompiler::DefaultIdentifierActions actions; - actions.renames["WORLD_MATRIX"] = "world_matrix"; - actions.renames["WORLD_NORMAL_MATRIX"] = "world_normal_matrix"; - actions.renames["INV_CAMERA_MATRIX"] = "scene_data.inv_camera_matrix"; - actions.renames["CAMERA_MATRIX"] = "scene_data.camera_matrix"; + actions.renames["MODEL_MATRIX"] = "model_matrix"; + actions.renames["MODEL_NORMAL_MATRIX"] = "model_normal_matrix"; + actions.renames["VIEW_MATRIX"] = "scene_data.view_matrix"; + actions.renames["INV_VIEW_MATRIX"] = "scene_data.inv_view_matrix"; actions.renames["PROJECTION_MATRIX"] = "projection_matrix"; actions.renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix"; actions.renames["MODELVIEW_MATRIX"] = "modelview"; diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 1789319aaf..a09a604e49 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -30,6 +30,7 @@ #include "render_forward_mobile.h" #include "core/config/project_settings.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/rendering_device.h" #include "servers/rendering/rendering_server_default.h" @@ -1275,7 +1276,7 @@ void RenderForwardMobile::_update_render_base_uniform_set() { RD::Uniform u; u.binding = 11; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID decal_atlas = storage->decal_atlas_get_texture(); + RID decal_atlas = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture(); u.append_id(decal_atlas); uniforms.push_back(u); } @@ -1283,7 +1284,7 @@ void RenderForwardMobile::_update_render_base_uniform_set() { RD::Uniform u; u.binding = 12; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID decal_atlas = storage->decal_atlas_get_texture_srgb(); + RID decal_atlas = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture_srgb(); u.append_id(decal_atlas); uniforms.push_back(u); } @@ -1520,8 +1521,8 @@ void RenderForwardMobile::_setup_environment(const RenderDataRD *p_render_data, //store camera into ubo RendererStorageRD::store_camera(projection, scene_state.ubo.projection_matrix); RendererStorageRD::store_camera(projection.inverse(), scene_state.ubo.inv_projection_matrix); - RendererStorageRD::store_transform(p_render_data->cam_transform, scene_state.ubo.camera_matrix); - RendererStorageRD::store_transform(p_render_data->cam_transform.affine_inverse(), scene_state.ubo.inv_camera_matrix); + RendererStorageRD::store_transform(p_render_data->cam_transform, scene_state.ubo.inv_view_matrix); + RendererStorageRD::store_transform(p_render_data->cam_transform.affine_inverse(), scene_state.ubo.view_matrix); for (uint32_t v = 0; v < p_render_data->view_count; v++) { projection = correction * p_render_data->view_projection[v]; diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h index 8274dc3b0c..6162ca55af 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h @@ -254,8 +254,8 @@ protected: struct UBO { float projection_matrix[16]; float inv_projection_matrix[16]; - float camera_matrix[16]; - float inv_camera_matrix[16]; + float inv_view_matrix[16]; + float view_matrix[16]; float projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; float inv_projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index ed40e08d75..d7ed4a36f0 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -501,10 +501,10 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p //shader compiler ShaderCompiler::DefaultIdentifierActions actions; - actions.renames["WORLD_MATRIX"] = "world_matrix"; - actions.renames["WORLD_NORMAL_MATRIX"] = "world_normal_matrix"; - actions.renames["INV_CAMERA_MATRIX"] = "scene_data.inv_camera_matrix"; - actions.renames["CAMERA_MATRIX"] = "scene_data.camera_matrix"; + actions.renames["MODEL_MATRIX"] = "model_matrix"; + actions.renames["MODEL_NORMAL_MATRIX"] = "model_normal_matrix"; + actions.renames["VIEW_MATRIX"] = "scene_data.view_matrix"; + actions.renames["INV_VIEW_MATRIX"] = "scene_data.inv_view_matrix"; actions.renames["PROJECTION_MATRIX"] = "projection_matrix"; actions.renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix"; actions.renames["MODELVIEW_MATRIX"] = "modelview"; diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp index b30a295fa6..e56e263540 100644 --- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp @@ -35,6 +35,7 @@ #include "core/math/math_defs.h" #include "core/math/math_funcs.h" #include "renderer_compositor_rd.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/rendering_server_default.h" void RendererCanvasRenderRD::_update_transform_2d_to_mat4(const Transform2D &p_transform, float *p_mat4) { @@ -947,7 +948,7 @@ RID RendererCanvasRenderRD::_create_base_uniform_set(RID p_to_render_target, boo RD::Uniform u; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; u.binding = 3; - u.append_id(storage->decal_atlas_get_texture()); + u.append_id(RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture()); uniforms.push_back(u); } @@ -1253,7 +1254,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p } if (clight->texture.is_valid()) { - Rect2 atlas_rect = storage->decal_atlas_get_texture_rect(clight->texture); + Rect2 atlas_rect = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture_rect(clight->texture); state.light_uniforms[index].atlas_rect[0] = atlas_rect.position.x; state.light_uniforms[index].atlas_rect[1] = atlas_rect.position.y; state.light_uniforms[index].atlas_rect[2] = atlas_rect.size.width; @@ -1479,18 +1480,20 @@ RID RendererCanvasRenderRD::light_create() { } void RendererCanvasRenderRD::light_set_texture(RID p_rid, RID p_texture) { + RendererRD::DecalAtlasStorage *decal_atlas_storage = RendererRD::DecalAtlasStorage::get_singleton(); + CanvasLight *cl = canvas_light_owner.get_or_null(p_rid); ERR_FAIL_COND(!cl); if (cl->texture == p_texture) { return; } if (cl->texture.is_valid()) { - storage->texture_remove_from_decal_atlas(cl->texture); + decal_atlas_storage->texture_remove_from_decal_atlas(cl->texture); } cl->texture = p_texture; if (cl->texture.is_valid()) { - storage->texture_add_to_decal_atlas(cl->texture); + decal_atlas_storage->texture_add_to_decal_atlas(cl->texture); } } @@ -2361,7 +2364,7 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) { actions.renames["UV"] = "uv"; actions.renames["POINT_SIZE"] = "gl_PointSize"; - actions.renames["WORLD_MATRIX"] = "world_matrix"; + actions.renames["MODEL_MATRIX"] = "model_matrix"; actions.renames["CANVAS_MATRIX"] = "canvas_data.canvas_transform"; actions.renames["SCREEN_MATRIX"] = "canvas_data.screen_transform"; actions.renames["TIME"] = "canvas_data.time"; diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp index 46ec472121..6d6cf0ce73 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp @@ -155,6 +155,7 @@ void RendererCompositorRD::finalize() { memdelete(scene); memdelete(canvas); memdelete(storage); + memdelete(decal_atlas_storage); memdelete(texture_storage); memdelete(canvas_texture_storage); @@ -287,6 +288,7 @@ RendererCompositorRD::RendererCompositorRD() { canvas_texture_storage = memnew(RendererRD::CanvasTextureStorage); texture_storage = memnew(RendererRD::TextureStorage); + decal_atlas_storage = memnew(RendererRD::DecalAtlasStorage); storage = memnew(RendererStorageRD); canvas = memnew(RendererCanvasRenderRD(storage)); diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h index 07df38b2b2..a860093bb1 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.h +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h @@ -40,6 +40,7 @@ #include "servers/rendering/renderer_rd/renderer_storage_rd.h" #include "servers/rendering/renderer_rd/shaders/blit.glsl.gen.h" #include "servers/rendering/renderer_rd/storage_rd/canvas_texture_storage.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/renderer_rd/storage_rd/texture_storage.h" #include "servers/rendering/renderer_rd/uniform_set_cache_rd.h" @@ -49,6 +50,7 @@ protected: RendererCanvasRenderRD *canvas; RendererRD::CanvasTextureStorage *canvas_texture_storage; RendererRD::TextureStorage *texture_storage; + RendererRD::DecalAtlasStorage *decal_atlas_storage; RendererStorageRD *storage; RendererSceneRenderRD *scene; @@ -92,8 +94,9 @@ protected: static uint64_t frame; public: - RendererCanvasTextureStorage *get_canvas_texture_storage() { return canvas_texture_storage; }; - RendererTextureStorage *get_texture_storage() { return texture_storage; }; + RendererCanvasTextureStorage *get_canvas_texture_storage() { return canvas_texture_storage; } + RendererTextureStorage *get_texture_storage() { return texture_storage; } + RendererDecalAtlasStorage *get_decal_atlas_storage() { return decal_atlas_storage; } RendererStorage *get_storage() { return storage; } RendererCanvasRender *get_canvas() { return canvas; } RendererSceneRender *get_scene() { return scene; } diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index f5258d7923..4a6dbc137c 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -33,6 +33,7 @@ #include "core/config/project_settings.h" #include "core/os/os.h" #include "renderer_compositor_rd.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/rendering_server_default.h" void get_vogel_disk(float *r_kernel, int p_sample_count) { @@ -2674,7 +2675,7 @@ void RendererSceneRenderRD::_render_buffers_debug_draw(RID p_render_buffers, RID } if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_DECAL_ATLAS) { - RID decal_atlas = storage->decal_atlas_get_texture(); + RID decal_atlas = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture(); if (decal_atlas.is_valid()) { Size2 rtsize = storage->render_target_get_size(rb->render_target); @@ -3262,6 +3263,8 @@ void RendererSceneRenderRD::_setup_reflections(const PagedArray<RID> &p_reflecti } void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const Transform3D &p_camera_transform, RID p_shadow_atlas, bool p_using_shadows, uint32_t &r_directional_light_count, uint32_t &r_positional_light_count, bool &r_directional_light_soft_shadows) { + RendererRD::DecalAtlasStorage *decal_atlas_storage = RendererRD::DecalAtlasStorage::get_singleton(); + Transform3D inverse_transform = p_camera_transform.affine_inverse(); r_directional_light_count = 0; @@ -3545,7 +3548,7 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const RID projector = storage->light_get_projector(base); if (projector.is_valid()) { - Rect2 rect = storage->decal_atlas_get_texture_rect(projector); + Rect2 rect = decal_atlas_storage->decal_atlas_get_texture_rect(projector); if (type == RS::LIGHT_SPOT) { light_data.projector_rect[0] = rect.position.x; @@ -3661,6 +3664,8 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const } void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const Transform3D &p_camera_inverse_xform) { + RendererRD::DecalAtlasStorage *decal_atlas_storage = RendererRD::DecalAtlasStorage::get_singleton(); + Transform3D uv_xform; uv_xform.basis.scale(Vector3(2.0, 1.0, 2.0)); uv_xform.origin = Vector3(-1.0, 0.0, -1.0); @@ -3684,9 +3689,9 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const real_t distance = -p_camera_inverse_xform.xform(xform.origin).z; - if (storage->decal_is_distance_fade_enabled(decal)) { - float fade_begin = storage->decal_get_distance_fade_begin(decal); - float fade_length = storage->decal_get_distance_fade_length(decal); + if (decal_atlas_storage->decal_is_distance_fade_enabled(decal)) { + float fade_begin = decal_atlas_storage->decal_get_distance_fade_begin(decal); + float fade_length = decal_atlas_storage->decal_get_distance_fade_length(decal); if (distance > fade_begin) { if (distance > fade_begin + fade_length) { @@ -3714,15 +3719,15 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const _map_forward_id(FORWARD_ID_TYPE_DECAL, di->forward_id, i); } - di->cull_mask = storage->decal_get_cull_mask(decal); + di->cull_mask = decal_atlas_storage->decal_get_cull_mask(decal); Transform3D xform = di->transform; float fade = 1.0; - if (storage->decal_is_distance_fade_enabled(decal)) { + if (decal_atlas_storage->decal_is_distance_fade_enabled(decal)) { real_t distance = -p_camera_inverse_xform.xform(xform.origin).z; - float fade_begin = storage->decal_get_distance_fade_begin(decal); - float fade_length = storage->decal_get_distance_fade_length(decal); + float fade_begin = decal_atlas_storage->decal_get_distance_fade_begin(decal); + float fade_length = decal_atlas_storage->decal_get_distance_fade_length(decal); if (distance > fade_begin) { fade = 1.0 - (distance - fade_begin) / fade_length; @@ -3731,7 +3736,7 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const Cluster::DecalData &dd = cluster.decals[i]; - Vector3 decal_extents = storage->decal_get_extents(decal); + Vector3 decal_extents = decal_atlas_storage->decal_get_extents(decal); Transform3D scale_xform; scale_xform.basis.scale(decal_extents); @@ -3744,12 +3749,12 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const dd.normal[0] = normal.x; dd.normal[1] = normal.y; dd.normal[2] = normal.z; - dd.normal_fade = storage->decal_get_normal_fade(decal); + dd.normal_fade = decal_atlas_storage->decal_get_normal_fade(decal); - RID albedo_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ALBEDO); - RID emission_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_EMISSION); + RID albedo_tex = decal_atlas_storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ALBEDO); + RID emission_tex = decal_atlas_storage->decal_get_texture(decal, RS::DECAL_TEXTURE_EMISSION); if (albedo_tex.is_valid()) { - Rect2 rect = storage->decal_atlas_get_texture_rect(albedo_tex); + Rect2 rect = decal_atlas_storage->decal_atlas_get_texture_rect(albedo_tex); dd.albedo_rect[0] = rect.position.x; dd.albedo_rect[1] = rect.position.y; dd.albedo_rect[2] = rect.size.x; @@ -3764,10 +3769,10 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const dd.albedo_rect[3] = 0; } - RID normal_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_NORMAL); + RID normal_tex = decal_atlas_storage->decal_get_texture(decal, RS::DECAL_TEXTURE_NORMAL); if (normal_tex.is_valid()) { - Rect2 rect = storage->decal_atlas_get_texture_rect(normal_tex); + Rect2 rect = decal_atlas_storage->decal_atlas_get_texture_rect(normal_tex); dd.normal_rect[0] = rect.position.x; dd.normal_rect[1] = rect.position.y; dd.normal_rect[2] = rect.size.x; @@ -3782,9 +3787,9 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const dd.normal_rect[3] = 0; } - RID orm_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ORM); + RID orm_tex = decal_atlas_storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ORM); if (orm_tex.is_valid()) { - Rect2 rect = storage->decal_atlas_get_texture_rect(orm_tex); + Rect2 rect = decal_atlas_storage->decal_atlas_get_texture_rect(orm_tex); dd.orm_rect[0] = rect.position.x; dd.orm_rect[1] = rect.position.y; dd.orm_rect[2] = rect.size.x; @@ -3797,7 +3802,7 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const } if (emission_tex.is_valid()) { - Rect2 rect = storage->decal_atlas_get_texture_rect(emission_tex); + Rect2 rect = decal_atlas_storage->decal_atlas_get_texture_rect(emission_tex); dd.emission_rect[0] = rect.position.x; dd.emission_rect[1] = rect.position.y; dd.emission_rect[2] = rect.size.x; @@ -3809,16 +3814,16 @@ void RendererSceneRenderRD::_setup_decals(const PagedArray<RID> &p_decals, const dd.emission_rect[3] = 0; } - Color modulate = storage->decal_get_modulate(decal); + Color modulate = decal_atlas_storage->decal_get_modulate(decal); dd.modulate[0] = modulate.r; dd.modulate[1] = modulate.g; dd.modulate[2] = modulate.b; dd.modulate[3] = modulate.a * fade; - dd.emission_energy = storage->decal_get_emission_energy(decal) * fade; - dd.albedo_mix = storage->decal_get_albedo_mix(decal); - dd.mask = storage->decal_get_cull_mask(decal); - dd.upper_fade = storage->decal_get_upper_fade(decal); - dd.lower_fade = storage->decal_get_lower_fade(decal); + dd.emission_energy = decal_atlas_storage->decal_get_emission_energy(decal) * fade; + dd.albedo_mix = decal_atlas_storage->decal_get_albedo_mix(decal); + dd.mask = decal_atlas_storage->decal_get_cull_mask(decal); + dd.upper_fade = decal_atlas_storage->decal_get_upper_fade(decal); + dd.lower_fade = decal_atlas_storage->decal_get_lower_fade(decal); if (current_cluster_builder != nullptr) { current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_DECAL, xform, decal_extents); diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 9076fc5bb8..5b6dfbe19f 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -36,6 +36,7 @@ #include "core/math/math_defs.h" #include "renderer_compositor_rd.h" #include "servers/rendering/renderer_rd/storage_rd/canvas_texture_storage.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/renderer_rd/storage_rd/texture_storage.h" #include "servers/rendering/rendering_server_globals.h" #include "servers/rendering/shader_language.h" @@ -5315,6 +5316,7 @@ void RendererStorageRD::light_set_shadow(RID p_light, bool p_enabled) { } void RendererStorageRD::light_set_projector(RID p_light, RID p_texture) { + RendererRD::DecalAtlasStorage *decal_atlas_storage = RendererRD::DecalAtlasStorage::get_singleton(); Light *light = light_owner.get_or_null(p_light); ERR_FAIL_COND(!light); @@ -5323,14 +5325,14 @@ void RendererStorageRD::light_set_projector(RID p_light, RID p_texture) { } if (light->type != RS::LIGHT_DIRECTIONAL && light->projector.is_valid()) { - texture_remove_from_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI); + decal_atlas_storage->texture_remove_from_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI); } light->projector = p_texture; if (light->type != RS::LIGHT_DIRECTIONAL) { if (light->projector.is_valid()) { - texture_add_to_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI); + decal_atlas_storage->texture_add_to_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI); } light->dependency.changed_notify(DEPENDENCY_CHANGED_LIGHT_SOFT_SHADOW_AND_PROJECTOR); } @@ -5727,97 +5729,6 @@ float RendererStorageRD::reflection_probe_get_ambient_color_energy(RID p_probe) return reflection_probe->ambient_color_energy; } -RID RendererStorageRD::decal_allocate() { - return decal_owner.allocate_rid(); -} -void RendererStorageRD::decal_initialize(RID p_decal) { - decal_owner.initialize_rid(p_decal, Decal()); -} - -void RendererStorageRD::decal_set_extents(RID p_decal, const Vector3 &p_extents) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->extents = p_extents; - decal->dependency.changed_notify(DEPENDENCY_CHANGED_AABB); -} - -void RendererStorageRD::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - ERR_FAIL_INDEX(p_type, RS::DECAL_TEXTURE_MAX); - - if (decal->textures[p_type] == p_texture) { - return; - } - - ERR_FAIL_COND(p_texture.is_valid() && !RendererRD::TextureStorage::get_singleton()->owns_texture(p_texture)); - - if (decal->textures[p_type].is_valid() && RendererRD::TextureStorage::get_singleton()->owns_texture(decal->textures[p_type])) { - texture_remove_from_decal_atlas(decal->textures[p_type]); - } - - decal->textures[p_type] = p_texture; - - if (decal->textures[p_type].is_valid()) { - texture_add_to_decal_atlas(decal->textures[p_type]); - } - - decal->dependency.changed_notify(DEPENDENCY_CHANGED_DECAL); -} - -void RendererStorageRD::decal_set_emission_energy(RID p_decal, float p_energy) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->emission_energy = p_energy; -} - -void RendererStorageRD::decal_set_albedo_mix(RID p_decal, float p_mix) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->albedo_mix = p_mix; -} - -void RendererStorageRD::decal_set_modulate(RID p_decal, const Color &p_modulate) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->modulate = p_modulate; -} - -void RendererStorageRD::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->cull_mask = p_layers; - decal->dependency.changed_notify(DEPENDENCY_CHANGED_AABB); -} - -void RendererStorageRD::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->distance_fade = p_enabled; - decal->distance_fade_begin = p_begin; - decal->distance_fade_length = p_length; -} - -void RendererStorageRD::decal_set_fade(RID p_decal, float p_above, float p_below) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->upper_fade = p_above; - decal->lower_fade = p_below; -} - -void RendererStorageRD::decal_set_normal_fade(RID p_decal, float p_fade) { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND(!decal); - decal->normal_fade = p_fade; -} - -AABB RendererStorageRD::decal_get_aabb(RID p_decal) const { - Decal *decal = decal_owner.get_or_null(p_decal); - ERR_FAIL_COND_V(!decal, AABB()); - - return AABB(-decal->extents, decal->extents * 2.0); -} - RID RendererStorageRD::voxel_gi_allocate() { return voxel_gi_owner.allocate_rid(); } @@ -7030,8 +6941,8 @@ void RendererStorageRD::base_update_dependency(RID p_base, DependencyTracker *p_ } else if (reflection_probe_owner.owns(p_base)) { ReflectionProbe *rp = reflection_probe_owner.get_or_null(p_base); p_instance->update_dependency(&rp->dependency); - } else if (decal_owner.owns(p_base)) { - Decal *decal = decal_owner.get_or_null(p_base); + } else if (RendererRD::DecalAtlasStorage::get_singleton()->owns_decal(p_base)) { + RendererRD::Decal *decal = RendererRD::DecalAtlasStorage::get_singleton()->get_decal(p_base); p_instance->update_dependency(&decal->dependency); } else if (voxel_gi_owner.owns(p_base)) { VoxelGI *gip = voxel_gi_owner.get_or_null(p_base); @@ -7074,7 +6985,7 @@ RS::InstanceType RendererStorageRD::get_base_type(RID p_rid) const { if (reflection_probe_owner.owns(p_rid)) { return RS::INSTANCE_REFLECTION_PROBE; } - if (decal_owner.owns(p_rid)) { + if (RendererRD::DecalAtlasStorage::get_singleton()->owns_decal(p_rid)) { return RS::INSTANCE_DECAL; } if (voxel_gi_owner.owns(p_rid)) { @@ -7102,252 +7013,6 @@ RS::InstanceType RendererStorageRD::get_base_type(RID p_rid) const { return RS::INSTANCE_NONE; } -void RendererStorageRD::decal_atlas_remove_texture(RID p_texture) { - if (decal_atlas.textures.has(p_texture)) { - decal_atlas.textures.erase(p_texture); - //there is not much a point of making it dirty, just let it be. - } -} - -void RendererStorageRD::decal_atlas_mark_dirty_on_texture(RID p_texture) { - if (decal_atlas.textures.has(p_texture)) { - //belongs to decal atlas.. - - decal_atlas.dirty = true; //mark it dirty since it was most likely modified - } -} - -void RendererStorageRD::texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp) { - if (!decal_atlas.textures.has(p_texture)) { - DecalAtlas::Texture t; - t.users = 1; - t.panorama_to_dp_users = p_panorama_to_dp ? 1 : 0; - decal_atlas.textures[p_texture] = t; - decal_atlas.dirty = true; - } else { - DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); - t->users++; - if (p_panorama_to_dp) { - t->panorama_to_dp_users++; - } - } -} - -void RendererStorageRD::texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp) { - DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); - ERR_FAIL_COND(!t); - t->users--; - if (p_panorama_to_dp) { - ERR_FAIL_COND(t->panorama_to_dp_users == 0); - t->panorama_to_dp_users--; - } - if (t->users == 0) { - decal_atlas.textures.erase(p_texture); - //do not mark it dirty, there is no need to since it remains working - } -} - -RID RendererStorageRD::decal_atlas_get_texture() const { - return decal_atlas.texture; -} - -RID RendererStorageRD::decal_atlas_get_texture_srgb() const { - return decal_atlas.texture_srgb; -} - -void RendererStorageRD::_update_decal_atlas() { - if (!decal_atlas.dirty) { - return; //nothing to do - } - - decal_atlas.dirty = false; - - if (decal_atlas.texture.is_valid()) { - RD::get_singleton()->free(decal_atlas.texture); - decal_atlas.texture = RID(); - decal_atlas.texture_srgb = RID(); - decal_atlas.texture_mipmaps.clear(); - } - - int border = 1 << decal_atlas.mipmaps; - - if (decal_atlas.textures.size()) { - //generate atlas - Vector<DecalAtlas::SortItem> itemsv; - itemsv.resize(decal_atlas.textures.size()); - int base_size = 8; - const RID *K = nullptr; - - int idx = 0; - while ((K = decal_atlas.textures.next(K))) { - DecalAtlas::SortItem &si = itemsv.write[idx]; - - RendererRD::Texture *src_tex = RendererRD::TextureStorage::get_singleton()->get_texture(*K); - - si.size.width = (src_tex->width / border) + 1; - si.size.height = (src_tex->height / border) + 1; - si.pixel_size = Size2i(src_tex->width, src_tex->height); - - if (base_size < si.size.width) { - base_size = nearest_power_of_2_templated(si.size.width); - } - - si.texture = *K; - idx++; - } - - //sort items by size - itemsv.sort(); - - //attempt to create atlas - int item_count = itemsv.size(); - DecalAtlas::SortItem *items = itemsv.ptrw(); - - int atlas_height = 0; - - while (true) { - Vector<int> v_offsetsv; - v_offsetsv.resize(base_size); - - int *v_offsets = v_offsetsv.ptrw(); - memset(v_offsets, 0, sizeof(int) * base_size); - - int max_height = 0; - - for (int i = 0; i < item_count; i++) { - //best fit - DecalAtlas::SortItem &si = items[i]; - int best_idx = -1; - int best_height = 0x7FFFFFFF; - for (int j = 0; j <= base_size - si.size.width; j++) { - int height = 0; - for (int k = 0; k < si.size.width; k++) { - int h = v_offsets[k + j]; - if (h > height) { - height = h; - if (height > best_height) { - break; //already bad - } - } - } - - if (height < best_height) { - best_height = height; - best_idx = j; - } - } - - //update - for (int k = 0; k < si.size.width; k++) { - v_offsets[k + best_idx] = best_height + si.size.height; - } - - si.pos.x = best_idx; - si.pos.y = best_height; - - if (si.pos.y + si.size.height > max_height) { - max_height = si.pos.y + si.size.height; - } - } - - if (max_height <= base_size * 2) { - atlas_height = max_height; - break; //good ratio, break; - } - - base_size *= 2; - } - - decal_atlas.size.width = base_size * border; - decal_atlas.size.height = nearest_power_of_2_templated(atlas_height * border); - - for (int i = 0; i < item_count; i++) { - DecalAtlas::Texture *t = decal_atlas.textures.getptr(items[i].texture); - t->uv_rect.position = items[i].pos * border + Vector2i(border / 2, border / 2); - t->uv_rect.size = items[i].pixel_size; - - t->uv_rect.position /= Size2(decal_atlas.size); - t->uv_rect.size /= Size2(decal_atlas.size); - } - } else { - //use border as size, so it at least has enough mipmaps - decal_atlas.size.width = border; - decal_atlas.size.height = border; - } - - //blit textures - - RD::TextureFormat tformat; - tformat.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; - tformat.width = decal_atlas.size.width; - tformat.height = decal_atlas.size.height; - tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT; - tformat.texture_type = RD::TEXTURE_TYPE_2D; - tformat.mipmaps = decal_atlas.mipmaps; - tformat.shareable_formats.push_back(RD::DATA_FORMAT_R8G8B8A8_UNORM); - tformat.shareable_formats.push_back(RD::DATA_FORMAT_R8G8B8A8_SRGB); - - decal_atlas.texture = RD::get_singleton()->texture_create(tformat, RD::TextureView()); - RD::get_singleton()->texture_clear(decal_atlas.texture, Color(0, 0, 0, 0), 0, decal_atlas.mipmaps, 0, 1); - - { - //create the framebuffer - - Size2i s = decal_atlas.size; - - for (int i = 0; i < decal_atlas.mipmaps; i++) { - DecalAtlas::MipMap mm; - mm.texture = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), decal_atlas.texture, 0, i); - Vector<RID> fb; - fb.push_back(mm.texture); - mm.fb = RD::get_singleton()->framebuffer_create(fb); - mm.size = s; - decal_atlas.texture_mipmaps.push_back(mm); - - s.width = MAX(1, s.width >> 1); - s.height = MAX(1, s.height >> 1); - } - { - //create the SRGB variant - RD::TextureView rd_view; - rd_view.format_override = RD::DATA_FORMAT_R8G8B8A8_SRGB; - decal_atlas.texture_srgb = RD::get_singleton()->texture_create_shared(rd_view, decal_atlas.texture); - } - } - - RID prev_texture; - for (int i = 0; i < decal_atlas.texture_mipmaps.size(); i++) { - const DecalAtlas::MipMap &mm = decal_atlas.texture_mipmaps[i]; - - Color clear_color(0, 0, 0, 0); - - if (decal_atlas.textures.size()) { - if (i == 0) { - Vector<Color> cc; - cc.push_back(clear_color); - - RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(mm.fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, cc); - - const RID *K = nullptr; - while ((K = decal_atlas.textures.next(K))) { - DecalAtlas::Texture *t = decal_atlas.textures.getptr(*K); - RendererRD::Texture *src_tex = RendererRD::TextureStorage::get_singleton()->get_texture(*K); - effects->copy_to_atlas_fb(src_tex->rd_texture, mm.fb, t->uv_rect, draw_list, false, t->panorama_to_dp_users > 0); - } - - RD::get_singleton()->draw_list_end(); - - prev_texture = mm.texture; - } else { - effects->copy_to_fb_rect(prev_texture, mm.fb, Rect2i(Point2i(), mm.size)); - prev_texture = mm.texture; - } - } else { - RD::get_singleton()->texture_clear(mm.texture, clear_color, 0, 1, 0, 1); - } - } -} - int32_t RendererStorageRD::_global_variable_allocate(uint32_t p_elements) { int32_t idx = 0; while (idx + p_elements <= global_variables.buffer_size) { @@ -8017,7 +7682,7 @@ void RendererStorageRD::update_dirty_resources() { _update_queued_materials(); _update_dirty_multimeshes(); _update_dirty_skeletons(); - _update_decal_atlas(); + RendererRD::DecalAtlasStorage::get_singleton()->update_decal_atlas(); } bool RendererStorageRD::has_os_feature(const String &p_feature) const { @@ -8103,15 +7768,8 @@ bool RendererStorageRD::free(RID p_rid) { ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_rid); reflection_probe->dependency.deleted_notify(p_rid); reflection_probe_owner.free(p_rid); - } else if (decal_owner.owns(p_rid)) { - Decal *decal = decal_owner.get_or_null(p_rid); - for (int i = 0; i < RS::DECAL_TEXTURE_MAX; i++) { - if (decal->textures[i].is_valid() && RendererRD::TextureStorage::get_singleton()->owns_texture(decal->textures[i])) { - texture_remove_from_decal_atlas(decal->textures[i]); - } - } - decal->dependency.deleted_notify(p_rid); - decal_owner.free(p_rid); + } else if (RendererRD::DecalAtlasStorage::get_singleton()->owns_decal(p_rid)) { + RendererRD::DecalAtlasStorage::get_singleton()->decal_free(p_rid); } else if (voxel_gi_owner.owns(p_rid)) { voxel_gi_allocate_data(p_rid, Transform3D(), AABB(), Vector3i(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<int>()); //deallocate VoxelGI *voxel_gi = voxel_gi_owner.get_or_null(p_rid); @@ -8259,33 +7917,6 @@ RendererStorageRD::RendererStorageRD() { memset(global_variables.buffer_dirty_regions, 0, sizeof(bool) * global_variables.buffer_size / GlobalVariables::BUFFER_DIRTY_REGION_SIZE); global_variables.buffer = RD::get_singleton()->storage_buffer_create(sizeof(GlobalVariables::Value) * global_variables.buffer_size); - { // default atlas texture - RD::TextureFormat tformat; - tformat.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; - tformat.width = 4; - tformat.height = 4; - tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; - tformat.texture_type = RD::TEXTURE_TYPE_2D; - - Vector<uint8_t> pv; - pv.resize(16 * 4); - - for (int i = 0; i < 16; i++) { - pv.set(i * 4 + 0, 0); - pv.set(i * 4 + 1, 0); - pv.set(i * 4 + 2, 0); - pv.set(i * 4 + 3, 255); - } - - { - //take the chance and initialize decal atlas to something - Vector<Vector<uint8_t>> vpv; - vpv.push_back(pv); - decal_atlas.texture = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); - decal_atlas.texture_srgb = decal_atlas.texture; - } - } - //default samplers for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) { for (int j = 1; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) { @@ -8737,14 +8368,6 @@ RendererStorageRD::~RendererStorageRD() { RD::get_singleton()->free(default_rd_storage_buffer); - if (decal_atlas.textures.size()) { - ERR_PRINT("Decal Atlas: " + itos(decal_atlas.textures.size()) + " textures were not removed from the atlas."); - } - - if (decal_atlas.texture.is_valid()) { - RD::get_singleton()->free(decal_atlas.texture); - } - if (effects) { memdelete(effects); effects = nullptr; diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h index 872dd41fe5..3aa475b34d 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.h +++ b/servers/rendering/renderer_rd/renderer_storage_rd.h @@ -205,50 +205,6 @@ private: RID custom_rd_samplers[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX]; RID default_rd_storage_buffer; - /* DECAL ATLAS */ - - struct DecalAtlas { - struct Texture { - int panorama_to_dp_users; - int users; - Rect2 uv_rect; - }; - - struct SortItem { - RID texture; - Size2i pixel_size; - Size2i size; - Point2i pos; - - bool operator<(const SortItem &p_item) const { - //sort larger to smaller - if (size.height == p_item.size.height) { - return size.width > p_item.size.width; - } else { - return size.height > p_item.size.height; - } - } - }; - - HashMap<RID, Texture> textures; - bool dirty = true; - int mipmaps = 5; - - RID texture; - RID texture_srgb; - struct MipMap { - RID fb; - RID texture; - Size2i size; - }; - Vector<MipMap> texture_mipmaps; - - Size2i size; - - } decal_atlas; - - void _update_decal_atlas(); - /* SHADER */ struct Material; @@ -952,27 +908,6 @@ private: mutable RID_Owner<ReflectionProbe, true> reflection_probe_owner; - /* DECAL */ - - struct Decal { - Vector3 extents = Vector3(1, 1, 1); - RID textures[RS::DECAL_TEXTURE_MAX]; - float emission_energy = 1.0; - float albedo_mix = 1.0; - Color modulate = Color(1, 1, 1, 1); - uint32_t cull_mask = (1 << 20) - 1; - float upper_fade = 0.3; - float lower_fade = 0.3; - bool distance_fade = false; - float distance_fade_begin = 10; - float distance_fade_length = 1; - float normal_fade = 0.0; - - Dependency dependency; - }; - - mutable RID_Owner<Decal, true> decal_owner; - /* VOXEL GI */ struct VoxelGI { @@ -1190,17 +1125,6 @@ private: EffectsRD *effects = nullptr; public: - RID decal_atlas_get_texture() const; - RID decal_atlas_get_texture_srgb() const; - _FORCE_INLINE_ Rect2 decal_atlas_get_texture_rect(RID p_texture) { - DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); - if (!t) { - return Rect2(); - } - - return t->uv_rect; - } - //internal usage _FORCE_INLINE_ RID sampler_rd_get_default(RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat) { @@ -1791,89 +1715,6 @@ public: void base_update_dependency(RID p_base, DependencyTracker *p_instance); void skeleton_update_dependency(RID p_skeleton, DependencyTracker *p_instance); - /* DECAL API */ - - RID decal_allocate(); - void decal_initialize(RID p_decal); - - virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents); - virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture); - virtual void decal_set_emission_energy(RID p_decal, float p_energy); - virtual void decal_set_albedo_mix(RID p_decal, float p_mix); - virtual void decal_set_modulate(RID p_decal, const Color &p_modulate); - virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers); - virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length); - virtual void decal_set_fade(RID p_decal, float p_above, float p_below); - virtual void decal_set_normal_fade(RID p_decal, float p_fade); - - void decal_atlas_mark_dirty_on_texture(RID p_texture); - void decal_atlas_remove_texture(RID p_texture); - - virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false); - virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false); - - _FORCE_INLINE_ Vector3 decal_get_extents(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->extents; - } - - _FORCE_INLINE_ RID decal_get_texture(RID p_decal, RS::DecalTexture p_texture) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->textures[p_texture]; - } - - _FORCE_INLINE_ Color decal_get_modulate(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->modulate; - } - - _FORCE_INLINE_ float decal_get_emission_energy(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->emission_energy; - } - - _FORCE_INLINE_ float decal_get_albedo_mix(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->albedo_mix; - } - - _FORCE_INLINE_ uint32_t decal_get_cull_mask(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->cull_mask; - } - - _FORCE_INLINE_ float decal_get_upper_fade(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->upper_fade; - } - - _FORCE_INLINE_ float decal_get_lower_fade(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->lower_fade; - } - - _FORCE_INLINE_ float decal_get_normal_fade(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->normal_fade; - } - - _FORCE_INLINE_ bool decal_is_distance_fade_enabled(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->distance_fade; - } - - _FORCE_INLINE_ float decal_get_distance_fade_begin(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->distance_fade_begin; - } - - _FORCE_INLINE_ float decal_get_distance_fade_length(RID p_decal) { - const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->distance_fade_length; - } - - virtual AABB decal_get_aabb(RID p_decal) const; - /* VOXEL GI API */ RID voxel_gi_allocate(); diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl index 65a621b203..fbc641ee9e 100644 --- a/servers/rendering/renderer_rd/shaders/canvas.glsl +++ b/servers/rendering/renderer_rd/shaders/canvas.glsl @@ -82,7 +82,7 @@ void main() { #endif - mat4 world_matrix = mat4(vec4(draw_data.world_x, 0.0, 0.0), vec4(draw_data.world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data.world_ofs, 0.0, 1.0)); + mat4 model_matrix = mat4(vec4(draw_data.world_x, 0.0, 0.0), vec4(draw_data.world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data.world_ofs, 0.0, 1.0)); #define FLAGS_INSTANCING_MASK 0x7F #define FLAGS_INSTANCING_HAS_COLORS (1 << 7) @@ -156,7 +156,7 @@ void main() { } matrix = transpose(matrix); - world_matrix = world_matrix * matrix; + model_matrix = model_matrix * matrix; } } @@ -179,7 +179,7 @@ void main() { #endif #if !defined(SKIP_TRANSFORM_USED) - vertex = (world_matrix * vec4(vertex, 0.0, 1.0)).xy; + vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy; #endif color_interp = color; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index f9cee011d2..33b0ee5fae 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -130,13 +130,13 @@ void main() { instance_index_interp = instance_index; - mat4 world_matrix = instances.data[instance_index].transform; + mat4 model_matrix = instances.data[instance_index].transform; - mat3 world_normal_matrix; + mat3 model_normal_matrix; if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) { - world_normal_matrix = transpose(inverse(mat3(world_matrix))); + model_normal_matrix = transpose(inverse(mat3(model_matrix))); } else { - world_normal_matrix = mat3(world_matrix); + model_normal_matrix = mat3(model_matrix); } if (is_multimesh) { @@ -229,8 +229,8 @@ void main() { #endif //transpose matrix = transpose(matrix); - world_matrix = world_matrix * matrix; - world_normal_matrix = world_normal_matrix * mat3(matrix); + model_matrix = model_matrix * matrix; + model_normal_matrix = model_normal_matrix * mat3(matrix); } vec3 vertex = vertex_attrib; @@ -267,24 +267,24 @@ void main() { //using world coordinates #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = (world_matrix * vec4(vertex, 1.0)).xyz; + vertex = (model_matrix * vec4(vertex, 1.0)).xyz; #ifdef NORMAL_USED - normal = world_normal_matrix * normal; + normal = model_normal_matrix * normal; #endif #if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) - tangent = world_normal_matrix * tangent; - binormal = world_normal_matrix * binormal; + tangent = model_normal_matrix * tangent; + binormal = model_normal_matrix * binormal; #endif #endif float roughness = 1.0; - mat4 modelview = scene_data.inv_camera_matrix * world_matrix; - mat3 modelview_normal = mat3(scene_data.inv_camera_matrix) * world_normal_matrix; + mat4 modelview = scene_data.view_matrix * model_matrix; + mat3 modelview_normal = mat3(scene_data.view_matrix) * model_normal_matrix; { #CODE : VERTEX @@ -309,14 +309,14 @@ void main() { //using world coordinates #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = (scene_data.inv_camera_matrix * vec4(vertex, 1.0)).xyz; + vertex = (scene_data.view_matrix * vec4(vertex, 1.0)).xyz; #ifdef NORMAL_USED - normal = (scene_data.inv_camera_matrix * vec4(normal, 0.0)).xyz; + normal = (scene_data.view_matrix * vec4(normal, 0.0)).xyz; #endif #if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) - binormal = (scene_data.inv_camera_matrix * vec4(binormal, 0.0)).xyz; - tangent = (scene_data.inv_camera_matrix * vec4(tangent, 0.0)).xyz; + binormal = (scene_data.view_matrix * vec4(binormal, 0.0)).xyz; + tangent = (scene_data.view_matrix * vec4(tangent, 0.0)).xyz; #endif #endif @@ -453,11 +453,13 @@ layout(location = 9) in flat uint instance_index_interp; //defines to keep compatibility with vertex -#define world_matrix instances.data[instance_index].transform +#define model_matrix instances.data[instance_index].transform #ifdef USE_MULTIVIEW #define projection_matrix scene_data.projection_matrix_view[ViewIndex] +#define inv_projection_matrix scene_data.inv_projection_matrix_view[ViewIndex] #else #define projection_matrix scene_data.projection_matrix +#define inv_projection_matrix scene_data.inv_projection_matrix #endif #if defined(ENABLE_SSS) && defined(ENABLE_TRANSMITTANCE) @@ -570,7 +572,7 @@ vec4 fog_process(vec3 vertex) { float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density)); if (abs(scene_data.fog_height_density) >= 0.0001) { - float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y; + float y = (scene_data.inv_view_matrix * vec4(vertex, 1.0)).y; float y_dist = y - scene_data.fog_height; @@ -1041,7 +1043,7 @@ void main() { if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE)) { //has lightmap capture uint index = instances.data[instance_index].gi_offset; - vec3 wnormal = mat3(scene_data.camera_matrix) * normal; + vec3 wnormal = mat3(scene_data.inv_view_matrix) * normal; const float c1 = 0.429043; const float c2 = 0.511664; const float c3 = 0.743125; @@ -1095,9 +1097,9 @@ void main() { if (sc_use_forward_gi && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_SDFGI)) { //has lightmap capture //make vertex orientation the world one, but still align to camera - vec3 cam_pos = mat3(scene_data.camera_matrix) * vertex; - vec3 cam_normal = mat3(scene_data.camera_matrix) * normal; - vec3 cam_reflection = mat3(scene_data.camera_matrix) * reflect(-view, normal); + vec3 cam_pos = mat3(scene_data.inv_view_matrix) * vertex; + vec3 cam_normal = mat3(scene_data.inv_view_matrix) * normal; + vec3 cam_reflection = mat3(scene_data.inv_view_matrix) * reflect(-view, normal); //apply y-mult cam_pos.y *= sdfgi.y_mult; @@ -1837,7 +1839,7 @@ void main() { vec3(0, -1, 0), vec3(0, 0, -1)); - vec3 cam_normal = mat3(scene_data.camera_matrix) * normalize(normal_interp); + vec3 cam_normal = mat3(scene_data.inv_view_matrix) * normalize(normal_interp); float closest_dist = -1e20; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl index 2e31503669..f2672f10e7 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl @@ -174,8 +174,8 @@ sdfgi; layout(set = 1, binding = 0, std140) uniform SceneData { mat4 projection_matrix; mat4 inv_projection_matrix; - mat4 camera_matrix; - mat4 inv_camera_matrix; + mat4 inv_view_matrix; + mat4 view_matrix; // only used for multiview mat4 projection_matrix_view[MAX_VIEWS]; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl index 0fcf449659..6911cab27b 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl @@ -122,13 +122,13 @@ void main() { bool is_multimesh = bool(draw_call.flags & INSTANCE_FLAGS_MULTIMESH); - mat4 world_matrix = draw_call.transform; + mat4 model_matrix = draw_call.transform; - mat3 world_normal_matrix; + mat3 model_normal_matrix; if (bool(draw_call.flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) { - world_normal_matrix = transpose(inverse(mat3(world_matrix))); + model_normal_matrix = transpose(inverse(mat3(model_matrix))); } else { - world_normal_matrix = mat3(world_matrix); + model_normal_matrix = mat3(model_matrix); } if (is_multimesh) { @@ -221,8 +221,8 @@ void main() { #endif //transpose matrix = transpose(matrix); - world_matrix = world_matrix * matrix; - world_normal_matrix = world_normal_matrix * mat3(matrix); + model_matrix = model_matrix * matrix; + model_normal_matrix = model_normal_matrix * mat3(matrix); } vec3 vertex = vertex_attrib; @@ -259,24 +259,24 @@ void main() { //using world coordinates #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = (world_matrix * vec4(vertex, 1.0)).xyz; + vertex = (model_matrix * vec4(vertex, 1.0)).xyz; #ifdef NORMAL_USED - normal = world_normal_matrix * normal; + normal = model_normal_matrix * normal; #endif #if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) - tangent = world_normal_matrix * tangent; - binormal = world_normal_matrix * binormal; + tangent = model_normal_matrix * tangent; + binormal = model_normal_matrix * binormal; #endif #endif float roughness = 1.0; - mat4 modelview = scene_data.inv_camera_matrix * world_matrix; - mat3 modelview_normal = mat3(scene_data.inv_camera_matrix) * world_normal_matrix; + mat4 modelview = scene_data.view_matrix * model_matrix; + mat3 modelview_normal = mat3(scene_data.view_matrix) * model_normal_matrix; { #CODE : VERTEX @@ -303,14 +303,14 @@ void main() { //using world coordinates #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) - vertex = (scene_data.inv_camera_matrix * vec4(vertex, 1.0)).xyz; + vertex = (scene_data.view_matrix * vec4(vertex, 1.0)).xyz; #ifdef NORMAL_USED - normal = (scene_data.inv_camera_matrix * vec4(normal, 0.0)).xyz; + normal = (scene_data.view_matrix * vec4(normal, 0.0)).xyz; #endif #if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) - binormal = (scene_data.inv_camera_matrix * vec4(binormal, 0.0)).xyz; - tangent = (scene_data.inv_camera_matrix * vec4(tangent, 0.0)).xyz; + binormal = (scene_data.view_matrix * vec4(binormal, 0.0)).xyz; + tangent = (scene_data.view_matrix * vec4(tangent, 0.0)).xyz; #endif #endif @@ -458,7 +458,7 @@ layout(location = 8) highp in float dp_clip; //defines to keep compatibility with vertex -#define world_matrix draw_call.transform +#define model_matrix draw_call.transform #ifdef USE_MULTIVIEW #define projection_matrix scene_data.projection_matrix_view[ViewIndex] #else @@ -560,7 +560,7 @@ vec4 fog_process(vec3 vertex) { float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density)); if (abs(scene_data.fog_height_density) >= 0.0001) { - float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y; + float y = (scene_data.inv_view_matrix * vec4(vertex, 1.0)).y; float y_dist = y - scene_data.fog_height; @@ -967,7 +967,7 @@ void main() { if (bool(draw_call.flags & INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE)) { //has lightmap capture uint index = draw_call.gi_offset; - vec3 wnormal = mat3(scene_data.camera_matrix) * normal; + vec3 wnormal = mat3(scene_data.inv_view_matrix) * normal; const float c1 = 0.429043; const float c2 = 0.511664; const float c3 = 0.743125; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl index 7a624c3b95..91ef19ab67 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl @@ -128,8 +128,8 @@ global_variables; layout(set = 1, binding = 0, std140) uniform SceneData { highp mat4 projection_matrix; highp mat4 inv_projection_matrix; - highp mat4 camera_matrix; - highp mat4 inv_camera_matrix; + highp mat4 inv_view_matrix; + highp mat4 view_matrix; // only used for multiview highp mat4 projection_matrix_view[MAX_VIEWS]; diff --git a/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.cpp b/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.cpp new file mode 100644 index 0000000000..73acc0fdd6 --- /dev/null +++ b/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.cpp @@ -0,0 +1,437 @@ +/*************************************************************************/ +/* decal_atlas_storage.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 "decal_atlas_storage.h" +#include "texture_storage.h" + +// Should be able to remove this once we move effects into their own file and include the correct effects +#include "servers/rendering/renderer_rd/renderer_storage_rd.h" + +using namespace RendererRD; + +DecalAtlasStorage *DecalAtlasStorage::singleton = nullptr; + +DecalAtlasStorage *DecalAtlasStorage::get_singleton() { + return singleton; +} + +DecalAtlasStorage::DecalAtlasStorage() { + singleton = this; + + { // default atlas texture + RD::TextureFormat tformat; + tformat.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; + tformat.width = 4; + tformat.height = 4; + tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; + tformat.texture_type = RD::TEXTURE_TYPE_2D; + + Vector<uint8_t> pv; + pv.resize(16 * 4); + + for (int i = 0; i < 16; i++) { + pv.set(i * 4 + 0, 0); + pv.set(i * 4 + 1, 0); + pv.set(i * 4 + 2, 0); + pv.set(i * 4 + 3, 255); + } + + { + //take the chance and initialize decal atlas to something + Vector<Vector<uint8_t>> vpv; + vpv.push_back(pv); + decal_atlas.texture = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); + decal_atlas.texture_srgb = decal_atlas.texture; + } + } +} + +DecalAtlasStorage::~DecalAtlasStorage() { + if (decal_atlas.textures.size()) { + ERR_PRINT("Decal Atlas: " + itos(decal_atlas.textures.size()) + " textures were not removed from the atlas."); + } + + if (decal_atlas.texture.is_valid()) { + RD::get_singleton()->free(decal_atlas.texture); + } + + singleton = nullptr; +} + +RID DecalAtlasStorage::decal_atlas_get_texture() const { + return decal_atlas.texture; +} + +RID DecalAtlasStorage::decal_atlas_get_texture_srgb() const { + return decal_atlas.texture_srgb; +} + +RID DecalAtlasStorage::decal_allocate() { + return decal_owner.allocate_rid(); +} + +void DecalAtlasStorage::decal_initialize(RID p_decal) { + decal_owner.initialize_rid(p_decal, Decal()); +} + +void DecalAtlasStorage::decal_free(RID p_rid) { + Decal *decal = decal_owner.get_or_null(p_rid); + for (int i = 0; i < RS::DECAL_TEXTURE_MAX; i++) { + if (decal->textures[i].is_valid() && TextureStorage::get_singleton()->owns_texture(decal->textures[i])) { + texture_remove_from_decal_atlas(decal->textures[i]); + } + } + decal->dependency.deleted_notify(p_rid); + decal_owner.free(p_rid); +} + +void DecalAtlasStorage::decal_set_extents(RID p_decal, const Vector3 &p_extents) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->extents = p_extents; + decal->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_AABB); +} + +void DecalAtlasStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + ERR_FAIL_INDEX(p_type, RS::DECAL_TEXTURE_MAX); + + if (decal->textures[p_type] == p_texture) { + return; + } + + ERR_FAIL_COND(p_texture.is_valid() && !TextureStorage::get_singleton()->owns_texture(p_texture)); + + if (decal->textures[p_type].is_valid() && TextureStorage::get_singleton()->owns_texture(decal->textures[p_type])) { + texture_remove_from_decal_atlas(decal->textures[p_type]); + } + + decal->textures[p_type] = p_texture; + + if (decal->textures[p_type].is_valid()) { + texture_add_to_decal_atlas(decal->textures[p_type]); + } + + decal->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_DECAL); +} + +void DecalAtlasStorage::decal_set_emission_energy(RID p_decal, float p_energy) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->emission_energy = p_energy; +} + +void DecalAtlasStorage::decal_set_albedo_mix(RID p_decal, float p_mix) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->albedo_mix = p_mix; +} + +void DecalAtlasStorage::decal_set_modulate(RID p_decal, const Color &p_modulate) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->modulate = p_modulate; +} + +void DecalAtlasStorage::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->cull_mask = p_layers; + decal->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_AABB); +} + +void DecalAtlasStorage::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->distance_fade = p_enabled; + decal->distance_fade_begin = p_begin; + decal->distance_fade_length = p_length; +} + +void DecalAtlasStorage::decal_set_fade(RID p_decal, float p_above, float p_below) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->upper_fade = p_above; + decal->lower_fade = p_below; +} + +void DecalAtlasStorage::decal_set_normal_fade(RID p_decal, float p_fade) { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND(!decal); + decal->normal_fade = p_fade; +} + +void DecalAtlasStorage::decal_atlas_mark_dirty_on_texture(RID p_texture) { + if (decal_atlas.textures.has(p_texture)) { + //belongs to decal atlas.. + + decal_atlas.dirty = true; //mark it dirty since it was most likely modified + } +} + +void DecalAtlasStorage::decal_atlas_remove_texture(RID p_texture) { + if (decal_atlas.textures.has(p_texture)) { + decal_atlas.textures.erase(p_texture); + //there is not much a point of making it dirty, just let it be. + } +} + +AABB DecalAtlasStorage::decal_get_aabb(RID p_decal) const { + Decal *decal = decal_owner.get_or_null(p_decal); + ERR_FAIL_COND_V(!decal, AABB()); + + return AABB(-decal->extents, decal->extents * 2.0); +} + +void DecalAtlasStorage::update_decal_atlas() { + EffectsRD *effects = RendererStorageRD::base_singleton->get_effects(); + + if (!decal_atlas.dirty) { + return; //nothing to do + } + + decal_atlas.dirty = false; + + if (decal_atlas.texture.is_valid()) { + RD::get_singleton()->free(decal_atlas.texture); + decal_atlas.texture = RID(); + decal_atlas.texture_srgb = RID(); + decal_atlas.texture_mipmaps.clear(); + } + + int border = 1 << decal_atlas.mipmaps; + + if (decal_atlas.textures.size()) { + //generate atlas + Vector<DecalAtlas::SortItem> itemsv; + itemsv.resize(decal_atlas.textures.size()); + int base_size = 8; + const RID *K = nullptr; + + int idx = 0; + while ((K = decal_atlas.textures.next(K))) { + DecalAtlas::SortItem &si = itemsv.write[idx]; + + Texture *src_tex = TextureStorage::get_singleton()->get_texture(*K); + + si.size.width = (src_tex->width / border) + 1; + si.size.height = (src_tex->height / border) + 1; + si.pixel_size = Size2i(src_tex->width, src_tex->height); + + if (base_size < si.size.width) { + base_size = nearest_power_of_2_templated(si.size.width); + } + + si.texture = *K; + idx++; + } + + //sort items by size + itemsv.sort(); + + //attempt to create atlas + int item_count = itemsv.size(); + DecalAtlas::SortItem *items = itemsv.ptrw(); + + int atlas_height = 0; + + while (true) { + Vector<int> v_offsetsv; + v_offsetsv.resize(base_size); + + int *v_offsets = v_offsetsv.ptrw(); + memset(v_offsets, 0, sizeof(int) * base_size); + + int max_height = 0; + + for (int i = 0; i < item_count; i++) { + //best fit + DecalAtlas::SortItem &si = items[i]; + int best_idx = -1; + int best_height = 0x7FFFFFFF; + for (int j = 0; j <= base_size - si.size.width; j++) { + int height = 0; + for (int k = 0; k < si.size.width; k++) { + int h = v_offsets[k + j]; + if (h > height) { + height = h; + if (height > best_height) { + break; //already bad + } + } + } + + if (height < best_height) { + best_height = height; + best_idx = j; + } + } + + //update + for (int k = 0; k < si.size.width; k++) { + v_offsets[k + best_idx] = best_height + si.size.height; + } + + si.pos.x = best_idx; + si.pos.y = best_height; + + if (si.pos.y + si.size.height > max_height) { + max_height = si.pos.y + si.size.height; + } + } + + if (max_height <= base_size * 2) { + atlas_height = max_height; + break; //good ratio, break; + } + + base_size *= 2; + } + + decal_atlas.size.width = base_size * border; + decal_atlas.size.height = nearest_power_of_2_templated(atlas_height * border); + + for (int i = 0; i < item_count; i++) { + DecalAtlas::Texture *t = decal_atlas.textures.getptr(items[i].texture); + t->uv_rect.position = items[i].pos * border + Vector2i(border / 2, border / 2); + t->uv_rect.size = items[i].pixel_size; + + t->uv_rect.position /= Size2(decal_atlas.size); + t->uv_rect.size /= Size2(decal_atlas.size); + } + } else { + //use border as size, so it at least has enough mipmaps + decal_atlas.size.width = border; + decal_atlas.size.height = border; + } + + //blit textures + + RD::TextureFormat tformat; + tformat.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; + tformat.width = decal_atlas.size.width; + tformat.height = decal_atlas.size.height; + tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT; + tformat.texture_type = RD::TEXTURE_TYPE_2D; + tformat.mipmaps = decal_atlas.mipmaps; + tformat.shareable_formats.push_back(RD::DATA_FORMAT_R8G8B8A8_UNORM); + tformat.shareable_formats.push_back(RD::DATA_FORMAT_R8G8B8A8_SRGB); + + decal_atlas.texture = RD::get_singleton()->texture_create(tformat, RD::TextureView()); + RD::get_singleton()->texture_clear(decal_atlas.texture, Color(0, 0, 0, 0), 0, decal_atlas.mipmaps, 0, 1); + + { + //create the framebuffer + + Size2i s = decal_atlas.size; + + for (int i = 0; i < decal_atlas.mipmaps; i++) { + DecalAtlas::MipMap mm; + mm.texture = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), decal_atlas.texture, 0, i); + Vector<RID> fb; + fb.push_back(mm.texture); + mm.fb = RD::get_singleton()->framebuffer_create(fb); + mm.size = s; + decal_atlas.texture_mipmaps.push_back(mm); + + s.width = MAX(1, s.width >> 1); + s.height = MAX(1, s.height >> 1); + } + { + //create the SRGB variant + RD::TextureView rd_view; + rd_view.format_override = RD::DATA_FORMAT_R8G8B8A8_SRGB; + decal_atlas.texture_srgb = RD::get_singleton()->texture_create_shared(rd_view, decal_atlas.texture); + } + } + + RID prev_texture; + for (int i = 0; i < decal_atlas.texture_mipmaps.size(); i++) { + const DecalAtlas::MipMap &mm = decal_atlas.texture_mipmaps[i]; + + Color clear_color(0, 0, 0, 0); + + if (decal_atlas.textures.size()) { + if (i == 0) { + Vector<Color> cc; + cc.push_back(clear_color); + + RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(mm.fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, cc); + + const RID *K = nullptr; + while ((K = decal_atlas.textures.next(K))) { + DecalAtlas::Texture *t = decal_atlas.textures.getptr(*K); + Texture *src_tex = TextureStorage::get_singleton()->get_texture(*K); + effects->copy_to_atlas_fb(src_tex->rd_texture, mm.fb, t->uv_rect, draw_list, false, t->panorama_to_dp_users > 0); + } + + RD::get_singleton()->draw_list_end(); + + prev_texture = mm.texture; + } else { + effects->copy_to_fb_rect(prev_texture, mm.fb, Rect2i(Point2i(), mm.size)); + prev_texture = mm.texture; + } + } else { + RD::get_singleton()->texture_clear(mm.texture, clear_color, 0, 1, 0, 1); + } + } +} + +void DecalAtlasStorage::texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp) { + if (!decal_atlas.textures.has(p_texture)) { + DecalAtlas::Texture t; + t.users = 1; + t.panorama_to_dp_users = p_panorama_to_dp ? 1 : 0; + decal_atlas.textures[p_texture] = t; + decal_atlas.dirty = true; + } else { + DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); + t->users++; + if (p_panorama_to_dp) { + t->panorama_to_dp_users++; + } + } +} + +void DecalAtlasStorage::texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp) { + DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); + ERR_FAIL_COND(!t); + t->users--; + if (p_panorama_to_dp) { + ERR_FAIL_COND(t->panorama_to_dp_users == 0); + t->panorama_to_dp_users--; + } + if (t->users == 0) { + decal_atlas.textures.erase(p_texture); + //do not mark it dirty, there is no need to since it remains working + } +} diff --git a/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h b/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h new file mode 100644 index 0000000000..a217a0f8b6 --- /dev/null +++ b/servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h @@ -0,0 +1,211 @@ +/*************************************************************************/ +/* decal_atlas_storage.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 DECAL_ATLAS_STORAGE_RD_H +#define DECAL_ATLAS_STORAGE_RD_H + +#include "core/templates/rid_owner.h" +#include "servers/rendering/renderer_storage.h" +#include "servers/rendering/storage/decal_atlas_storage.h" + +namespace RendererRD { + +struct DecalAtlas { + struct Texture { + int panorama_to_dp_users; + int users; + Rect2 uv_rect; + }; + + struct SortItem { + RID texture; + Size2i pixel_size; + Size2i size; + Point2i pos; + + bool operator<(const SortItem &p_item) const { + //sort larger to smaller + if (size.height == p_item.size.height) { + return size.width > p_item.size.width; + } else { + return size.height > p_item.size.height; + } + } + }; + + HashMap<RID, Texture> textures; + bool dirty = true; + int mipmaps = 5; + + RID texture; + RID texture_srgb; + struct MipMap { + RID fb; + RID texture; + Size2i size; + }; + Vector<MipMap> texture_mipmaps; + + Size2i size; +}; + +struct Decal { + Vector3 extents = Vector3(1, 1, 1); + RID textures[RS::DECAL_TEXTURE_MAX]; + float emission_energy = 1.0; + float albedo_mix = 1.0; + Color modulate = Color(1, 1, 1, 1); + uint32_t cull_mask = (1 << 20) - 1; + float upper_fade = 0.3; + float lower_fade = 0.3; + bool distance_fade = false; + float distance_fade_begin = 10; + float distance_fade_length = 1; + float normal_fade = 0.0; + + RendererStorage::Dependency dependency; +}; + +class DecalAtlasStorage : public RendererDecalAtlasStorage { +private: + static DecalAtlasStorage *singleton; + + DecalAtlas decal_atlas; + + mutable RID_Owner<Decal, true> decal_owner; + +public: + static DecalAtlasStorage *get_singleton(); + + void update_decal_atlas(); + + DecalAtlasStorage(); + virtual ~DecalAtlasStorage(); + + Decal *get_decal(RID p_rid) { return decal_owner.get_or_null(p_rid); }; + bool owns_decal(RID p_rid) { return decal_owner.owns(p_rid); }; + + RID decal_atlas_get_texture() const; + RID decal_atlas_get_texture_srgb() const; + _FORCE_INLINE_ Rect2 decal_atlas_get_texture_rect(RID p_texture) { + DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); + if (!t) { + return Rect2(); + } + + return t->uv_rect; + } + + virtual RID decal_allocate() override; + virtual void decal_initialize(RID p_decal) override; + virtual void decal_free(RID p_rid) override; + + virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override; + virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override; + virtual void decal_set_emission_energy(RID p_decal, float p_energy) override; + virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override; + virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) override; + virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override; + virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override; + virtual void decal_set_fade(RID p_decal, float p_above, float p_below) override; + virtual void decal_set_normal_fade(RID p_decal, float p_fade) override; + + void decal_atlas_mark_dirty_on_texture(RID p_texture); + void decal_atlas_remove_texture(RID p_texture); + + virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; + virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; + + _FORCE_INLINE_ Vector3 decal_get_extents(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->extents; + } + + _FORCE_INLINE_ RID decal_get_texture(RID p_decal, RS::DecalTexture p_texture) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->textures[p_texture]; + } + + _FORCE_INLINE_ Color decal_get_modulate(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->modulate; + } + + _FORCE_INLINE_ float decal_get_emission_energy(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->emission_energy; + } + + _FORCE_INLINE_ float decal_get_albedo_mix(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->albedo_mix; + } + + _FORCE_INLINE_ uint32_t decal_get_cull_mask(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->cull_mask; + } + + _FORCE_INLINE_ float decal_get_upper_fade(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->upper_fade; + } + + _FORCE_INLINE_ float decal_get_lower_fade(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->lower_fade; + } + + _FORCE_INLINE_ float decal_get_normal_fade(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->normal_fade; + } + + _FORCE_INLINE_ bool decal_is_distance_fade_enabled(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->distance_fade; + } + + _FORCE_INLINE_ float decal_get_distance_fade_begin(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->distance_fade_begin; + } + + _FORCE_INLINE_ float decal_get_distance_fade_length(RID p_decal) { + const Decal *decal = decal_owner.get_or_null(p_decal); + return decal->distance_fade_length; + } + + virtual AABB decal_get_aabb(RID p_decal) const override; +}; + +} // namespace RendererRD + +#endif // !DECAL_ATLAS_STORAGE_RD_H diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index acdaaae7a4..f1a5383295 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -29,9 +29,7 @@ /*************************************************************************/ #include "texture_storage.h" - -// only include until we have DecalStorage sorted -#include "servers/rendering/renderer_rd/renderer_storage_rd.h" +#include "decal_atlas_storage.h" using namespace RendererRD; @@ -300,12 +298,14 @@ TextureStorage::TextureStorage() { } TextureStorage::~TextureStorage() { - singleton = nullptr; - //def textures for (int i = 0; i < DEFAULT_RD_TEXTURE_MAX; i++) { - texture_free(default_rd_textures[i]); + if (default_rd_textures[i].is_valid()) { + RD::get_singleton()->free(default_rd_textures[i]); + } } + + singleton = nullptr; } bool TextureStorage::can_create_resources_async() const { @@ -330,7 +330,7 @@ void TextureStorage::texture_free(RID p_texture) { } } - RendererStorageRD::base_singleton->decal_atlas_remove_texture(p_texture); + DecalAtlasStorage::get_singleton()->decal_atlas_remove_texture(p_texture); for (int i = 0; i < t->proxies.size(); i++) { Texture *p = texture_owner.get_or_null(t->proxies[i]); @@ -929,7 +929,7 @@ void TextureStorage::texture_replace(RID p_texture, RID p_by_texture) { //delete last, so proxies can be updated texture_owner.free(p_by_texture); - RendererStorageRD::base_singleton->decal_atlas_mark_dirty_on_texture(p_texture); + DecalAtlasStorage::get_singleton()->decal_atlas_mark_dirty_on_texture(p_texture); } void TextureStorage::texture_set_size_override(RID p_texture, int p_width, int p_height) { diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 700ca7e167..0d5b98f1cb 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -1887,7 +1887,7 @@ void RendererSceneCull::_update_instance_aabb(Instance *p_instance) { } break; case RenderingServer::INSTANCE_DECAL: { - new_aabb = RSG::storage->decal_get_aabb(p_instance->base); + new_aabb = RSG::decal_atlas_storage->decal_get_aabb(p_instance->base); } break; case RenderingServer::INSTANCE_VOXEL_GI: { diff --git a/servers/rendering/renderer_storage.h b/servers/rendering/renderer_storage.h index b5d6aae718..69659aa62c 100644 --- a/servers/rendering/renderer_storage.h +++ b/servers/rendering/renderer_storage.h @@ -54,7 +54,6 @@ public: struct DependencyTracker; -protected: struct Dependency { void changed_notify(DependencyChangedNotification p_notification); void deleted_notify(const RID &p_rid); @@ -327,26 +326,6 @@ public: virtual void base_update_dependency(RID p_base, DependencyTracker *p_instance) = 0; virtual void skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) = 0; - /* DECAL API */ - - virtual RID decal_allocate() = 0; - virtual void decal_initialize(RID p_rid) = 0; - - virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0; - virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) = 0; - virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0; - virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0; - virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) = 0; - virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) = 0; - virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) = 0; - virtual void decal_set_fade(RID p_decal, float p_above, float p_below) = 0; - virtual void decal_set_normal_fade(RID p_decal, float p_fade) = 0; - - virtual AABB decal_get_aabb(RID p_decal) const = 0; - - virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0; - virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0; - /* VOXEL GI API */ virtual RID voxel_gi_allocate() = 0; diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp index af02e25cd9..d5a55c28f5 100644 --- a/servers/rendering/rendering_server_default.cpp +++ b/servers/rendering/rendering_server_default.cpp @@ -399,6 +399,7 @@ RenderingServerDefault::RenderingServerDefault(bool p_create_thread) : RSG::scene = sr; RSG::rasterizer = RendererCompositor::create(); RSG::canvas_texture_storage = RSG::rasterizer->get_canvas_texture_storage(); + RSG::decal_atlas_storage = RSG::rasterizer->get_decal_atlas_storage(); RSG::texture_storage = RSG::rasterizer->get_texture_storage(); RSG::storage = RSG::rasterizer->get_storage(); RSG::canvas_render = RSG::rasterizer->get_canvas(); diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index d75caae018..ea8e8aa056 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -385,6 +385,12 @@ public: /* DECAL API */ +#undef ServerName +#undef server_name + +#define ServerName RendererDecalAtlasStorage +#define server_name RSG::decal_atlas_storage + FUNCRIDSPLIT(decal) FUNC2(decal_set_extents, RID, const Vector3 &) @@ -399,6 +405,13 @@ public: /* BAKED LIGHT API */ +//from now on, calls forwarded to this singleton +#undef ServerName +#undef server_name + +#define ServerName RendererStorage +#define server_name RSG::storage + FUNCRIDSPLIT(voxel_gi) FUNC8(voxel_gi_allocate_data, RID, const Transform3D &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &) diff --git a/servers/rendering/rendering_server_globals.cpp b/servers/rendering/rendering_server_globals.cpp index 83aa8959c1..fb93ae7383 100644 --- a/servers/rendering/rendering_server_globals.cpp +++ b/servers/rendering/rendering_server_globals.cpp @@ -33,6 +33,7 @@ bool RenderingServerGlobals::threaded = false; RendererCanvasTextureStorage *RenderingServerGlobals::canvas_texture_storage = nullptr; +RendererDecalAtlasStorage *RenderingServerGlobals::decal_atlas_storage = nullptr; RendererTextureStorage *RenderingServerGlobals::texture_storage = nullptr; RendererStorage *RenderingServerGlobals::storage = nullptr; RendererCanvasRender *RenderingServerGlobals::canvas_render = nullptr; diff --git a/servers/rendering/rendering_server_globals.h b/servers/rendering/rendering_server_globals.h index 2bef490760..7d00318d8f 100644 --- a/servers/rendering/rendering_server_globals.h +++ b/servers/rendering/rendering_server_globals.h @@ -35,6 +35,7 @@ #include "servers/rendering/renderer_canvas_render.h" #include "servers/rendering/renderer_scene.h" #include "servers/rendering/storage/canvas_texture_storage.h" +#include "servers/rendering/storage/decal_atlas_storage.h" #include "servers/rendering/storage/texture_storage.h" class RendererCanvasCull; @@ -47,6 +48,7 @@ public: static RendererCanvasTextureStorage *canvas_texture_storage; static RendererTextureStorage *texture_storage; + static RendererDecalAtlasStorage *decal_atlas_storage; static RendererStorage *storage; static RendererCanvasRender *canvas_render; static RendererCompositor *rasterizer; diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index 9ea98dc593..f0785d4042 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -86,10 +86,10 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["vertex"].main_function = true; //builtins - shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4; - shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3; - shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); - shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_MATRIX"] = ShaderLanguage::TYPE_MAT4; + shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODEL_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3; + shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4; shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4; @@ -145,10 +145,10 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL); - shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); - shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_NORMAL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT3); - shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); - shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["MODEL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["MODEL_NORMAL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT3); + shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2); @@ -163,9 +163,9 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA_ANTIALIASING_EDGE"] = ShaderLanguage::TYPE_FLOAT; shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA_TEXTURE_COORDINATE"] = ShaderLanguage::TYPE_VEC2; - shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); - shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); - shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["MODEL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["INV_VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2); @@ -227,7 +227,7 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT; - shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); + shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["MODEL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["CANVAS_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["SCREEN_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4); diff --git a/servers/rendering/storage/decal_atlas_storage.h b/servers/rendering/storage/decal_atlas_storage.h new file mode 100644 index 0000000000..62cd76881b --- /dev/null +++ b/servers/rendering/storage/decal_atlas_storage.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* decal_atlas_storage.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 DECAL_ATLAS_STORAGE_H +#define DECAL_ATLAS_STORAGE_H + +#include "servers/rendering_server.h" + +class RendererDecalAtlasStorage { +public: + virtual ~RendererDecalAtlasStorage(){}; + + virtual RID decal_allocate() = 0; + virtual void decal_initialize(RID p_rid) = 0; + virtual void decal_free(RID p_rid) = 0; + + virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0; + virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) = 0; + virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0; + virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0; + virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) = 0; + virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) = 0; + virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) = 0; + virtual void decal_set_fade(RID p_decal, float p_above, float p_below) = 0; + virtual void decal_set_normal_fade(RID p_decal, float p_fade) = 0; + + virtual AABB decal_get_aabb(RID p_decal) const = 0; + + virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0; + virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0; +}; + +#endif // !DECAL_ATLAS_STORAGE_H diff --git a/servers/text/text_server_dummy.h b/servers/text/text_server_dummy.h new file mode 100644 index 0000000000..c603881b7c --- /dev/null +++ b/servers/text/text_server_dummy.h @@ -0,0 +1,48 @@ +/*************************************************************************/ +/* text_server_dummy.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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_SERVER_DUMMY_H +#define TEXT_SERVER_DUMMY_H + +#include "servers/text/text_server_extension.h" + +/*************************************************************************/ + +class TextServerDummy : public TextServerExtension { + GDCLASS(TextServerDummy, TextServerExtension); + _THREAD_SAFE_CLASS_ + +public: + virtual String get_name() const override { + return "Dummy"; + } +}; + +#endif // TEXT_SERVER_DUMMY_H diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 1a10161a5b..c8efacc9c5 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -31,267 +31,269 @@ #include "text_server_extension.h" void TextServerExtension::_bind_methods() { - GDVIRTUAL_BIND(_has_feature, "feature"); - GDVIRTUAL_BIND(_get_name); - GDVIRTUAL_BIND(_get_features); + GDVIRTUAL_BIND(has_feature, "feature"); + GDVIRTUAL_BIND(get_name); + GDVIRTUAL_BIND(get_features); - GDVIRTUAL_BIND(_free, "rid"); - GDVIRTUAL_BIND(_has, "rid"); - GDVIRTUAL_BIND(_load_support_data, "filename"); + GDVIRTUAL_BIND(free_rid, "rid"); + GDVIRTUAL_BIND(has, "rid"); + GDVIRTUAL_BIND(load_support_data, "filename"); - GDVIRTUAL_BIND(_get_support_data_filename); - GDVIRTUAL_BIND(_get_support_data_info); - GDVIRTUAL_BIND(_save_support_data, "filename"); + GDVIRTUAL_BIND(get_support_data_filename); + GDVIRTUAL_BIND(get_support_data_info); + GDVIRTUAL_BIND(save_support_data, "filename"); - GDVIRTUAL_BIND(_is_locale_right_to_left, "locale"); + GDVIRTUAL_BIND(is_locale_right_to_left, "locale"); - GDVIRTUAL_BIND(_name_to_tag, "name"); - GDVIRTUAL_BIND(_tag_to_name, "tag"); + GDVIRTUAL_BIND(name_to_tag, "name"); + GDVIRTUAL_BIND(tag_to_name, "tag"); /* Font interface */ - GDVIRTUAL_BIND(_create_font); + GDVIRTUAL_BIND(create_font); - GDVIRTUAL_BIND(_font_set_data, "font_rid", "data"); - GDVIRTUAL_BIND(_font_set_data_ptr, "font_rid", "data_ptr", "data_size"); + GDVIRTUAL_BIND(font_set_data, "font_rid", "data"); + GDVIRTUAL_BIND(font_set_data_ptr, "font_rid", "data_ptr", "data_size"); - GDVIRTUAL_BIND(_font_set_style, "font_rid", "style"); - GDVIRTUAL_BIND(_font_get_style, "font_rid"); + GDVIRTUAL_BIND(font_set_style, "font_rid", "style"); + GDVIRTUAL_BIND(font_get_style, "font_rid"); - GDVIRTUAL_BIND(_font_set_name, "font_rid", "name"); - GDVIRTUAL_BIND(_font_get_name, "font_rid"); + GDVIRTUAL_BIND(font_set_name, "font_rid", "name"); + GDVIRTUAL_BIND(font_get_name, "font_rid"); - GDVIRTUAL_BIND(_font_set_style_name, "font_rid", "name_style"); - GDVIRTUAL_BIND(_font_get_style_name, "font_rid"); + GDVIRTUAL_BIND(font_set_style_name, "font_rid", "name_style"); + GDVIRTUAL_BIND(font_get_style_name, "font_rid"); - GDVIRTUAL_BIND(_font_set_antialiased, "font_rid", "antialiased"); - GDVIRTUAL_BIND(_font_is_antialiased, "font_rid"); + GDVIRTUAL_BIND(font_set_antialiased, "font_rid", "antialiased"); + GDVIRTUAL_BIND(font_is_antialiased, "font_rid"); - GDVIRTUAL_BIND(_font_set_multichannel_signed_distance_field, "font_rid", "msdf"); - GDVIRTUAL_BIND(_font_is_multichannel_signed_distance_field, "font_rid"); + GDVIRTUAL_BIND(font_set_multichannel_signed_distance_field, "font_rid", "msdf"); + GDVIRTUAL_BIND(font_is_multichannel_signed_distance_field, "font_rid"); - GDVIRTUAL_BIND(_font_set_msdf_pixel_range, "font_rid", "msdf_pixel_range"); - GDVIRTUAL_BIND(_font_get_msdf_pixel_range, "font_rid"); + GDVIRTUAL_BIND(font_set_msdf_pixel_range, "font_rid", "msdf_pixel_range"); + GDVIRTUAL_BIND(font_get_msdf_pixel_range, "font_rid"); - GDVIRTUAL_BIND(_font_set_msdf_size, "font_rid", "msdf_size"); - GDVIRTUAL_BIND(_font_get_msdf_size, "font_rid"); + GDVIRTUAL_BIND(font_set_msdf_size, "font_rid", "msdf_size"); + GDVIRTUAL_BIND(font_get_msdf_size, "font_rid"); - GDVIRTUAL_BIND(_font_set_fixed_size, "font_rid", "fixed_size"); - GDVIRTUAL_BIND(_font_get_fixed_size, "font_rid"); + GDVIRTUAL_BIND(font_set_fixed_size, "font_rid", "fixed_size"); + GDVIRTUAL_BIND(font_get_fixed_size, "font_rid"); - GDVIRTUAL_BIND(_font_set_force_autohinter, "font_rid", "force_autohinter"); - GDVIRTUAL_BIND(_font_is_force_autohinter, "font_rid"); + GDVIRTUAL_BIND(font_set_force_autohinter, "font_rid", "force_autohinter"); + GDVIRTUAL_BIND(font_is_force_autohinter, "font_rid"); - GDVIRTUAL_BIND(_font_set_hinting, "font_rid", "hinting"); - GDVIRTUAL_BIND(_font_get_hinting, "font_rid"); + GDVIRTUAL_BIND(font_set_hinting, "font_rid", "hinting"); + GDVIRTUAL_BIND(font_get_hinting, "font_rid"); - GDVIRTUAL_BIND(_font_set_subpixel_positioning, "font_rid", "subpixel_positioning"); - GDVIRTUAL_BIND(_font_get_subpixel_positioning, "font_rid"); + GDVIRTUAL_BIND(font_set_subpixel_positioning, "font_rid", "subpixel_positioning"); + GDVIRTUAL_BIND(font_get_subpixel_positioning, "font_rid"); - GDVIRTUAL_BIND(_font_set_embolden, "font_rid", "strength"); - GDVIRTUAL_BIND(_font_get_embolden, "font_rid"); + GDVIRTUAL_BIND(font_set_embolden, "font_rid", "strength"); + GDVIRTUAL_BIND(font_get_embolden, "font_rid"); - GDVIRTUAL_BIND(_font_set_transform, "font_rid", "transform"); - GDVIRTUAL_BIND(_font_get_transform, "font_rid"); + GDVIRTUAL_BIND(font_set_transform, "font_rid", "transform"); + GDVIRTUAL_BIND(font_get_transform, "font_rid"); - GDVIRTUAL_BIND(_font_set_variation_coordinates, "font_rid", "variation_coordinates"); - GDVIRTUAL_BIND(_font_get_variation_coordinates, "font_rid"); + GDVIRTUAL_BIND(font_set_variation_coordinates, "font_rid", "variation_coordinates"); + GDVIRTUAL_BIND(font_get_variation_coordinates, "font_rid"); - GDVIRTUAL_BIND(_font_set_oversampling, "font_rid", "oversampling"); - GDVIRTUAL_BIND(_font_get_oversampling, "font_rid"); + GDVIRTUAL_BIND(font_set_oversampling, "font_rid", "oversampling"); + GDVIRTUAL_BIND(font_get_oversampling, "font_rid"); - GDVIRTUAL_BIND(_font_get_size_cache_list, "font_rid"); - GDVIRTUAL_BIND(_font_clear_size_cache, "font_rid"); - GDVIRTUAL_BIND(_font_remove_size_cache, "font_rid", "size"); + GDVIRTUAL_BIND(font_get_size_cache_list, "font_rid"); + GDVIRTUAL_BIND(font_clear_size_cache, "font_rid"); + GDVIRTUAL_BIND(font_remove_size_cache, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_ascent, "font_rid", "size", "ascent"); - GDVIRTUAL_BIND(_font_get_ascent, "font_rid", "size"); + GDVIRTUAL_BIND(font_set_ascent, "font_rid", "size", "ascent"); + GDVIRTUAL_BIND(font_get_ascent, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_descent, "font_rid", "size", "descent"); - GDVIRTUAL_BIND(_font_get_descent, "font_rid", "size"); + GDVIRTUAL_BIND(font_set_descent, "font_rid", "size", "descent"); + GDVIRTUAL_BIND(font_get_descent, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_underline_position, "font_rid", "size", "underline_position"); - GDVIRTUAL_BIND(_font_get_underline_position, "font_rid", "size"); + GDVIRTUAL_BIND(font_set_underline_position, "font_rid", "size", "underline_position"); + GDVIRTUAL_BIND(font_get_underline_position, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_underline_thickness, "font_rid", "size", "underline_thickness"); - GDVIRTUAL_BIND(_font_get_underline_thickness, "font_rid", "size"); + GDVIRTUAL_BIND(font_set_underline_thickness, "font_rid", "size", "underline_thickness"); + GDVIRTUAL_BIND(font_get_underline_thickness, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_scale, "font_rid", "size", "scale"); - GDVIRTUAL_BIND(_font_get_scale, "font_rid", "size"); + GDVIRTUAL_BIND(font_set_scale, "font_rid", "size", "scale"); + GDVIRTUAL_BIND(font_get_scale, "font_rid", "size"); - GDVIRTUAL_BIND(_font_set_spacing, "font_rid", "size", "spacing", "value"); - GDVIRTUAL_BIND(_font_get_spacing, "font_rid", "size", "spacing"); + GDVIRTUAL_BIND(font_set_spacing, "font_rid", "size", "spacing", "value"); + GDVIRTUAL_BIND(font_get_spacing, "font_rid", "size", "spacing"); - GDVIRTUAL_BIND(_font_get_texture_count, "font_rid", "size"); - GDVIRTUAL_BIND(_font_clear_textures, "font_rid", "size"); - GDVIRTUAL_BIND(_font_remove_texture, "font_rid", "size", "texture_index"); + GDVIRTUAL_BIND(font_get_texture_count, "font_rid", "size"); + GDVIRTUAL_BIND(font_clear_textures, "font_rid", "size"); + GDVIRTUAL_BIND(font_remove_texture, "font_rid", "size", "texture_index"); - GDVIRTUAL_BIND(_font_set_texture_image, "font_rid", "size", "texture_index", "image"); - GDVIRTUAL_BIND(_font_get_texture_image, "font_rid", "size", "texture_index"); + GDVIRTUAL_BIND(font_set_texture_image, "font_rid", "size", "texture_index", "image"); + GDVIRTUAL_BIND(font_get_texture_image, "font_rid", "size", "texture_index"); - GDVIRTUAL_BIND(_font_set_texture_offsets, "font_rid", "size", "texture_index", "offset"); - GDVIRTUAL_BIND(_font_get_texture_offsets, "font_rid", "size", "texture_index"); + GDVIRTUAL_BIND(font_set_texture_offsets, "font_rid", "size", "texture_index", "offset"); + GDVIRTUAL_BIND(font_get_texture_offsets, "font_rid", "size", "texture_index"); - GDVIRTUAL_BIND(_font_get_glyph_list, "font_rid", "size"); - GDVIRTUAL_BIND(_font_clear_glyphs, "font_rid", "size"); - GDVIRTUAL_BIND(_font_remove_glyph, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_get_glyph_list, "font_rid", "size"); + GDVIRTUAL_BIND(font_clear_glyphs, "font_rid", "size"); + GDVIRTUAL_BIND(font_remove_glyph, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_get_glyph_advance, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_set_glyph_advance, "font_rid", "size", "glyph", "advance"); + GDVIRTUAL_BIND(font_get_glyph_advance, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_set_glyph_advance, "font_rid", "size", "glyph", "advance"); - GDVIRTUAL_BIND(_font_get_glyph_offset, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_set_glyph_offset, "font_rid", "size", "glyph", "offset"); + GDVIRTUAL_BIND(font_get_glyph_offset, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_set_glyph_offset, "font_rid", "size", "glyph", "offset"); - GDVIRTUAL_BIND(_font_get_glyph_size, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_set_glyph_size, "font_rid", "size", "glyph", "gl_size"); + GDVIRTUAL_BIND(font_get_glyph_size, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_set_glyph_size, "font_rid", "size", "glyph", "gl_size"); - GDVIRTUAL_BIND(_font_get_glyph_uv_rect, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_set_glyph_uv_rect, "font_rid", "size", "glyph", "uv_rect"); + GDVIRTUAL_BIND(font_get_glyph_uv_rect, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_set_glyph_uv_rect, "font_rid", "size", "glyph", "uv_rect"); - GDVIRTUAL_BIND(_font_get_glyph_texture_idx, "font_rid", "size", "glyph"); - GDVIRTUAL_BIND(_font_set_glyph_texture_idx, "font_rid", "size", "glyph", "texture_idx"); + GDVIRTUAL_BIND(font_get_glyph_texture_idx, "font_rid", "size", "glyph"); + GDVIRTUAL_BIND(font_set_glyph_texture_idx, "font_rid", "size", "glyph", "texture_idx"); - GDVIRTUAL_BIND(_font_get_glyph_contours, "font_rid", "size", "index"); + GDVIRTUAL_BIND(font_get_glyph_contours, "font_rid", "size", "index"); - GDVIRTUAL_BIND(_font_get_kerning_list, "font_rid", "size"); - GDVIRTUAL_BIND(_font_clear_kerning_map, "font_rid", "size"); - GDVIRTUAL_BIND(_font_remove_kerning, "font_rid", "size", "glyph_pair"); + GDVIRTUAL_BIND(font_get_kerning_list, "font_rid", "size"); + GDVIRTUAL_BIND(font_clear_kerning_map, "font_rid", "size"); + GDVIRTUAL_BIND(font_remove_kerning, "font_rid", "size", "glyph_pair"); - GDVIRTUAL_BIND(_font_set_kerning, "font_rid", "size", "glyph_pair", "kerning"); - GDVIRTUAL_BIND(_font_get_kerning, "font_rid", "size", "glyph_pair"); + GDVIRTUAL_BIND(font_set_kerning, "font_rid", "size", "glyph_pair", "kerning"); + GDVIRTUAL_BIND(font_get_kerning, "font_rid", "size", "glyph_pair"); - GDVIRTUAL_BIND(_font_get_glyph_index, "font_rid", "size", "char", "variation_selector"); + GDVIRTUAL_BIND(font_get_glyph_index, "font_rid", "size", "char", "variation_selector"); - GDVIRTUAL_BIND(_font_has_char, "font_rid", "char"); - GDVIRTUAL_BIND(_font_get_supported_chars, "font_rid"); + GDVIRTUAL_BIND(font_has_char, "font_rid", "char"); + GDVIRTUAL_BIND(font_get_supported_chars, "font_rid"); - GDVIRTUAL_BIND(_font_render_range, "font_rid", "size", "start", "end"); - GDVIRTUAL_BIND(_font_render_glyph, "font_rid", "size", "index"); + GDVIRTUAL_BIND(font_render_range, "font_rid", "size", "start", "end"); + GDVIRTUAL_BIND(font_render_glyph, "font_rid", "size", "index"); - GDVIRTUAL_BIND(_font_draw_glyph, "font_rid", "canvas", "size", "pos", "index", "color"); - GDVIRTUAL_BIND(_font_draw_glyph_outline, "font_rid", "canvas", "size", "outline_size", "pos", "index", "color"); + GDVIRTUAL_BIND(font_draw_glyph, "font_rid", "canvas", "size", "pos", "index", "color"); + GDVIRTUAL_BIND(font_draw_glyph_outline, "font_rid", "canvas", "size", "outline_size", "pos", "index", "color"); - GDVIRTUAL_BIND(_font_is_language_supported, "font_rid", "language"); - GDVIRTUAL_BIND(_font_set_language_support_override, "font_rid", "language", "supported"); - GDVIRTUAL_BIND(_font_get_language_support_override, "font_rid", "language"); - GDVIRTUAL_BIND(_font_remove_language_support_override, "font_rid", "language"); - GDVIRTUAL_BIND(_font_get_language_support_overrides, "font_rid"); + GDVIRTUAL_BIND(font_is_language_supported, "font_rid", "language"); + GDVIRTUAL_BIND(font_set_language_support_override, "font_rid", "language", "supported"); + GDVIRTUAL_BIND(font_get_language_support_override, "font_rid", "language"); + GDVIRTUAL_BIND(font_remove_language_support_override, "font_rid", "language"); + GDVIRTUAL_BIND(font_get_language_support_overrides, "font_rid"); - GDVIRTUAL_BIND(_font_is_script_supported, "font_rid", "script"); - GDVIRTUAL_BIND(_font_set_script_support_override, "font_rid", "script", "supported"); - GDVIRTUAL_BIND(_font_get_script_support_override, "font_rid", "script"); - GDVIRTUAL_BIND(_font_remove_script_support_override, "font_rid", "script"); - GDVIRTUAL_BIND(_font_get_script_support_overrides, "font_rid"); + GDVIRTUAL_BIND(font_is_script_supported, "font_rid", "script"); + GDVIRTUAL_BIND(font_set_script_support_override, "font_rid", "script", "supported"); + GDVIRTUAL_BIND(font_get_script_support_override, "font_rid", "script"); + GDVIRTUAL_BIND(font_remove_script_support_override, "font_rid", "script"); + GDVIRTUAL_BIND(font_get_script_support_overrides, "font_rid"); - GDVIRTUAL_BIND(_font_set_opentype_feature_overrides, "font_rid", "overrides"); - GDVIRTUAL_BIND(_font_get_opentype_feature_overrides, "font_rid"); + GDVIRTUAL_BIND(font_set_opentype_feature_overrides, "font_rid", "overrides"); + GDVIRTUAL_BIND(font_get_opentype_feature_overrides, "font_rid"); - GDVIRTUAL_BIND(_font_supported_feature_list, "font_rid"); - GDVIRTUAL_BIND(_font_supported_variation_list, "font_rid"); + GDVIRTUAL_BIND(font_supported_feature_list, "font_rid"); + GDVIRTUAL_BIND(font_supported_variation_list, "font_rid"); - GDVIRTUAL_BIND(_font_get_global_oversampling); - GDVIRTUAL_BIND(_font_set_global_oversampling, "oversampling"); + GDVIRTUAL_BIND(font_get_global_oversampling); + GDVIRTUAL_BIND(font_set_global_oversampling, "oversampling"); - GDVIRTUAL_BIND(_get_hex_code_box_size, "size", "index"); - GDVIRTUAL_BIND(_draw_hex_code_box, "canvas", "size", "pos", "index", "color"); + GDVIRTUAL_BIND(get_hex_code_box_size, "size", "index"); + GDVIRTUAL_BIND(draw_hex_code_box, "canvas", "size", "pos", "index", "color"); /* Shaped text buffer interface */ - GDVIRTUAL_BIND(_create_shaped_text, "direction", "orientation"); + GDVIRTUAL_BIND(create_shaped_text, "direction", "orientation"); - GDVIRTUAL_BIND(_shaped_text_clear, "shaped"); + GDVIRTUAL_BIND(shaped_text_clear, "shaped"); - GDVIRTUAL_BIND(_shaped_text_set_direction, "shaped", "direction"); - GDVIRTUAL_BIND(_shaped_text_get_direction, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_inferred_direction, "shaped"); + GDVIRTUAL_BIND(shaped_text_set_direction, "shaped", "direction"); + GDVIRTUAL_BIND(shaped_text_get_direction, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_inferred_direction, "shaped"); - GDVIRTUAL_BIND(_shaped_text_set_bidi_override, "shaped", "override"); + GDVIRTUAL_BIND(shaped_text_set_bidi_override, "shaped", "override"); - GDVIRTUAL_BIND(_shaped_text_set_custom_punctuation, "shaped", "punct"); - GDVIRTUAL_BIND(_shaped_text_get_custom_punctuation, "shaped"); + GDVIRTUAL_BIND(shaped_text_set_custom_punctuation, "shaped", "punct"); + GDVIRTUAL_BIND(shaped_text_get_custom_punctuation, "shaped"); - GDVIRTUAL_BIND(_shaped_text_set_orientation, "shaped", "orientation"); - GDVIRTUAL_BIND(_shaped_text_get_orientation, "shaped"); + GDVIRTUAL_BIND(shaped_text_set_orientation, "shaped", "orientation"); + GDVIRTUAL_BIND(shaped_text_get_orientation, "shaped"); - GDVIRTUAL_BIND(_shaped_text_set_preserve_invalid, "shaped", "enabled"); - GDVIRTUAL_BIND(_shaped_text_get_preserve_invalid, "shaped"); + GDVIRTUAL_BIND(shaped_text_set_preserve_invalid, "shaped", "enabled"); + GDVIRTUAL_BIND(shaped_text_get_preserve_invalid, "shaped"); - GDVIRTUAL_BIND(_shaped_text_set_preserve_control, "shaped", "enabled"); - GDVIRTUAL_BIND(_shaped_text_get_preserve_control, "shaped"); + GDVIRTUAL_BIND(shaped_text_set_preserve_control, "shaped", "enabled"); + GDVIRTUAL_BIND(shaped_text_get_preserve_control, "shaped"); - GDVIRTUAL_BIND(_shaped_text_add_string, "shaped", "text", "fonts", "size", "opentype_features", "language", "meta"); - GDVIRTUAL_BIND(_shaped_text_add_object, "shaped", "key", "size", "inline_align", "length"); - GDVIRTUAL_BIND(_shaped_text_resize_object, "shaped", "key", "size", "inline_align"); + GDVIRTUAL_BIND(shaped_text_add_string, "shaped", "text", "fonts", "size", "opentype_features", "language", "meta"); + GDVIRTUAL_BIND(shaped_text_add_object, "shaped", "key", "size", "inline_align", "length"); + GDVIRTUAL_BIND(shaped_text_resize_object, "shaped", "key", "size", "inline_align"); - GDVIRTUAL_BIND(_shaped_get_span_count, "shaped"); - GDVIRTUAL_BIND(_shaped_get_span_meta, "shaped", "index"); - GDVIRTUAL_BIND(_shaped_set_span_update_font, "shaped", "index", "fonts", "size", "opentype_features"); + GDVIRTUAL_BIND(shaped_get_span_count, "shaped"); + GDVIRTUAL_BIND(shaped_get_span_meta, "shaped", "index"); + GDVIRTUAL_BIND(shaped_set_span_update_font, "shaped", "index", "fonts", "size", "opentype_features"); - GDVIRTUAL_BIND(_shaped_text_substr, "shaped", "start", "length"); - GDVIRTUAL_BIND(_shaped_text_get_parent, "shaped"); + GDVIRTUAL_BIND(shaped_text_substr, "shaped", "start", "length"); + GDVIRTUAL_BIND(shaped_text_get_parent, "shaped"); - GDVIRTUAL_BIND(_shaped_text_fit_to_width, "shaped", "width", "jst_flags"); - GDVIRTUAL_BIND(_shaped_text_tab_align, "shaped", "tab_stops"); + GDVIRTUAL_BIND(shaped_text_fit_to_width, "shaped", "width", "jst_flags"); + GDVIRTUAL_BIND(shaped_text_tab_align, "shaped", "tab_stops"); - GDVIRTUAL_BIND(_shaped_text_shape, "shaped"); - GDVIRTUAL_BIND(_shaped_text_update_breaks, "shaped"); - GDVIRTUAL_BIND(_shaped_text_update_justification_ops, "shaped"); + GDVIRTUAL_BIND(shaped_text_shape, "shaped"); + GDVIRTUAL_BIND(shaped_text_update_breaks, "shaped"); + GDVIRTUAL_BIND(shaped_text_update_justification_ops, "shaped"); - GDVIRTUAL_BIND(_shaped_text_is_ready, "shaped"); + GDVIRTUAL_BIND(shaped_text_is_ready, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_glyphs, "shaped"); - GDVIRTUAL_BIND(_shaped_text_sort_logical, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_glyph_count, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_glyphs, "shaped"); + GDVIRTUAL_BIND(shaped_text_sort_logical, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_glyph_count, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_range, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_range, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_line_breaks_adv, "shaped", "width", "start", "once", "break_flags"); - GDVIRTUAL_BIND(_shaped_text_get_line_breaks, "shaped", "width", "start", "break_flags"); - GDVIRTUAL_BIND(_shaped_text_get_word_breaks, "shaped", "grapheme_flags"); + GDVIRTUAL_BIND(shaped_text_get_line_breaks_adv, "shaped", "width", "start", "once", "break_flags"); + GDVIRTUAL_BIND(shaped_text_get_line_breaks, "shaped", "width", "start", "break_flags"); + GDVIRTUAL_BIND(shaped_text_get_word_breaks, "shaped", "grapheme_flags"); - GDVIRTUAL_BIND(_shaped_text_get_trim_pos, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_ellipsis_pos, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_ellipsis_glyph_count, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_ellipsis_glyphs, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_trim_pos, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_ellipsis_pos, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_ellipsis_glyph_count, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_ellipsis_glyphs, "shaped"); - GDVIRTUAL_BIND(_shaped_text_overrun_trim_to_width, "shaped", "width", "trim_flags"); + GDVIRTUAL_BIND(shaped_text_overrun_trim_to_width, "shaped", "width", "trim_flags"); - GDVIRTUAL_BIND(_shaped_text_get_objects, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_object_rect, "shaped", "key"); + GDVIRTUAL_BIND(shaped_text_get_objects, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_object_rect, "shaped", "key"); - GDVIRTUAL_BIND(_shaped_text_get_size, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_ascent, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_descent, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_width, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_underline_position, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_underline_thickness, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_size, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_ascent, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_descent, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_width, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_underline_position, "shaped"); + GDVIRTUAL_BIND(shaped_text_get_underline_thickness, "shaped"); - GDVIRTUAL_BIND(_shaped_text_get_dominant_direction_in_range, "shaped", "start", "end"); + GDVIRTUAL_BIND(shaped_text_get_dominant_direction_in_range, "shaped", "start", "end"); - GDVIRTUAL_BIND(_shaped_text_get_carets, "shaped", "position", "caret"); - GDVIRTUAL_BIND(_shaped_text_get_selection, "shaped", "start", "end"); + GDVIRTUAL_BIND(shaped_text_get_carets, "shaped", "position", "caret"); + GDVIRTUAL_BIND(shaped_text_get_selection, "shaped", "start", "end"); - GDVIRTUAL_BIND(_shaped_text_hit_test_grapheme, "shaped", "coord"); - GDVIRTUAL_BIND(_shaped_text_hit_test_position, "shaped", "coord"); + GDVIRTUAL_BIND(shaped_text_hit_test_grapheme, "shaped", "coord"); + GDVIRTUAL_BIND(shaped_text_hit_test_position, "shaped", "coord"); - GDVIRTUAL_BIND(_shaped_text_draw, "shaped", "canvas", "pos", "clip_l", "clip_r", "color"); - GDVIRTUAL_BIND(_shaped_text_draw_outline, "shaped", "canvas", "pos", "clip_l", "clip_r", "outline_size", "color"); + GDVIRTUAL_BIND(shaped_text_draw, "shaped", "canvas", "pos", "clip_l", "clip_r", "color"); + GDVIRTUAL_BIND(shaped_text_draw_outline, "shaped", "canvas", "pos", "clip_l", "clip_r", "outline_size", "color"); - GDVIRTUAL_BIND(_shaped_text_get_grapheme_bounds, "shaped", "pos"); - GDVIRTUAL_BIND(_shaped_text_next_grapheme_pos, "shaped", "pos"); - GDVIRTUAL_BIND(_shaped_text_prev_grapheme_pos, "shaped", "pos"); + GDVIRTUAL_BIND(shaped_text_get_grapheme_bounds, "shaped", "pos"); + GDVIRTUAL_BIND(shaped_text_next_grapheme_pos, "shaped", "pos"); + GDVIRTUAL_BIND(shaped_text_prev_grapheme_pos, "shaped", "pos"); - GDVIRTUAL_BIND(_format_number, "string", "language"); - GDVIRTUAL_BIND(_parse_number, "string", "language"); - GDVIRTUAL_BIND(_percent_sign, "language"); + GDVIRTUAL_BIND(format_number, "string", "language"); + GDVIRTUAL_BIND(parse_number, "string", "language"); + GDVIRTUAL_BIND(percent_sign, "language"); - GDVIRTUAL_BIND(_string_to_upper, "string", "language"); - GDVIRTUAL_BIND(_string_to_lower, "string", "language"); + GDVIRTUAL_BIND(strip_diacritics, "string"); + + GDVIRTUAL_BIND(string_to_upper, "string", "language"); + GDVIRTUAL_BIND(string_to_lower, "string", "language"); } bool TextServerExtension::has_feature(Feature p_feature) const { bool ret; - if (GDVIRTUAL_CALL(_has_feature, p_feature, ret)) { + if (GDVIRTUAL_CALL(has_feature, p_feature, ret)) { return ret; } return false; @@ -299,27 +301,27 @@ bool TextServerExtension::has_feature(Feature p_feature) const { String TextServerExtension::get_name() const { String ret; - if (GDVIRTUAL_CALL(_get_name, ret)) { + if (GDVIRTUAL_CALL(get_name, ret)) { return ret; } return "Unknown"; } -uint32_t TextServerExtension::get_features() const { - uint32_t ret; - if (GDVIRTUAL_CALL(_get_features, ret)) { +int64_t TextServerExtension::get_features() const { + int64_t ret; + if (GDVIRTUAL_CALL(get_features, ret)) { return ret; } return 0; } -void TextServerExtension::free(RID p_rid) { - GDVIRTUAL_CALL(_free, p_rid); +void TextServerExtension::free_rid(const RID &p_rid) { + GDVIRTUAL_CALL(free_rid, p_rid); } -bool TextServerExtension::has(RID p_rid) { +bool TextServerExtension::has(const RID &p_rid) { bool ret; - if (GDVIRTUAL_CALL(_has, p_rid, ret)) { + if (GDVIRTUAL_CALL(has, p_rid, ret)) { return ret; } return false; @@ -327,7 +329,7 @@ bool TextServerExtension::has(RID p_rid) { bool TextServerExtension::load_support_data(const String &p_filename) { bool ret; - if (GDVIRTUAL_CALL(_load_support_data, p_filename, ret)) { + if (GDVIRTUAL_CALL(load_support_data, p_filename, ret)) { return ret; } return false; @@ -335,7 +337,7 @@ bool TextServerExtension::load_support_data(const String &p_filename) { String TextServerExtension::get_support_data_filename() const { String ret; - if (GDVIRTUAL_CALL(_get_support_data_filename, ret)) { + if (GDVIRTUAL_CALL(get_support_data_filename, ret)) { return ret; } return String(); @@ -343,7 +345,7 @@ String TextServerExtension::get_support_data_filename() const { String TextServerExtension::get_support_data_info() const { String ret; - if (GDVIRTUAL_CALL(_get_support_data_info, ret)) { + if (GDVIRTUAL_CALL(get_support_data_info, ret)) { return ret; } return String(); @@ -351,7 +353,7 @@ String TextServerExtension::get_support_data_info() const { bool TextServerExtension::save_support_data(const String &p_filename) const { bool ret; - if (GDVIRTUAL_CALL(_save_support_data, p_filename, ret)) { + if (GDVIRTUAL_CALL(save_support_data, p_filename, ret)) { return ret; } return false; @@ -359,23 +361,23 @@ bool TextServerExtension::save_support_data(const String &p_filename) const { bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const { bool ret; - if (GDVIRTUAL_CALL(_is_locale_right_to_left, p_locale, ret)) { + if (GDVIRTUAL_CALL(is_locale_right_to_left, p_locale, ret)) { return ret; } return false; } -int32_t TextServerExtension::name_to_tag(const String &p_name) const { - int32_t ret; - if (GDVIRTUAL_CALL(_name_to_tag, p_name, ret)) { +int64_t TextServerExtension::name_to_tag(const String &p_name) const { + int64_t ret; + if (GDVIRTUAL_CALL(name_to_tag, p_name, ret)) { return ret; } return 0; } -String TextServerExtension::tag_to_name(int32_t p_tag) const { +String TextServerExtension::tag_to_name(int64_t p_tag) const { String ret; - if (GDVIRTUAL_CALL(_tag_to_name, p_tag, ret)) { + if (GDVIRTUAL_CALL(tag_to_name, p_tag, ret)) { return ret; } return ""; @@ -387,594 +389,594 @@ String TextServerExtension::tag_to_name(int32_t p_tag) const { RID TextServerExtension::create_font() { RID ret; - if (GDVIRTUAL_CALL(_create_font, ret)) { + if (GDVIRTUAL_CALL(create_font, ret)) { return ret; } return RID(); } -void TextServerExtension::font_set_data(RID p_font_rid, const PackedByteArray &p_data) { - GDVIRTUAL_CALL(_font_set_data, p_font_rid, p_data); +void TextServerExtension::font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { + GDVIRTUAL_CALL(font_set_data, p_font_rid, p_data); } -void TextServerExtension::font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) { - GDVIRTUAL_CALL(_font_set_data_ptr, p_font_rid, p_data_ptr, p_data_size); +void TextServerExtension::font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) { + GDVIRTUAL_CALL(font_set_data_ptr, p_font_rid, p_data_ptr, p_data_size); } -void TextServerExtension::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) { - GDVIRTUAL_CALL(_font_set_style, p_font_rid, p_style); +void TextServerExtension::font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) { + GDVIRTUAL_CALL(font_set_style, p_font_rid, p_style); } -uint32_t /*FontStyle*/ TextServerExtension::font_get_style(RID p_font_rid) const { - uint32_t ret; - if (GDVIRTUAL_CALL(_font_get_style, p_font_rid, ret)) { +int64_t /*FontStyle*/ TextServerExtension::font_get_style(const RID &p_font_rid) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_style, p_font_rid, ret)) { return ret; } return 0; } -void TextServerExtension::font_set_style_name(RID p_font_rid, const String &p_name) { - GDVIRTUAL_CALL(_font_set_style_name, p_font_rid, p_name); +void TextServerExtension::font_set_style_name(const RID &p_font_rid, const String &p_name) { + GDVIRTUAL_CALL(font_set_style_name, p_font_rid, p_name); } -String TextServerExtension::font_get_style_name(RID p_font_rid) const { +String TextServerExtension::font_get_style_name(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_style_name, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_style_name, p_font_rid, ret)) { return ret; } return String(); } -void TextServerExtension::font_set_name(RID p_font_rid, const String &p_name) { - GDVIRTUAL_CALL(_font_set_name, p_font_rid, p_name); +void TextServerExtension::font_set_name(const RID &p_font_rid, const String &p_name) { + GDVIRTUAL_CALL(font_set_name, p_font_rid, p_name); } -String TextServerExtension::font_get_name(RID p_font_rid) const { +String TextServerExtension::font_get_name(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_name, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_name, p_font_rid, ret)) { return ret; } return String(); } -void TextServerExtension::font_set_antialiased(RID p_font_rid, bool p_antialiased) { - GDVIRTUAL_CALL(_font_set_antialiased, p_font_rid, p_antialiased); +void TextServerExtension::font_set_antialiased(const RID &p_font_rid, bool p_antialiased) { + GDVIRTUAL_CALL(font_set_antialiased, p_font_rid, p_antialiased); } -bool TextServerExtension::font_is_antialiased(RID p_font_rid) const { +bool TextServerExtension::font_is_antialiased(const RID &p_font_rid) const { bool ret; - if (GDVIRTUAL_CALL(_font_is_antialiased, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_is_antialiased, p_font_rid, ret)) { return ret; } return false; } -void TextServerExtension::font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) { - GDVIRTUAL_CALL(_font_set_multichannel_signed_distance_field, p_font_rid, p_msdf); +void TextServerExtension::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { + GDVIRTUAL_CALL(font_set_multichannel_signed_distance_field, p_font_rid, p_msdf); } -bool TextServerExtension::font_is_multichannel_signed_distance_field(RID p_font_rid) const { +bool TextServerExtension::font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { bool ret; - if (GDVIRTUAL_CALL(_font_is_multichannel_signed_distance_field, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_is_multichannel_signed_distance_field, p_font_rid, ret)) { return ret; } return false; } -void TextServerExtension::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) { - GDVIRTUAL_CALL(_font_set_msdf_pixel_range, p_font_rid, p_msdf_pixel_range); +void TextServerExtension::font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { + GDVIRTUAL_CALL(font_set_msdf_pixel_range, p_font_rid, p_msdf_pixel_range); } -int TextServerExtension::font_get_msdf_pixel_range(RID p_font_rid) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_msdf_pixel_range, p_font_rid, ret)) { +int64_t TextServerExtension::font_get_msdf_pixel_range(const RID &p_font_rid) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_msdf_pixel_range, p_font_rid, ret)) { return ret; } return 0; } -void TextServerExtension::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { - GDVIRTUAL_CALL(_font_set_msdf_size, p_font_rid, p_msdf_size); +void TextServerExtension::font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { + GDVIRTUAL_CALL(font_set_msdf_size, p_font_rid, p_msdf_size); } -int TextServerExtension::font_get_msdf_size(RID p_font_rid) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_msdf_size, p_font_rid, ret)) { +int64_t TextServerExtension::font_get_msdf_size(const RID &p_font_rid) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_msdf_size, p_font_rid, ret)) { return ret; } return 0; } -void TextServerExtension::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { - GDVIRTUAL_CALL(_font_set_fixed_size, p_font_rid, p_fixed_size); +void TextServerExtension::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { + GDVIRTUAL_CALL(font_set_fixed_size, p_font_rid, p_fixed_size); } -int TextServerExtension::font_get_fixed_size(RID p_font_rid) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_fixed_size, p_font_rid, ret)) { +int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_fixed_size, p_font_rid, ret)) { return ret; } return 0; } -void TextServerExtension::font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) { - GDVIRTUAL_CALL(_font_set_force_autohinter, p_font_rid, p_force_autohinter); +void TextServerExtension::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { + GDVIRTUAL_CALL(font_set_force_autohinter, p_font_rid, p_force_autohinter); } -bool TextServerExtension::font_is_force_autohinter(RID p_font_rid) const { +bool TextServerExtension::font_is_force_autohinter(const RID &p_font_rid) const { bool ret; - if (GDVIRTUAL_CALL(_font_is_force_autohinter, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_is_force_autohinter, p_font_rid, ret)) { return ret; } return false; } -void TextServerExtension::font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) { - GDVIRTUAL_CALL(_font_set_hinting, p_font_rid, p_hinting); +void TextServerExtension::font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { + GDVIRTUAL_CALL(font_set_hinting, p_font_rid, p_hinting); } -TextServer::Hinting TextServerExtension::font_get_hinting(RID p_font_rid) const { +TextServer::Hinting TextServerExtension::font_get_hinting(const RID &p_font_rid) const { TextServer::Hinting ret; - if (GDVIRTUAL_CALL(_font_get_hinting, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_hinting, p_font_rid, ret)) { return (TextServer::Hinting)ret; } return TextServer::Hinting::HINTING_NONE; } -void TextServerExtension::font_set_subpixel_positioning(RID p_font_rid, TextServer::SubpixelPositioning p_subpixel) { - GDVIRTUAL_CALL(_font_set_subpixel_positioning, p_font_rid, p_subpixel); +void TextServerExtension::font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { + GDVIRTUAL_CALL(font_set_subpixel_positioning, p_font_rid, p_subpixel); } -TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioning(RID p_font_rid) const { +TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioning(const RID &p_font_rid) const { TextServer::SubpixelPositioning ret; - if (GDVIRTUAL_CALL(_font_get_subpixel_positioning, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_subpixel_positioning, p_font_rid, ret)) { return (TextServer::SubpixelPositioning)ret; } return TextServer::SubpixelPositioning::SUBPIXEL_POSITIONING_DISABLED; } -void TextServerExtension::font_set_embolden(RID p_font_rid, float p_strength) { - GDVIRTUAL_CALL(_font_set_embolden, p_font_rid, p_strength); +void TextServerExtension::font_set_embolden(const RID &p_font_rid, double p_strength) { + GDVIRTUAL_CALL(font_set_embolden, p_font_rid, p_strength); } -float TextServerExtension::font_get_embolden(RID p_font_rid) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_embolden, p_font_rid, ret)) { +double TextServerExtension::font_get_embolden(const RID &p_font_rid) const { + double ret; + if (GDVIRTUAL_CALL(font_get_embolden, p_font_rid, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_transform(RID p_font_rid, Transform2D p_transform) { - GDVIRTUAL_CALL(_font_set_transform, p_font_rid, p_transform); +void TextServerExtension::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { + GDVIRTUAL_CALL(font_set_transform, p_font_rid, p_transform); } -Transform2D TextServerExtension::font_get_transform(RID p_font_rid) const { +Transform2D TextServerExtension::font_get_transform(const RID &p_font_rid) const { Transform2D ret; - if (GDVIRTUAL_CALL(_font_get_transform, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_transform, p_font_rid, ret)) { return ret; } return Transform2D(); } -void TextServerExtension::font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) { - GDVIRTUAL_CALL(_font_set_variation_coordinates, p_font_rid, p_variation_coordinates); +void TextServerExtension::font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { + GDVIRTUAL_CALL(font_set_variation_coordinates, p_font_rid, p_variation_coordinates); } -Dictionary TextServerExtension::font_get_variation_coordinates(RID p_font_rid) const { +Dictionary TextServerExtension::font_get_variation_coordinates(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_variation_coordinates, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_variation_coordinates, p_font_rid, ret)) { return ret; } return Dictionary(); } -void TextServerExtension::font_set_oversampling(RID p_font_rid, float p_oversampling) { - GDVIRTUAL_CALL(_font_set_oversampling, p_font_rid, p_oversampling); +void TextServerExtension::font_set_oversampling(const RID &p_font_rid, double p_oversampling) { + GDVIRTUAL_CALL(font_set_oversampling, p_font_rid, p_oversampling); } -float TextServerExtension::font_get_oversampling(RID p_font_rid) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_oversampling, p_font_rid, ret)) { +double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const { + double ret; + if (GDVIRTUAL_CALL(font_get_oversampling, p_font_rid, ret)) { return ret; } - return 0.f; + return 0.0; } -Array TextServerExtension::font_get_size_cache_list(RID p_font_rid) const { +Array TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const { Array ret; - if (GDVIRTUAL_CALL(_font_get_size_cache_list, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_size_cache_list, p_font_rid, ret)) { return ret; } return Array(); } -void TextServerExtension::font_clear_size_cache(RID p_font_rid) { - GDVIRTUAL_CALL(_font_clear_size_cache, p_font_rid); +void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) { + GDVIRTUAL_CALL(font_clear_size_cache, p_font_rid); } -void TextServerExtension::font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_remove_size_cache, p_font_rid, p_size); +void TextServerExtension::font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { + GDVIRTUAL_CALL(font_remove_size_cache, p_font_rid, p_size); } -void TextServerExtension::font_set_ascent(RID p_font_rid, int p_size, float p_ascent) { - GDVIRTUAL_CALL(_font_set_ascent, p_font_rid, p_size, p_ascent); +void TextServerExtension::font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { + GDVIRTUAL_CALL(font_set_ascent, p_font_rid, p_size, p_ascent); } -float TextServerExtension::font_get_ascent(RID p_font_rid, int p_size) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_ascent, p_font_rid, p_size, ret)) { +double TextServerExtension::font_get_ascent(const RID &p_font_rid, int64_t p_size) const { + double ret; + if (GDVIRTUAL_CALL(font_get_ascent, p_font_rid, p_size, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_descent(RID p_font_rid, int p_size, float p_descent) { - GDVIRTUAL_CALL(_font_set_descent, p_font_rid, p_size, p_descent); +void TextServerExtension::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { + GDVIRTUAL_CALL(font_set_descent, p_font_rid, p_size, p_descent); } -float TextServerExtension::font_get_descent(RID p_font_rid, int p_size) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_descent, p_font_rid, p_size, ret)) { +double TextServerExtension::font_get_descent(const RID &p_font_rid, int64_t p_size) const { + double ret; + if (GDVIRTUAL_CALL(font_get_descent, p_font_rid, p_size, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) { - GDVIRTUAL_CALL(_font_set_underline_position, p_font_rid, p_size, p_underline_position); +void TextServerExtension::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { + GDVIRTUAL_CALL(font_set_underline_position, p_font_rid, p_size, p_underline_position); } -float TextServerExtension::font_get_underline_position(RID p_font_rid, int p_size) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_underline_position, p_font_rid, p_size, ret)) { +double TextServerExtension::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { + double ret; + if (GDVIRTUAL_CALL(font_get_underline_position, p_font_rid, p_size, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) { - GDVIRTUAL_CALL(_font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness); +void TextServerExtension::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { + GDVIRTUAL_CALL(font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness); } -float TextServerExtension::font_get_underline_thickness(RID p_font_rid, int p_size) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret)) { +double TextServerExtension::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { + double ret; + if (GDVIRTUAL_CALL(font_get_underline_thickness, p_font_rid, p_size, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_scale(RID p_font_rid, int p_size, float p_scale) { - GDVIRTUAL_CALL(_font_set_scale, p_font_rid, p_size, p_scale); +void TextServerExtension::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { + GDVIRTUAL_CALL(font_set_scale, p_font_rid, p_size, p_scale); } -float TextServerExtension::font_get_scale(RID p_font_rid, int p_size) const { - float ret; - if (GDVIRTUAL_CALL(_font_get_scale, p_font_rid, p_size, ret)) { +double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size) const { + double ret; + if (GDVIRTUAL_CALL(font_get_scale, p_font_rid, p_size, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing, int p_value) { - GDVIRTUAL_CALL(_font_set_spacing, p_font_rid, p_size, p_spacing, p_value); +void TextServerExtension::font_set_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing, int64_t p_value) { + GDVIRTUAL_CALL(font_set_spacing, p_font_rid, p_size, p_spacing, p_value); } -int TextServerExtension::font_get_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_spacing, p_font_rid, p_size, p_spacing, ret)) { +int64_t TextServerExtension::font_get_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_spacing, p_font_rid, p_size, p_spacing, ret)) { return ret; } return 0; } -int TextServerExtension::font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_texture_count, p_font_rid, p_size, ret)) { +int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_texture_count, p_font_rid, p_size, ret)) { return ret; } return 0; } -void TextServerExtension::font_clear_textures(RID p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_clear_textures, p_font_rid, p_size); +void TextServerExtension::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { + GDVIRTUAL_CALL(font_clear_textures, p_font_rid, p_size); } -void TextServerExtension::font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) { - GDVIRTUAL_CALL(_font_remove_texture, p_font_rid, p_size, p_texture_index); +void TextServerExtension::font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { + GDVIRTUAL_CALL(font_remove_texture, p_font_rid, p_size, p_texture_index); } -void TextServerExtension::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { - GDVIRTUAL_CALL(_font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image); +void TextServerExtension::font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) { + GDVIRTUAL_CALL(font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image); } -Ref<Image> TextServerExtension::font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +Ref<Image> TextServerExtension::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { Ref<Image> ret; - if (GDVIRTUAL_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret)) { + if (GDVIRTUAL_CALL(font_get_texture_image, p_font_rid, p_size, p_texture_index, ret)) { return ret; } return Ref<Image>(); } -void TextServerExtension::font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) { - GDVIRTUAL_CALL(_font_set_texture_offsets, p_font_rid, p_size, p_texture_index, p_offset); +void TextServerExtension::font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) { + GDVIRTUAL_CALL(font_set_texture_offsets, p_font_rid, p_size, p_texture_index, p_offset); } -PackedInt32Array TextServerExtension::font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { +PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_font_get_texture_offsets, p_font_rid, p_size, p_texture_index, ret)) { + if (GDVIRTUAL_CALL(font_get_texture_offsets, p_font_rid, p_size, p_texture_index, ret)) { return ret; } return PackedInt32Array(); } -Array TextServerExtension::font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const { +Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { Array ret; - if (GDVIRTUAL_CALL(_font_get_glyph_list, p_font_rid, p_size, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_list, p_font_rid, p_size, ret)) { return ret; } return Array(); } -void TextServerExtension::font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_clear_glyphs, p_font_rid, p_size); +void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { + GDVIRTUAL_CALL(font_clear_glyphs, p_font_rid, p_size); } -void TextServerExtension::font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) { - GDVIRTUAL_CALL(_font_remove_glyph, p_font_rid, p_size, p_glyph); +void TextServerExtension::font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { + GDVIRTUAL_CALL(font_remove_glyph, p_font_rid, p_size, p_glyph); } -Vector2 TextServerExtension::font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const { +Vector2 TextServerExtension::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret)) { return ret; } return Vector2(); } -void TextServerExtension::font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) { - GDVIRTUAL_CALL(_font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance); +void TextServerExtension::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { + GDVIRTUAL_CALL(font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance); } -Vector2 TextServerExtension::font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerExtension::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret)) { return ret; } return Vector2(); } -void TextServerExtension::font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) { - GDVIRTUAL_CALL(_font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset); +void TextServerExtension::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { + GDVIRTUAL_CALL(font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset); } -Vector2 TextServerExtension::font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Vector2 TextServerExtension::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_size, p_font_rid, p_size, p_glyph, ret)) { return ret; } return Vector2(); } -void TextServerExtension::font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) { - GDVIRTUAL_CALL(_font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size); +void TextServerExtension::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { + GDVIRTUAL_CALL(font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size); } -Rect2 TextServerExtension::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { +Rect2 TextServerExtension::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Rect2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret)) { return ret; } return Rect2(); } -void TextServerExtension::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) { - GDVIRTUAL_CALL(_font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect); +void TextServerExtension::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { + GDVIRTUAL_CALL(font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect); } -int TextServerExtension::font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { - int ret; - if (GDVIRTUAL_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret)) { +int64_t TextServerExtension::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret)) { return ret; } return 0; } -void TextServerExtension::font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) { - GDVIRTUAL_CALL(_font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx); +void TextServerExtension::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { + GDVIRTUAL_CALL(font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx); } -Dictionary TextServerExtension::font_get_glyph_contours(RID p_font_rid, int p_size, int32_t p_index) const { +Dictionary TextServerExtension::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_glyph_contours, p_font_rid, p_size, p_index, ret)) { + if (GDVIRTUAL_CALL(font_get_glyph_contours, p_font_rid, p_size, p_index, ret)) { return ret; } return Dictionary(); } -Array TextServerExtension::font_get_kerning_list(RID p_font_rid, int p_size) const { +Array TextServerExtension::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { Array ret; - if (GDVIRTUAL_CALL(_font_get_kerning_list, p_font_rid, p_size, ret)) { + if (GDVIRTUAL_CALL(font_get_kerning_list, p_font_rid, p_size, ret)) { return ret; } return Array(); } -void TextServerExtension::font_clear_kerning_map(RID p_font_rid, int p_size) { - GDVIRTUAL_CALL(_font_clear_kerning_map, p_font_rid, p_size); +void TextServerExtension::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { + GDVIRTUAL_CALL(font_clear_kerning_map, p_font_rid, p_size); } -void TextServerExtension::font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) { - GDVIRTUAL_CALL(_font_remove_kerning, p_font_rid, p_size, p_glyph_pair); +void TextServerExtension::font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) { + GDVIRTUAL_CALL(font_remove_kerning, p_font_rid, p_size, p_glyph_pair); } -void TextServerExtension::font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { - GDVIRTUAL_CALL(_font_set_kerning, p_font_rid, p_size, p_glyph_pair, p_kerning); +void TextServerExtension::font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { + GDVIRTUAL_CALL(font_set_kerning, p_font_rid, p_size, p_glyph_pair, p_kerning); } -Vector2 TextServerExtension::font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const { +Vector2 TextServerExtension::font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_kerning, p_font_rid, p_size, p_glyph_pair, ret)) { + if (GDVIRTUAL_CALL(font_get_kerning, p_font_rid, p_size, p_glyph_pair, ret)) { return ret; } return Vector2(); } -int32_t TextServerExtension::font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector) const { - int32_t ret; - if (GDVIRTUAL_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret)) { +int64_t TextServerExtension::font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret)) { return ret; } return 0; } -bool TextServerExtension::font_has_char(RID p_font_rid, char32_t p_char) const { +bool TextServerExtension::font_has_char(const RID &p_font_rid, int64_t p_char) const { bool ret; - if (GDVIRTUAL_CALL(_font_has_char, p_font_rid, p_char, ret)) { + if (GDVIRTUAL_CALL(font_has_char, p_font_rid, p_char, ret)) { return ret; } return false; } -String TextServerExtension::font_get_supported_chars(RID p_font_rid) const { +String TextServerExtension::font_get_supported_chars(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_supported_chars, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_supported_chars, p_font_rid, ret)) { return ret; } return String(); } -void TextServerExtension::font_render_range(RID p_font_rid, const Vector2i &p_size, char32_t p_start, char32_t p_end) { - GDVIRTUAL_CALL(_font_render_range, p_font_rid, p_size, p_start, p_end); +void TextServerExtension::font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { + GDVIRTUAL_CALL(font_render_range, p_font_rid, p_size, p_start, p_end); } -void TextServerExtension::font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) { - GDVIRTUAL_CALL(_font_render_glyph, p_font_rid, p_size, p_index); +void TextServerExtension::font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) { + GDVIRTUAL_CALL(font_render_glyph, p_font_rid, p_size, p_index); } -void TextServerExtension::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { - GDVIRTUAL_CALL(_font_draw_glyph, p_font_rid, p_canvas, p_size, p_pos, p_index, p_color); +void TextServerExtension::font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { + GDVIRTUAL_CALL(font_draw_glyph, p_font_rid, p_canvas, p_size, p_pos, p_index, p_color); } -void TextServerExtension::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { - GDVIRTUAL_CALL(_font_draw_glyph_outline, p_font_rid, p_canvas, p_size, p_outline_size, p_pos, p_index, p_color); +void TextServerExtension::font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { + GDVIRTUAL_CALL(font_draw_glyph_outline, p_font_rid, p_canvas, p_size, p_outline_size, p_pos, p_index, p_color); } -bool TextServerExtension::font_is_language_supported(RID p_font_rid, const String &p_language) const { +bool TextServerExtension::font_is_language_supported(const RID &p_font_rid, const String &p_language) const { bool ret; - if (GDVIRTUAL_CALL(_font_is_language_supported, p_font_rid, p_language, ret)) { + if (GDVIRTUAL_CALL(font_is_language_supported, p_font_rid, p_language, ret)) { return ret; } return false; } -void TextServerExtension::font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) { - GDVIRTUAL_CALL(_font_set_language_support_override, p_font_rid, p_language, p_supported); +void TextServerExtension::font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { + GDVIRTUAL_CALL(font_set_language_support_override, p_font_rid, p_language, p_supported); } -bool TextServerExtension::font_get_language_support_override(RID p_font_rid, const String &p_language) { +bool TextServerExtension::font_get_language_support_override(const RID &p_font_rid, const String &p_language) { bool ret; - if (GDVIRTUAL_CALL(_font_get_language_support_override, p_font_rid, p_language, ret)) { + if (GDVIRTUAL_CALL(font_get_language_support_override, p_font_rid, p_language, ret)) { return ret; } return false; } -void TextServerExtension::font_remove_language_support_override(RID p_font_rid, const String &p_language) { - GDVIRTUAL_CALL(_font_remove_language_support_override, p_font_rid, p_language); +void TextServerExtension::font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { + GDVIRTUAL_CALL(font_remove_language_support_override, p_font_rid, p_language); } -Vector<String> TextServerExtension::font_get_language_support_overrides(RID p_font_rid) { - Vector<String> ret; - if (GDVIRTUAL_CALL(_font_get_language_support_overrides, p_font_rid, ret)) { +PackedStringArray TextServerExtension::font_get_language_support_overrides(const RID &p_font_rid) { + PackedStringArray ret; + if (GDVIRTUAL_CALL(font_get_language_support_overrides, p_font_rid, ret)) { return ret; } - return Vector<String>(); + return PackedStringArray(); } -bool TextServerExtension::font_is_script_supported(RID p_font_rid, const String &p_script) const { +bool TextServerExtension::font_is_script_supported(const RID &p_font_rid, const String &p_script) const { bool ret; - if (GDVIRTUAL_CALL(_font_is_script_supported, p_font_rid, p_script, ret)) { + if (GDVIRTUAL_CALL(font_is_script_supported, p_font_rid, p_script, ret)) { return ret; } return false; } -void TextServerExtension::font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) { - GDVIRTUAL_CALL(_font_set_script_support_override, p_font_rid, p_script, p_supported); +void TextServerExtension::font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { + GDVIRTUAL_CALL(font_set_script_support_override, p_font_rid, p_script, p_supported); } -bool TextServerExtension::font_get_script_support_override(RID p_font_rid, const String &p_script) { +bool TextServerExtension::font_get_script_support_override(const RID &p_font_rid, const String &p_script) { bool ret; - if (GDVIRTUAL_CALL(_font_get_script_support_override, p_font_rid, p_script, ret)) { + if (GDVIRTUAL_CALL(font_get_script_support_override, p_font_rid, p_script, ret)) { return ret; } return false; } -void TextServerExtension::font_remove_script_support_override(RID p_font_rid, const String &p_script) { - GDVIRTUAL_CALL(_font_remove_script_support_override, p_font_rid, p_script); +void TextServerExtension::font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { + GDVIRTUAL_CALL(font_remove_script_support_override, p_font_rid, p_script); } -Vector<String> TextServerExtension::font_get_script_support_overrides(RID p_font_rid) { - Vector<String> ret; - if (GDVIRTUAL_CALL(_font_get_script_support_overrides, p_font_rid, ret)) { +PackedStringArray TextServerExtension::font_get_script_support_overrides(const RID &p_font_rid) { + PackedStringArray ret; + if (GDVIRTUAL_CALL(font_get_script_support_overrides, p_font_rid, ret)) { return ret; } - return Vector<String>(); + return PackedStringArray(); } -void TextServerExtension::font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) { - GDVIRTUAL_CALL(_font_set_opentype_feature_overrides, p_font_rid, p_overrides); +void TextServerExtension::font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { + GDVIRTUAL_CALL(font_set_opentype_feature_overrides, p_font_rid, p_overrides); } -Dictionary TextServerExtension::font_get_opentype_feature_overrides(RID p_font_rid) const { +Dictionary TextServerExtension::font_get_opentype_feature_overrides(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_opentype_feature_overrides, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_get_opentype_feature_overrides, p_font_rid, ret)) { return ret; } return Dictionary(); } -Dictionary TextServerExtension::font_supported_feature_list(RID p_font_rid) const { +Dictionary TextServerExtension::font_supported_feature_list(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_supported_feature_list, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_supported_feature_list, p_font_rid, ret)) { return ret; } return Dictionary(); } -Dictionary TextServerExtension::font_supported_variation_list(RID p_font_rid) const { +Dictionary TextServerExtension::font_supported_variation_list(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_supported_variation_list, p_font_rid, ret)) { + if (GDVIRTUAL_CALL(font_supported_variation_list, p_font_rid, ret)) { return ret; } return Dictionary(); } -float TextServerExtension::font_get_global_oversampling() const { - float ret; - if (GDVIRTUAL_CALL(_font_get_global_oversampling, ret)) { +double TextServerExtension::font_get_global_oversampling() const { + double ret; + if (GDVIRTUAL_CALL(font_get_global_oversampling, ret)) { return ret; } - return 0.f; + return 0.0; } -void TextServerExtension::font_set_global_oversampling(float p_oversampling) { - GDVIRTUAL_CALL(_font_set_global_oversampling, p_oversampling); +void TextServerExtension::font_set_global_oversampling(double p_oversampling) { + GDVIRTUAL_CALL(font_set_global_oversampling, p_oversampling); } -Vector2 TextServerExtension::get_hex_code_box_size(int p_size, char32_t p_index) const { +Vector2 TextServerExtension::get_hex_code_box_size(int64_t p_size, int64_t p_index) const { Vector2 ret; - if (GDVIRTUAL_CALL(_get_hex_code_box_size, p_size, p_index, ret)) { + if (GDVIRTUAL_CALL(get_hex_code_box_size, p_size, p_index, ret)) { return ret; } return TextServer::get_hex_code_box_size(p_size, p_index); } -void TextServerExtension::draw_hex_code_box(RID p_canvas, int p_size, const Vector2 &p_pos, char32_t p_index, const Color &p_color) const { - if (!GDVIRTUAL_CALL(_draw_hex_code_box, p_canvas, p_size, p_pos, p_index, p_color)) { +void TextServerExtension::draw_hex_code_box(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { + if (!GDVIRTUAL_CALL(draw_hex_code_box, p_canvas, p_size, p_pos, p_index, p_color)) { TextServer::draw_hex_code_box(p_canvas, p_size, p_pos, p_index, p_color); } } @@ -985,433 +987,425 @@ void TextServerExtension::draw_hex_code_box(RID p_canvas, int p_size, const Vect RID TextServerExtension::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) { RID ret; - if (GDVIRTUAL_CALL(_create_shaped_text, p_direction, p_orientation, ret)) { + if (GDVIRTUAL_CALL(create_shaped_text, p_direction, p_orientation, ret)) { return ret; } return RID(); } -void TextServerExtension::shaped_text_clear(RID p_shaped) { - GDVIRTUAL_CALL(_shaped_text_clear, p_shaped); +void TextServerExtension::shaped_text_clear(const RID &p_shaped) { + GDVIRTUAL_CALL(shaped_text_clear, p_shaped); } -void TextServerExtension::shaped_text_set_direction(RID p_shaped, TextServer::Direction p_direction) { - GDVIRTUAL_CALL(_shaped_text_set_direction, p_shaped, p_direction); +void TextServerExtension::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) { + GDVIRTUAL_CALL(shaped_text_set_direction, p_shaped, p_direction); } -TextServer::Direction TextServerExtension::shaped_text_get_direction(RID p_shaped) const { +TextServer::Direction TextServerExtension::shaped_text_get_direction(const RID &p_shaped) const { TextServer::Direction ret; - if (GDVIRTUAL_CALL(_shaped_text_get_direction, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_direction, p_shaped, ret)) { return (TextServer::Direction)ret; } return TextServer::Direction::DIRECTION_AUTO; } -TextServer::Direction TextServerExtension::shaped_text_get_inferred_direction(RID p_shaped) const { +TextServer::Direction TextServerExtension::shaped_text_get_inferred_direction(const RID &p_shaped) const { TextServer::Direction ret; - if (GDVIRTUAL_CALL(_shaped_text_get_inferred_direction, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_inferred_direction, p_shaped, ret)) { return (TextServer::Direction)ret; } return TextServer::Direction::DIRECTION_LTR; } -void TextServerExtension::shaped_text_set_orientation(RID p_shaped, TextServer::Orientation p_orientation) { - GDVIRTUAL_CALL(_shaped_text_set_orientation, p_shaped, p_orientation); +void TextServerExtension::shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { + GDVIRTUAL_CALL(shaped_text_set_orientation, p_shaped, p_orientation); } -TextServer::Orientation TextServerExtension::shaped_text_get_orientation(RID p_shaped) const { +TextServer::Orientation TextServerExtension::shaped_text_get_orientation(const RID &p_shaped) const { TextServer::Orientation ret; - if (GDVIRTUAL_CALL(_shaped_text_get_orientation, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_orientation, p_shaped, ret)) { return (TextServer::Orientation)ret; } return TextServer::Orientation::ORIENTATION_HORIZONTAL; } -void TextServerExtension::shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) { - GDVIRTUAL_CALL(_shaped_text_set_bidi_override, p_shaped, p_override); +void TextServerExtension::shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) { + GDVIRTUAL_CALL(shaped_text_set_bidi_override, p_shaped, p_override); } -void TextServerExtension::shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) { - GDVIRTUAL_CALL(_shaped_text_set_custom_punctuation, p_shaped, p_punct); +void TextServerExtension::shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) { + GDVIRTUAL_CALL(shaped_text_set_custom_punctuation, p_shaped, p_punct); } -String TextServerExtension::shaped_text_get_custom_punctuation(RID p_shaped) const { +String TextServerExtension::shaped_text_get_custom_punctuation(const RID &p_shaped) const { String ret; - if (GDVIRTUAL_CALL(_shaped_text_get_custom_punctuation, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_custom_punctuation, p_shaped, ret)) { return ret; } return String(); } -void TextServerExtension::shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) { - GDVIRTUAL_CALL(_shaped_text_set_preserve_invalid, p_shaped, p_enabled); +void TextServerExtension::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) { + GDVIRTUAL_CALL(shaped_text_set_preserve_invalid, p_shaped, p_enabled); } -bool TextServerExtension::shaped_text_get_preserve_invalid(RID p_shaped) const { +bool TextServerExtension::shaped_text_get_preserve_invalid(const RID &p_shaped) const { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_get_preserve_invalid, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_preserve_invalid, p_shaped, ret)) { return ret; } return false; } -void TextServerExtension::shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) { - GDVIRTUAL_CALL(_shaped_text_set_preserve_control, p_shaped, p_enabled); +void TextServerExtension::shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { + GDVIRTUAL_CALL(shaped_text_set_preserve_control, p_shaped, p_enabled); } -bool TextServerExtension::shaped_text_get_preserve_control(RID p_shaped) const { +bool TextServerExtension::shaped_text_get_preserve_control(const RID &p_shaped) const { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_get_preserve_control, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_preserve_control, p_shaped, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { +bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { bool ret; - Array fonts; - for (int i = 0; i < p_fonts.size(); i++) { - fonts.push_back(p_fonts[i]); - } - if (GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, fonts, p_size, p_opentype_features, p_language, p_meta, ret)) { + if (GDVIRTUAL_CALL(shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) { +bool TextServerExtension::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length) { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret)) { + if (GDVIRTUAL_CALL(shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) { +bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align) { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret)) { + if (GDVIRTUAL_CALL(shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret)) { return ret; } return false; } -int TextServerExtension::shaped_get_span_count(RID p_shaped) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret)) { +int64_t TextServerExtension::shaped_get_span_count(const RID &p_shaped) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_get_span_count, p_shaped, ret)) { return ret; } return 0; } -Variant TextServerExtension::shaped_get_span_meta(RID p_shaped, int p_index) const { +Variant TextServerExtension::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { Variant ret; - if (GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret)) { + if (GDVIRTUAL_CALL(shaped_get_span_meta, p_shaped, p_index, ret)) { return ret; } return false; } -void TextServerExtension::shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features) { - Array fonts; - for (int i = 0; i < p_fonts.size(); i++) { - fonts.push_back(p_fonts[i]); - } - GDVIRTUAL_CALL(_shaped_set_span_update_font, p_shaped, p_index, fonts, p_size, p_opentype_features); +void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { + GDVIRTUAL_CALL(shaped_set_span_update_font, p_shaped, p_index, p_fonts, p_size, p_opentype_features); } -RID TextServerExtension::shaped_text_substr(RID p_shaped, int p_start, int p_length) const { +RID TextServerExtension::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { RID ret; - if (GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret)) { + if (GDVIRTUAL_CALL(shaped_text_substr, p_shaped, p_start, p_length, ret)) { return ret; } return RID(); } -RID TextServerExtension::shaped_text_get_parent(RID p_shaped) const { +RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const { RID ret; - if (GDVIRTUAL_CALL(_shaped_text_get_parent, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_parent, p_shaped, ret)) { return ret; } return RID(); } -float TextServerExtension::shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t p_jst_flags) { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) { +double TextServerExtension::shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t p_jst_flags) { + double ret; + if (GDVIRTUAL_CALL(shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) { return ret; } - return 0.f; + return 0.0; } -float TextServerExtension::shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_tab_align, p_shaped, p_tab_stops, ret)) { +double TextServerExtension::shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { + double ret; + if (GDVIRTUAL_CALL(shaped_text_tab_align, p_shaped, p_tab_stops, ret)) { return ret; } - return 0.f; + return 0.0; } -bool TextServerExtension::shaped_text_shape(RID p_shaped) { +bool TextServerExtension::shaped_text_shape(const RID &p_shaped) { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_shape, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_shape, p_shaped, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_update_breaks(RID p_shaped) { +bool TextServerExtension::shaped_text_update_breaks(const RID &p_shaped) { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_update_breaks, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_update_breaks, p_shaped, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_update_justification_ops(RID p_shaped) { +bool TextServerExtension::shaped_text_update_justification_ops(const RID &p_shaped) { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_update_justification_ops, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_update_justification_ops, p_shaped, ret)) { return ret; } return false; } -bool TextServerExtension::shaped_text_is_ready(RID p_shaped) const { +bool TextServerExtension::shaped_text_is_ready(const RID &p_shaped) const { bool ret; - if (GDVIRTUAL_CALL(_shaped_text_is_ready, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_is_ready, p_shaped, ret)) { return ret; } return false; } -const Glyph *TextServerExtension::shaped_text_get_glyphs(RID p_shaped) const { - GDNativePtr<Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret)) { +const Glyph *TextServerExtension::shaped_text_get_glyphs(const RID &p_shaped) const { + GDNativeConstPtr<const Glyph> ret; + if (GDVIRTUAL_CALL(shaped_text_get_glyphs, p_shaped, ret)) { return ret; } return nullptr; } -const Glyph *TextServerExtension::shaped_text_sort_logical(RID p_shaped) { - GDNativePtr<Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret)) { +const Glyph *TextServerExtension::shaped_text_sort_logical(const RID &p_shaped) { + GDNativeConstPtr<const Glyph> ret; + if (GDVIRTUAL_CALL(shaped_text_sort_logical, p_shaped, ret)) { return ret; } return nullptr; } -int TextServerExtension::shaped_text_get_glyph_count(RID p_shaped) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_get_glyph_count, p_shaped, ret)) { +int64_t TextServerExtension::shaped_text_get_glyph_count(const RID &p_shaped) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_glyph_count, p_shaped, ret)) { return ret; } return 0; } -Vector2i TextServerExtension::shaped_text_get_range(RID p_shaped) const { +Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const { Vector2i ret; - if (GDVIRTUAL_CALL(_shaped_text_get_range, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_range, p_shaped, ret)) { return ret; } return Vector2i(); } -PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(RID p_shaped, const PackedFloat32Array &p_width, int p_start, bool p_once, uint16_t p_break_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, int64_t p_break_flags) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_shaped_text_get_line_breaks_adv, p_shaped, p_width, p_start, p_once, p_break_flags, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_line_breaks_adv, p_shaped, p_width, p_start, p_once, p_break_flags, ret)) { return ret; } return TextServer::shaped_text_get_line_breaks_adv(p_shaped, p_width, p_start, p_once, p_break_flags); } -PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(RID p_shaped, float p_width, int p_start, uint16_t p_break_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start, int64_t p_break_flags) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_shaped_text_get_line_breaks, p_shaped, p_width, p_start, p_break_flags, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_line_breaks, p_shaped, p_width, p_start, p_break_flags, ret)) { return ret; } return TextServer::shaped_text_get_line_breaks(p_shaped, p_width, p_start, p_break_flags); } -PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_shaped_text_get_word_breaks, p_shaped, p_grapheme_flags, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_word_breaks, p_shaped, p_grapheme_flags, ret)) { return ret; } return TextServer::shaped_text_get_word_breaks(p_shaped, p_grapheme_flags); } -int TextServerExtension::shaped_text_get_trim_pos(RID p_shaped) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_get_trim_pos, p_shaped, ret)) { +int64_t TextServerExtension::shaped_text_get_trim_pos(const RID &p_shaped) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_trim_pos, p_shaped, ret)) { return ret; } return -1; } -int TextServerExtension::shaped_text_get_ellipsis_pos(RID p_shaped) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret)) { +int64_t TextServerExtension::shaped_text_get_ellipsis_pos(const RID &p_shaped) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_pos, p_shaped, ret)) { return ret; } return -1; } -const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(RID p_shaped) const { - GDNativePtr<Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret)) { +const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { + GDNativeConstPtr<const Glyph> ret; + if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_glyphs, p_shaped, ret)) { return ret; } return nullptr; } -int TextServerExtension::shaped_text_get_ellipsis_glyph_count(RID p_shaped) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret)) { +int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_glyph_count, p_shaped, ret)) { return ret; } return -1; } -void TextServerExtension::shaped_text_overrun_trim_to_width(RID p_shaped_line, float p_width, uint16_t p_trim_flags) { - GDVIRTUAL_CALL(_shaped_text_overrun_trim_to_width, p_shaped_line, p_width, p_trim_flags); +void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, int64_t p_trim_flags) { + GDVIRTUAL_CALL(shaped_text_overrun_trim_to_width, p_shaped_line, p_width, p_trim_flags); } -Array TextServerExtension::shaped_text_get_objects(RID p_shaped) const { +Array TextServerExtension::shaped_text_get_objects(const RID &p_shaped) const { Array ret; - if (GDVIRTUAL_CALL(_shaped_text_get_objects, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_objects, p_shaped, ret)) { return ret; } return Array(); } -Rect2 TextServerExtension::shaped_text_get_object_rect(RID p_shaped, Variant p_key) const { +Rect2 TextServerExtension::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { Rect2 ret; - if (GDVIRTUAL_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_object_rect, p_shaped, p_key, ret)) { return ret; } return Rect2(); } -Size2 TextServerExtension::shaped_text_get_size(RID p_shaped) const { +Size2 TextServerExtension::shaped_text_get_size(const RID &p_shaped) const { Size2 ret; - if (GDVIRTUAL_CALL(_shaped_text_get_size, p_shaped, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_size, p_shaped, ret)) { return ret; } return Size2(); } -float TextServerExtension::shaped_text_get_ascent(RID p_shaped) const { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ascent, p_shaped, ret)) { +double TextServerExtension::shaped_text_get_ascent(const RID &p_shaped) const { + double ret; + if (GDVIRTUAL_CALL(shaped_text_get_ascent, p_shaped, ret)) { return ret; } - return 0.f; + return 0.0; } -float TextServerExtension::shaped_text_get_descent(RID p_shaped) const { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_get_descent, p_shaped, ret)) { +double TextServerExtension::shaped_text_get_descent(const RID &p_shaped) const { + double ret; + if (GDVIRTUAL_CALL(shaped_text_get_descent, p_shaped, ret)) { return ret; } - return 0.f; + return 0.0; } -float TextServerExtension::shaped_text_get_width(RID p_shaped) const { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_get_width, p_shaped, ret)) { +double TextServerExtension::shaped_text_get_width(const RID &p_shaped) const { + double ret; + if (GDVIRTUAL_CALL(shaped_text_get_width, p_shaped, ret)) { return ret; } - return 0.f; + return 0.0; } -float TextServerExtension::shaped_text_get_underline_position(RID p_shaped) const { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_get_underline_position, p_shaped, ret)) { +double TextServerExtension::shaped_text_get_underline_position(const RID &p_shaped) const { + double ret; + if (GDVIRTUAL_CALL(shaped_text_get_underline_position, p_shaped, ret)) { return ret; } - return 0.f; + return 0.0; } -float TextServerExtension::shaped_text_get_underline_thickness(RID p_shaped) const { - float ret; - if (GDVIRTUAL_CALL(_shaped_text_get_underline_thickness, p_shaped, ret)) { +double TextServerExtension::shaped_text_get_underline_thickness(const RID &p_shaped) const { + double ret; + if (GDVIRTUAL_CALL(shaped_text_get_underline_thickness, p_shaped, ret)) { return ret; } - return 0.f; + return 0.0; } -TextServer::Direction TextServerExtension::shaped_text_get_dominant_direction_in_range(RID p_shaped, int p_start, int p_end) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_get_dominant_direction_in_range, p_shaped, p_start, p_end, ret)) { +TextServer::Direction TextServerExtension::shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_dominant_direction_in_range, p_shaped, p_start, p_end, ret)) { return (TextServer::Direction)ret; } return TextServer::shaped_text_get_dominant_direction_in_range(p_shaped, p_start, p_end); } -CaretInfo TextServerExtension::shaped_text_get_carets(RID p_shaped, int p_position) const { +CaretInfo TextServerExtension::shaped_text_get_carets(const RID &p_shaped, int64_t p_position) const { CaretInfo ret; - if (GDVIRTUAL_CALL(_shaped_text_get_carets, p_shaped, p_position, &ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_carets, p_shaped, p_position, &ret)) { return ret; } return TextServer::shaped_text_get_carets(p_shaped, p_position); } -Vector<Vector2> TextServerExtension::shaped_text_get_selection(RID p_shaped, int p_start, int p_end) const { +Vector<Vector2> TextServerExtension::shaped_text_get_selection(const RID &p_shaped, int64_t p_start, int64_t p_end) const { Vector<Vector2> ret; - if (GDVIRTUAL_CALL(_shaped_text_get_selection, p_shaped, p_start, p_end, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_selection, p_shaped, p_start, p_end, ret)) { return ret; } return TextServer::shaped_text_get_selection(p_shaped, p_start, p_end); } -int TextServerExtension::shaped_text_hit_test_grapheme(RID p_shaped, float p_coords) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_hit_test_grapheme, p_shaped, p_coords, ret)) { +int64_t TextServerExtension::shaped_text_hit_test_grapheme(const RID &p_shaped, double p_coords) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_hit_test_grapheme, p_shaped, p_coords, ret)) { return ret; } return TextServer::shaped_text_hit_test_grapheme(p_shaped, p_coords); } -int TextServerExtension::shaped_text_hit_test_position(RID p_shaped, float p_coords) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_hit_test_position, p_shaped, p_coords, ret)) { +int64_t TextServerExtension::shaped_text_hit_test_position(const RID &p_shaped, double p_coords) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_hit_test_position, p_shaped, p_coords, ret)) { return ret; } return TextServer::shaped_text_hit_test_position(p_shaped, p_coords); } -void TextServerExtension::shaped_text_draw(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l, float p_clip_r, const Color &p_color) const { - if (GDVIRTUAL_CALL(_shaped_text_draw, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_color)) { +void TextServerExtension::shaped_text_draw(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, const Color &p_color) const { + if (GDVIRTUAL_CALL(shaped_text_draw, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_color)) { return; } TextServer::shaped_text_draw(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_color); } -void TextServerExtension::shaped_text_draw_outline(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l, float p_clip_r, int p_outline_size, const Color &p_color) const { - if (GDVIRTUAL_CALL(_shaped_text_draw_outline, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color)) { +void TextServerExtension::shaped_text_draw_outline(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, int64_t p_outline_size, const Color &p_color) const { + if (GDVIRTUAL_CALL(shaped_text_draw_outline, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color)) { return; } - shaped_text_draw_outline(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color); + TextServer::shaped_text_draw_outline(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color); } -Vector2 TextServerExtension::shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const { +Vector2 TextServerExtension::shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const { Vector2 ret; - if (GDVIRTUAL_CALL(_shaped_text_get_grapheme_bounds, p_shaped, p_pos, ret)) { + if (GDVIRTUAL_CALL(shaped_text_get_grapheme_bounds, p_shaped, p_pos, ret)) { return ret; } return TextServer::shaped_text_get_grapheme_bounds(p_shaped, p_pos); } -int TextServerExtension::shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_next_grapheme_pos, p_shaped, p_pos, ret)) { +int64_t TextServerExtension::shaped_text_next_grapheme_pos(const RID &p_shaped, int64_t p_pos) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_next_grapheme_pos, p_shaped, p_pos, ret)) { return ret; } return TextServer::shaped_text_next_grapheme_pos(p_shaped, p_pos); } -int TextServerExtension::shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const { - int ret; - if (GDVIRTUAL_CALL(_shaped_text_prev_grapheme_pos, p_shaped, p_pos, ret)) { +int64_t TextServerExtension::shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p_pos) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_prev_grapheme_pos, p_shaped, p_pos, ret)) { return ret; } return TextServer::shaped_text_prev_grapheme_pos(p_shaped, p_pos); @@ -1419,31 +1413,39 @@ int TextServerExtension::shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) String TextServerExtension::format_number(const String &p_string, const String &p_language) const { String ret; - if (GDVIRTUAL_CALL(_format_number, p_string, p_language, ret)) { + if (GDVIRTUAL_CALL(format_number, p_string, p_language, ret)) { return ret; } - return TextServer::format_number(p_string, p_language); + return p_string; } String TextServerExtension::parse_number(const String &p_string, const String &p_language) const { String ret; - if (GDVIRTUAL_CALL(_parse_number, p_string, p_language, ret)) { + if (GDVIRTUAL_CALL(parse_number, p_string, p_language, ret)) { return ret; } - return TextServer::parse_number(p_string, p_language); + return p_string; } String TextServerExtension::percent_sign(const String &p_language) const { String ret; - if (GDVIRTUAL_CALL(_percent_sign, p_language, ret)) { + if (GDVIRTUAL_CALL(percent_sign, p_language, ret)) { + return ret; + } + return "%"; +} + +String TextServerExtension::strip_diacritics(const String &p_string) const { + String ret; + if (GDVIRTUAL_CALL(strip_diacritics, p_string, ret)) { return ret; } - return TextServer::percent_sign(p_language); + return TextServer::strip_diacritics(p_string); } String TextServerExtension::string_to_upper(const String &p_string, const String &p_language) const { String ret; - if (GDVIRTUAL_CALL(_string_to_upper, p_string, p_language, ret)) { + if (GDVIRTUAL_CALL(string_to_upper, p_string, p_language, ret)) { return ret; } return p_string; @@ -1451,7 +1453,7 @@ String TextServerExtension::string_to_upper(const String &p_string, const String String TextServerExtension::string_to_lower(const String &p_string, const String &p_language) const { String ret; - if (GDVIRTUAL_CALL(_string_to_lower, p_string, p_language, ret)) { + if (GDVIRTUAL_CALL(string_to_lower, p_string, p_language, ret)) { return ret; } return p_string; diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 7d80467371..c6e7bef4e8 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -48,433 +48,436 @@ protected: public: virtual bool has_feature(Feature p_feature) const override; virtual String get_name() const override; - virtual uint32_t get_features() const override; - GDVIRTUAL1RC(bool, _has_feature, Feature); - GDVIRTUAL0RC(String, _get_name); - GDVIRTUAL0RC(uint32_t, _get_features); + virtual int64_t get_features() const override; + GDVIRTUAL1RC(bool, has_feature, Feature); + GDVIRTUAL0RC(String, get_name); + GDVIRTUAL0RC(int64_t, get_features); - virtual void free(RID p_rid) override; - virtual bool has(RID p_rid) override; + virtual void free_rid(const RID &p_rid) override; + virtual bool has(const RID &p_rid) override; virtual bool load_support_data(const String &p_filename) override; - GDVIRTUAL1(_free, RID); - GDVIRTUAL1R(bool, _has, RID); - GDVIRTUAL1R(bool, _load_support_data, const String &); + GDVIRTUAL1(free_rid, RID); + GDVIRTUAL1R(bool, has, RID); + GDVIRTUAL1R(bool, load_support_data, const String &); virtual String get_support_data_filename() const override; virtual String get_support_data_info() const override; virtual bool save_support_data(const String &p_filename) const override; - GDVIRTUAL0RC(String, _get_support_data_filename); - GDVIRTUAL0RC(String, _get_support_data_info); - GDVIRTUAL1RC(bool, _save_support_data, const String &); + GDVIRTUAL0RC(String, get_support_data_filename); + GDVIRTUAL0RC(String, get_support_data_info); + GDVIRTUAL1RC(bool, save_support_data, const String &); virtual bool is_locale_right_to_left(const String &p_locale) const override; - GDVIRTUAL1RC(bool, _is_locale_right_to_left, const String &); + GDVIRTUAL1RC(bool, is_locale_right_to_left, const String &); - virtual int32_t name_to_tag(const String &p_name) const override; - virtual String tag_to_name(int32_t p_tag) const override; - GDVIRTUAL1RC(int32_t, _name_to_tag, const String &); - GDVIRTUAL1RC(String, _tag_to_name, int32_t); + virtual int64_t name_to_tag(const String &p_name) const override; + virtual String tag_to_name(int64_t p_tag) const override; + GDVIRTUAL1RC(int64_t, name_to_tag, const String &); + GDVIRTUAL1RC(String, tag_to_name, int64_t); /* Font interface */ virtual RID create_font() override; - GDVIRTUAL0R(RID, _create_font); - - virtual void font_set_data(RID p_font_rid, const PackedByteArray &p_data) override; - virtual void font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) override; - GDVIRTUAL2(_font_set_data, RID, const PackedByteArray &); - GDVIRTUAL3(_font_set_data_ptr, RID, GDNativeConstPtr<const uint8_t>, uint64_t); - - virtual void font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) override; - virtual uint32_t /*FontStyle*/ font_get_style(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_style, RID, uint32_t); - GDVIRTUAL1RC(uint32_t, _font_get_style, RID); - - virtual void font_set_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_name(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_name, RID, const String &); - GDVIRTUAL1RC(String, _font_get_name, RID); - - virtual void font_set_style_name(RID p_font_rid, const String &p_name) override; - virtual String font_get_style_name(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_style_name, RID, const String &); - GDVIRTUAL1RC(String, _font_get_style_name, RID); - - virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) override; - virtual bool font_is_antialiased(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_antialiased, RID, bool); - GDVIRTUAL1RC(bool, _font_is_antialiased, RID); - - virtual void font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) override; - virtual bool font_is_multichannel_signed_distance_field(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_multichannel_signed_distance_field, RID, bool); - GDVIRTUAL1RC(bool, _font_is_multichannel_signed_distance_field, RID); - - virtual void font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) override; - virtual int font_get_msdf_pixel_range(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_msdf_pixel_range, RID, int); - GDVIRTUAL1RC(int, _font_get_msdf_pixel_range, RID); - - virtual void font_set_msdf_size(RID p_font_rid, int p_msdf_size) override; - virtual int font_get_msdf_size(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_msdf_size, RID, int); - GDVIRTUAL1RC(int, _font_get_msdf_size, RID); - - virtual void font_set_fixed_size(RID p_font_rid, int p_fixed_size) override; - virtual int font_get_fixed_size(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_fixed_size, RID, int); - GDVIRTUAL1RC(int, _font_get_fixed_size, RID); - - virtual void font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) override; - virtual bool font_is_force_autohinter(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_force_autohinter, RID, bool); - GDVIRTUAL1RC(bool, _font_is_force_autohinter, RID); - - virtual void font_set_hinting(RID p_font_rid, Hinting p_hinting) override; - virtual Hinting font_get_hinting(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_hinting, RID, Hinting); - GDVIRTUAL1RC(Hinting, _font_get_hinting, RID); - - virtual void font_set_subpixel_positioning(RID p_font_rid, SubpixelPositioning p_subpixel) override; - virtual SubpixelPositioning font_get_subpixel_positioning(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_subpixel_positioning, RID, SubpixelPositioning); - GDVIRTUAL1RC(SubpixelPositioning, _font_get_subpixel_positioning, RID); - - virtual void font_set_embolden(RID p_font_rid, float p_strength) override; - virtual float font_get_embolden(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_embolden, RID, float); - GDVIRTUAL1RC(float, _font_get_embolden, RID); - - virtual void font_set_transform(RID p_font_rid, Transform2D p_transform) override; - virtual Transform2D font_get_transform(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_transform, RID, Transform2D); - GDVIRTUAL1RC(Transform2D, _font_get_transform, RID); - - virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) override; - virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_variation_coordinates, RID, Dictionary); - GDVIRTUAL1RC(Dictionary, _font_get_variation_coordinates, RID); - - virtual void font_set_oversampling(RID p_font_rid, float p_oversampling) override; - virtual float font_get_oversampling(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_oversampling, RID, float); - GDVIRTUAL1RC(float, _font_get_oversampling, RID); - - virtual Array font_get_size_cache_list(RID p_font_rid) const override; - virtual void font_clear_size_cache(RID p_font_rid) override; - virtual void font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) override; - GDVIRTUAL1RC(Array, _font_get_size_cache_list, RID); - GDVIRTUAL1(_font_clear_size_cache, RID); - GDVIRTUAL2(_font_remove_size_cache, RID, const Vector2i &); - - virtual void font_set_ascent(RID p_font_rid, int p_size, float p_ascent) override; - virtual float font_get_ascent(RID p_font_rid, int p_size) const override; - GDVIRTUAL3(_font_set_ascent, RID, int, float); - GDVIRTUAL2RC(float, _font_get_ascent, RID, int); - - virtual void font_set_descent(RID p_font_rid, int p_size, float p_descent) override; - virtual float font_get_descent(RID p_font_rid, int p_size) const override; - GDVIRTUAL3(_font_set_descent, RID, int, float); - GDVIRTUAL2RC(float, _font_get_descent, RID, int); - - virtual void font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) override; - virtual float font_get_underline_position(RID p_font_rid, int p_size) const override; - GDVIRTUAL3(_font_set_underline_position, RID, int, float); - GDVIRTUAL2RC(float, _font_get_underline_position, RID, int); - - virtual void font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) override; - virtual float font_get_underline_thickness(RID p_font_rid, int p_size) const override; - GDVIRTUAL3(_font_set_underline_thickness, RID, int, float); - GDVIRTUAL2RC(float, _font_get_underline_thickness, RID, int); - - virtual void font_set_scale(RID p_font_rid, int p_size, float p_scale) override; - virtual float font_get_scale(RID p_font_rid, int p_size) const override; - GDVIRTUAL3(_font_set_scale, RID, int, float); - GDVIRTUAL2RC(float, _font_get_scale, RID, int); - - virtual void font_set_spacing(RID p_font_rid, int p_size, SpacingType p_spacing, int p_value) override; - virtual int font_get_spacing(RID p_font_rid, int p_size, SpacingType p_spacing) const override; - GDVIRTUAL4(_font_set_spacing, RID, int, SpacingType, int); - GDVIRTUAL3RC(int, _font_get_spacing, RID, int, SpacingType); - - virtual int font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_textures(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) override; - GDVIRTUAL2RC(int, _font_get_texture_count, RID, const Vector2i &); - GDVIRTUAL2(_font_clear_textures, RID, const Vector2i &); - GDVIRTUAL3(_font_remove_texture, RID, const Vector2i &, int); - - virtual void font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) override; - virtual Ref<Image> font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; - GDVIRTUAL4(_font_set_texture_image, RID, const Vector2i &, int, const Ref<Image> &); - GDVIRTUAL3RC(Ref<Image>, _font_get_texture_image, RID, const Vector2i &, int); - - virtual void font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) override; - virtual PackedInt32Array font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; - GDVIRTUAL4(_font_set_texture_offsets, RID, const Vector2i &, int, const PackedInt32Array &); - GDVIRTUAL3RC(PackedInt32Array, _font_get_texture_offsets, RID, const Vector2i &, int); - - virtual Array font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const override; - virtual void font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) override; - virtual void font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) override; - GDVIRTUAL2RC(Array, _font_get_glyph_list, RID, const Vector2i &); - GDVIRTUAL2(_font_clear_glyphs, RID, const Vector2i &); - GDVIRTUAL3(_font_remove_glyph, RID, const Vector2i &, int32_t); - - virtual Vector2 font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) override; - GDVIRTUAL3RC(Vector2, _font_get_glyph_advance, RID, int, int32_t); - GDVIRTUAL4(_font_set_glyph_advance, RID, int, int32_t, const Vector2 &); - - virtual Vector2 font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) override; - GDVIRTUAL3RC(Vector2, _font_get_glyph_offset, RID, const Vector2i &, int32_t); - GDVIRTUAL4(_font_set_glyph_offset, RID, const Vector2i &, int32_t, const Vector2 &); - - virtual Vector2 font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) override; - GDVIRTUAL3RC(Vector2, _font_get_glyph_size, RID, const Vector2i &, int32_t); - GDVIRTUAL4(_font_set_glyph_size, RID, const Vector2i &, int32_t, const Vector2 &); - - virtual Rect2 font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) override; - GDVIRTUAL3RC(Rect2, _font_get_glyph_uv_rect, RID, const Vector2i &, int32_t); - GDVIRTUAL4(_font_set_glyph_uv_rect, RID, const Vector2i &, int32_t, const Rect2 &); - - virtual int font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; - virtual void font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) override; - GDVIRTUAL3RC(int, _font_get_glyph_texture_idx, RID, const Vector2i &, int32_t); - GDVIRTUAL4(_font_set_glyph_texture_idx, RID, const Vector2i &, int32_t, int); - - virtual Dictionary font_get_glyph_contours(RID p_font, int p_size, int32_t p_index) const override; - GDVIRTUAL3RC(Dictionary, _font_get_glyph_contours, RID, int, int32_t); - - virtual Array font_get_kerning_list(RID p_font_rid, int p_size) const override; - virtual void font_clear_kerning_map(RID p_font_rid, int p_size) override; - virtual void font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) override; - GDVIRTUAL2RC(Array, _font_get_kerning_list, RID, int); - GDVIRTUAL2(_font_clear_kerning_map, RID, int); - GDVIRTUAL3(_font_remove_kerning, RID, int, const Vector2i &); - - virtual void font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; - virtual Vector2 font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const override; - GDVIRTUAL4(_font_set_kerning, RID, int, const Vector2i &, const Vector2 &); - GDVIRTUAL3RC(Vector2, _font_get_kerning, RID, int, const Vector2i &); - - virtual int32_t font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector = 0) const override; - GDVIRTUAL4RC(int32_t, _font_get_glyph_index, RID, int, char32_t, char32_t); - - virtual bool font_has_char(RID p_font_rid, char32_t p_char) const override; - virtual String font_get_supported_chars(RID p_font_rid) const override; - GDVIRTUAL2RC(bool, _font_has_char, RID, char32_t); - GDVIRTUAL1RC(String, _font_get_supported_chars, RID); - - virtual void font_render_range(RID p_font, const Vector2i &p_size, char32_t p_start, char32_t p_end) override; - virtual void font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) override; - GDVIRTUAL4(_font_render_range, RID, const Vector2i &, char32_t, char32_t); - GDVIRTUAL3(_font_render_glyph, RID, const Vector2i &, int32_t); - - virtual void font_draw_glyph(RID p_font, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - virtual void font_draw_glyph_outline(RID p_font, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; - GDVIRTUAL6C(_font_draw_glyph, RID, RID, int, const Vector2 &, int32_t, const Color &); - GDVIRTUAL7C(_font_draw_glyph_outline, RID, RID, int, int, const Vector2 &, int32_t, const Color &); - - virtual bool font_is_language_supported(RID p_font_rid, const String &p_language) const override; - virtual void font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) override; - virtual bool font_get_language_support_override(RID p_font_rid, const String &p_language) override; - virtual void font_remove_language_support_override(RID p_font_rid, const String &p_language) override; - virtual Vector<String> font_get_language_support_overrides(RID p_font_rid) override; - GDVIRTUAL2RC(bool, _font_is_language_supported, RID, const String &); - GDVIRTUAL3(_font_set_language_support_override, RID, const String &, bool); - GDVIRTUAL2R(bool, _font_get_language_support_override, RID, const String &); - GDVIRTUAL2(_font_remove_language_support_override, RID, const String &); - GDVIRTUAL1R(Vector<String>, _font_get_language_support_overrides, RID); - - virtual bool font_is_script_supported(RID p_font_rid, const String &p_script) const override; - virtual void font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) override; - virtual bool font_get_script_support_override(RID p_font_rid, const String &p_script) override; - virtual void font_remove_script_support_override(RID p_font_rid, const String &p_script) override; - virtual Vector<String> font_get_script_support_overrides(RID p_font_rid) override; - GDVIRTUAL2RC(bool, _font_is_script_supported, RID, const String &); - GDVIRTUAL3(_font_set_script_support_override, RID, const String &, bool); - GDVIRTUAL2R(bool, _font_get_script_support_override, RID, const String &); - GDVIRTUAL2(_font_remove_script_support_override, RID, const String &); - GDVIRTUAL1R(Vector<String>, _font_get_script_support_overrides, RID); - - virtual void font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) override; - virtual Dictionary font_get_opentype_feature_overrides(RID p_font_rid) const override; - GDVIRTUAL2(_font_set_opentype_feature_overrides, RID, const Dictionary &); - GDVIRTUAL1RC(Dictionary, _font_get_opentype_feature_overrides, RID); - - virtual Dictionary font_supported_feature_list(RID p_font_rid) const override; - virtual Dictionary font_supported_variation_list(RID p_font_rid) const override; - GDVIRTUAL1RC(Dictionary, _font_supported_feature_list, RID); - GDVIRTUAL1RC(Dictionary, _font_supported_variation_list, RID); - - virtual float font_get_global_oversampling() const override; - virtual void font_set_global_oversampling(float p_oversampling) override; - GDVIRTUAL0RC(float, _font_get_global_oversampling); - GDVIRTUAL1(_font_set_global_oversampling, float); - - virtual Vector2 get_hex_code_box_size(int p_size, char32_t p_index) const override; - virtual void draw_hex_code_box(RID p_canvas, int p_size, const Vector2 &p_pos, char32_t p_index, const Color &p_color) const override; - GDVIRTUAL2RC(Vector2, _get_hex_code_box_size, int, char32_t); - GDVIRTUAL5C(_draw_hex_code_box, RID, int, const Vector2 &, char32_t, const Color &); + GDVIRTUAL0R(RID, create_font); + + virtual void font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) override; + virtual void font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) override; + GDVIRTUAL2(font_set_data, RID, const PackedByteArray &); + GDVIRTUAL3(font_set_data_ptr, RID, GDNativeConstPtr<const uint8_t>, int64_t); + + virtual void font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) override; + virtual int64_t /*FontStyle*/ font_get_style(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_style, RID, int64_t); + GDVIRTUAL1RC(int64_t, font_get_style, RID); + + virtual void font_set_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_name(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_name, RID, const String &); + GDVIRTUAL1RC(String, font_get_name, RID); + + virtual void font_set_style_name(const RID &p_font_rid, const String &p_name) override; + virtual String font_get_style_name(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_style_name, RID, const String &); + GDVIRTUAL1RC(String, font_get_style_name, RID); + + virtual void font_set_antialiased(const RID &p_font_rid, bool p_antialiased) override; + virtual bool font_is_antialiased(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_antialiased, RID, bool); + GDVIRTUAL1RC(bool, font_is_antialiased, RID); + + virtual void font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) override; + virtual bool font_is_multichannel_signed_distance_field(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_multichannel_signed_distance_field, RID, bool); + GDVIRTUAL1RC(bool, font_is_multichannel_signed_distance_field, RID); + + virtual void font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) override; + virtual int64_t font_get_msdf_pixel_range(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_msdf_pixel_range, RID, int64_t); + GDVIRTUAL1RC(int64_t, font_get_msdf_pixel_range, RID); + + virtual void font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) override; + virtual int64_t font_get_msdf_size(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_msdf_size, RID, int64_t); + GDVIRTUAL1RC(int64_t, font_get_msdf_size, RID); + + virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) override; + virtual int64_t font_get_fixed_size(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_fixed_size, RID, int64_t); + GDVIRTUAL1RC(int64_t, font_get_fixed_size, RID); + + virtual void font_set_subpixel_positioning(const RID &p_font_rid, SubpixelPositioning p_subpixel) override; + virtual SubpixelPositioning font_get_subpixel_positioning(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_subpixel_positioning, RID, SubpixelPositioning); + GDVIRTUAL1RC(SubpixelPositioning, font_get_subpixel_positioning, RID); + + virtual void font_set_embolden(const RID &p_font_rid, double p_strength) override; + virtual double font_get_embolden(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_embolden, RID, double); + GDVIRTUAL1RC(double, font_get_embolden, RID); + + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) override; + virtual Transform2D font_get_transform(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_transform, RID, Transform2D); + GDVIRTUAL1RC(Transform2D, font_get_transform, RID); + + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) override; + virtual bool font_is_force_autohinter(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_force_autohinter, RID, bool); + GDVIRTUAL1RC(bool, font_is_force_autohinter, RID); + + virtual void font_set_hinting(const RID &p_font_rid, Hinting p_hinting) override; + virtual Hinting font_get_hinting(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_hinting, RID, Hinting); + GDVIRTUAL1RC(Hinting, font_get_hinting, RID); + + virtual void font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) override; + virtual Dictionary font_get_variation_coordinates(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_variation_coordinates, RID, Dictionary); + GDVIRTUAL1RC(Dictionary, font_get_variation_coordinates, RID); + + virtual void font_set_oversampling(const RID &p_font_rid, double p_oversampling) override; + virtual double font_get_oversampling(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_oversampling, RID, double); + GDVIRTUAL1RC(double, font_get_oversampling, RID); + + virtual Array font_get_size_cache_list(const RID &p_font_rid) const override; + virtual void font_clear_size_cache(const RID &p_font_rid) override; + virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) override; + GDVIRTUAL1RC(Array, font_get_size_cache_list, RID); + GDVIRTUAL1(font_clear_size_cache, RID); + GDVIRTUAL2(font_remove_size_cache, RID, const Vector2i &); + + virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) override; + virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const override; + GDVIRTUAL3(font_set_ascent, RID, int64_t, double); + GDVIRTUAL2RC(double, font_get_ascent, RID, int64_t); + + virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) override; + virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const override; + GDVIRTUAL3(font_set_descent, RID, int64_t, double); + GDVIRTUAL2RC(double, font_get_descent, RID, int64_t); + + virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) override; + virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const override; + GDVIRTUAL3(font_set_underline_position, RID, int64_t, double); + GDVIRTUAL2RC(double, font_get_underline_position, RID, int64_t); + + virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) override; + virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const override; + GDVIRTUAL3(font_set_underline_thickness, RID, int64_t, double); + GDVIRTUAL2RC(double, font_get_underline_thickness, RID, int64_t); + + virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) override; + virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const override; + GDVIRTUAL3(font_set_scale, RID, int64_t, double); + GDVIRTUAL2RC(double, font_get_scale, RID, int64_t); + + virtual void font_set_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing, int64_t p_value) override; + virtual int64_t font_get_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing) const override; + GDVIRTUAL4(font_set_spacing, RID, int64_t, SpacingType, int64_t); + GDVIRTUAL3RC(int64_t, font_get_spacing, RID, int64_t, SpacingType); + + virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) override; + GDVIRTUAL2RC(int64_t, font_get_texture_count, RID, const Vector2i &); + GDVIRTUAL2(font_clear_textures, RID, const Vector2i &); + GDVIRTUAL3(font_remove_texture, RID, const Vector2i &, int64_t); + + virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) override; + virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; + GDVIRTUAL4(font_set_texture_image, RID, const Vector2i &, int64_t, const Ref<Image> &); + GDVIRTUAL3RC(Ref<Image>, font_get_texture_image, RID, const Vector2i &, int64_t); + + virtual void font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) override; + virtual PackedInt32Array font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override; + GDVIRTUAL4(font_set_texture_offsets, RID, const Vector2i &, int64_t, const PackedInt32Array &); + GDVIRTUAL3RC(PackedInt32Array, font_get_texture_offsets, RID, const Vector2i &, int64_t); + + virtual Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) override; + GDVIRTUAL2RC(Array, font_get_glyph_list, RID, const Vector2i &); + GDVIRTUAL2(font_clear_glyphs, RID, const Vector2i &); + GDVIRTUAL3(font_remove_glyph, RID, const Vector2i &, int64_t); + + virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) override; + GDVIRTUAL3RC(Vector2, font_get_glyph_advance, RID, int64_t, int64_t); + GDVIRTUAL4(font_set_glyph_advance, RID, int64_t, int64_t, const Vector2 &); + + virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) override; + GDVIRTUAL3RC(Vector2, font_get_glyph_offset, RID, const Vector2i &, int64_t); + GDVIRTUAL4(font_set_glyph_offset, RID, const Vector2i &, int64_t, const Vector2 &); + + virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) override; + GDVIRTUAL3RC(Vector2, font_get_glyph_size, RID, const Vector2i &, int64_t); + GDVIRTUAL4(font_set_glyph_size, RID, const Vector2i &, int64_t, const Vector2 &); + + virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) override; + GDVIRTUAL3RC(Rect2, font_get_glyph_uv_rect, RID, const Vector2i &, int64_t); + GDVIRTUAL4(font_set_glyph_uv_rect, RID, const Vector2i &, int64_t, const Rect2 &); + + virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override; + virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) override; + GDVIRTUAL3RC(int64_t, font_get_glyph_texture_idx, RID, const Vector2i &, int64_t); + GDVIRTUAL4(font_set_glyph_texture_idx, RID, const Vector2i &, int64_t, int64_t); + + virtual Dictionary font_get_glyph_contours(const RID &p_font, int64_t p_size, int64_t p_index) const override; + GDVIRTUAL3RC(Dictionary, font_get_glyph_contours, RID, int64_t, int64_t); + + virtual Array font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const override; + virtual void font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) override; + virtual void font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) override; + GDVIRTUAL2RC(Array, font_get_kerning_list, RID, int64_t); + GDVIRTUAL2(font_clear_kerning_map, RID, int64_t); + GDVIRTUAL3(font_remove_kerning, RID, int64_t, const Vector2i &); + + virtual void font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; + virtual Vector2 font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const override; + GDVIRTUAL4(font_set_kerning, RID, int64_t, const Vector2i &, const Vector2 &); + GDVIRTUAL3RC(Vector2, font_get_kerning, RID, int64_t, const Vector2i &); + + virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector = 0) const override; + GDVIRTUAL4RC(int64_t, font_get_glyph_index, RID, int64_t, int64_t, int64_t); + + virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override; + virtual String font_get_supported_chars(const RID &p_font_rid) const override; + GDVIRTUAL2RC(bool, font_has_char, RID, int64_t); + GDVIRTUAL1RC(String, font_get_supported_chars, RID); + + virtual void font_render_range(const RID &p_font, const Vector2i &p_size, int64_t p_start, int64_t p_end) override; + virtual void font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) override; + GDVIRTUAL4(font_render_range, RID, const Vector2i &, int64_t, int64_t); + GDVIRTUAL3(font_render_glyph, RID, const Vector2i &, int64_t); + + virtual void font_draw_glyph(const RID &p_font, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph_outline(const RID &p_font, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + GDVIRTUAL6C(font_draw_glyph, RID, RID, int64_t, const Vector2 &, int64_t, const Color &); + GDVIRTUAL7C(font_draw_glyph_outline, RID, RID, int64_t, int64_t, const Vector2 &, int64_t, const Color &); + + virtual bool font_is_language_supported(const RID &p_font_rid, const String &p_language) const override; + virtual void font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) override; + virtual bool font_get_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual void font_remove_language_support_override(const RID &p_font_rid, const String &p_language) override; + virtual PackedStringArray font_get_language_support_overrides(const RID &p_font_rid) override; + GDVIRTUAL2RC(bool, font_is_language_supported, RID, const String &); + GDVIRTUAL3(font_set_language_support_override, RID, const String &, bool); + GDVIRTUAL2R(bool, font_get_language_support_override, RID, const String &); + GDVIRTUAL2(font_remove_language_support_override, RID, const String &); + GDVIRTUAL1R(PackedStringArray, font_get_language_support_overrides, RID); + + virtual bool font_is_script_supported(const RID &p_font_rid, const String &p_script) const override; + virtual void font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) override; + virtual bool font_get_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual void font_remove_script_support_override(const RID &p_font_rid, const String &p_script) override; + virtual PackedStringArray font_get_script_support_overrides(const RID &p_font_rid) override; + GDVIRTUAL2RC(bool, font_is_script_supported, RID, const String &); + GDVIRTUAL3(font_set_script_support_override, RID, const String &, bool); + GDVIRTUAL2R(bool, font_get_script_support_override, RID, const String &); + GDVIRTUAL2(font_remove_script_support_override, RID, const String &); + GDVIRTUAL1R(PackedStringArray, font_get_script_support_overrides, RID); + + virtual void font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) override; + virtual Dictionary font_get_opentype_feature_overrides(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_opentype_feature_overrides, RID, const Dictionary &); + GDVIRTUAL1RC(Dictionary, font_get_opentype_feature_overrides, RID); + + virtual Dictionary font_supported_feature_list(const RID &p_font_rid) const override; + virtual Dictionary font_supported_variation_list(const RID &p_font_rid) const override; + GDVIRTUAL1RC(Dictionary, font_supported_feature_list, RID); + GDVIRTUAL1RC(Dictionary, font_supported_variation_list, RID); + + virtual double font_get_global_oversampling() const override; + virtual void font_set_global_oversampling(double p_oversampling) override; + GDVIRTUAL0RC(double, font_get_global_oversampling); + GDVIRTUAL1(font_set_global_oversampling, double); + + virtual Vector2 get_hex_code_box_size(int64_t p_size, int64_t p_index) const override; + virtual void draw_hex_code_box(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const override; + GDVIRTUAL2RC(Vector2, get_hex_code_box_size, int64_t, int64_t); + GDVIRTUAL5C(draw_hex_code_box, RID, int64_t, const Vector2 &, int64_t, const Color &); /* Shaped text buffer interface */ virtual RID create_shaped_text(Direction p_direction = DIRECTION_AUTO, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - GDVIRTUAL2R(RID, _create_shaped_text, Direction, Orientation); - - virtual void shaped_text_clear(RID p_shaped) override; - GDVIRTUAL1(_shaped_text_clear, RID); - - virtual void shaped_text_set_direction(RID p_shaped, Direction p_direction = DIRECTION_AUTO) override; - virtual Direction shaped_text_get_direction(RID p_shaped) const override; - virtual Direction shaped_text_get_inferred_direction(RID p_shaped) const override; - GDVIRTUAL2(_shaped_text_set_direction, RID, Direction); - GDVIRTUAL1RC(Direction, _shaped_text_get_direction, RID); - GDVIRTUAL1RC(Direction, _shaped_text_get_inferred_direction, RID); - - virtual void shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) override; - GDVIRTUAL2(_shaped_text_set_bidi_override, RID, const Array &); - - virtual void shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) override; - virtual String shaped_text_get_custom_punctuation(RID p_shaped) const override; - GDVIRTUAL2(_shaped_text_set_custom_punctuation, RID, String); - GDVIRTUAL1RC(String, _shaped_text_get_custom_punctuation, RID); - - virtual void shaped_text_set_orientation(RID p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; - virtual Orientation shaped_text_get_orientation(RID p_shaped) const override; - GDVIRTUAL2(_shaped_text_set_orientation, RID, Orientation); - GDVIRTUAL1RC(Orientation, _shaped_text_get_orientation, RID); - - virtual void shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_invalid(RID p_shaped) const override; - GDVIRTUAL2(_shaped_text_set_preserve_invalid, RID, bool); - GDVIRTUAL1RC(bool, _shaped_text_get_preserve_invalid, RID); - - virtual void shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) override; - virtual bool shaped_text_get_preserve_control(RID p_shaped) const override; - GDVIRTUAL2(_shaped_text_set_preserve_control, RID, bool); - GDVIRTUAL1RC(bool, _shaped_text_get_preserve_control, RID); - - virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; - virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override; - virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; - GDVIRTUAL7R(bool, _shaped_text_add_string, RID, const String &, const Array &, int, const Dictionary &, const String &, const Variant &); - GDVIRTUAL5R(bool, _shaped_text_add_object, RID, Variant, const Size2 &, InlineAlignment, int); - GDVIRTUAL4R(bool, _shaped_text_resize_object, RID, Variant, const Size2 &, InlineAlignment); - - virtual int shaped_get_span_count(RID p_shaped) const override; - virtual Variant shaped_get_span_meta(RID p_shaped, int p_index) const override; - virtual void shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary()) override; - GDVIRTUAL1RC(int, _shaped_get_span_count, RID); - GDVIRTUAL2RC(Variant, _shaped_get_span_meta, RID, int); - GDVIRTUAL5(_shaped_set_span_update_font, RID, int, const Array &, int, const Dictionary &); - - virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override; - virtual RID shaped_text_get_parent(RID p_shaped) const override; - GDVIRTUAL3RC(RID, _shaped_text_substr, RID, int, int); - GDVIRTUAL1RC(RID, _shaped_text_get_parent, RID); - - virtual float shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; - virtual float shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) override; - GDVIRTUAL3R(float, _shaped_text_fit_to_width, RID, float, uint16_t); - GDVIRTUAL2R(float, _shaped_text_tab_align, RID, const PackedFloat32Array &); - - virtual bool shaped_text_shape(RID p_shaped) override; - virtual bool shaped_text_update_breaks(RID p_shaped) override; - virtual bool shaped_text_update_justification_ops(RID p_shaped) override; - GDVIRTUAL1R(bool, _shaped_text_shape, RID); - GDVIRTUAL1R(bool, _shaped_text_update_breaks, RID); - GDVIRTUAL1R(bool, _shaped_text_update_justification_ops, RID); - - virtual bool shaped_text_is_ready(RID p_shaped) const override; - GDVIRTUAL1RC(bool, _shaped_text_is_ready, RID); - - virtual const Glyph *shaped_text_get_glyphs(RID p_shaped) const override; - virtual const Glyph *shaped_text_sort_logical(RID p_shaped) override; - virtual int shaped_text_get_glyph_count(RID p_shaped) const override; - GDVIRTUAL1RC(GDNativePtr<Glyph>, _shaped_text_get_glyphs, RID); - GDVIRTUAL1R(GDNativePtr<Glyph>, _shaped_text_sort_logical, RID); - GDVIRTUAL1RC(int, _shaped_text_get_glyph_count, RID); - - virtual Vector2i shaped_text_get_range(RID p_shaped) const override; - GDVIRTUAL1RC(Vector2i, _shaped_text_get_range, RID); - - virtual PackedInt32Array shaped_text_get_line_breaks_adv(RID p_shaped, const PackedFloat32Array &p_width, int p_start = 0, bool p_once = true, uint16_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; - virtual PackedInt32Array shaped_text_get_line_breaks(RID p_shaped, float p_width, int p_start = 0, uint16_t p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; - virtual PackedInt32Array shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const override; - GDVIRTUAL5RC(PackedInt32Array, _shaped_text_get_line_breaks_adv, RID, const PackedFloat32Array &, int, bool, uint16_t); - GDVIRTUAL4RC(PackedInt32Array, _shaped_text_get_line_breaks, RID, float, int, uint16_t); - GDVIRTUAL2RC(PackedInt32Array, _shaped_text_get_word_breaks, RID, int); - - virtual int shaped_text_get_trim_pos(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_pos(RID p_shaped) const override; - virtual const Glyph *shaped_text_get_ellipsis_glyphs(RID p_shaped) const override; - virtual int shaped_text_get_ellipsis_glyph_count(RID p_shaped) const override; - GDVIRTUAL1RC(int, _shaped_text_get_trim_pos, RID); - GDVIRTUAL1RC(int, _shaped_text_get_ellipsis_pos, RID); - GDVIRTUAL1RC(GDNativePtr<Glyph>, _shaped_text_get_ellipsis_glyphs, RID); - GDVIRTUAL1RC(int, _shaped_text_get_ellipsis_glyph_count, RID); - - virtual void shaped_text_overrun_trim_to_width(RID p_shaped, float p_width, uint16_t p_trim_flags) override; - GDVIRTUAL3(_shaped_text_overrun_trim_to_width, RID, float, uint16_t); - - virtual Array shaped_text_get_objects(RID p_shaped) const override; - virtual Rect2 shaped_text_get_object_rect(RID p_shaped, Variant p_key) const override; - GDVIRTUAL1RC(Array, _shaped_text_get_objects, RID); - GDVIRTUAL2RC(Rect2, _shaped_text_get_object_rect, RID, Variant); - - virtual Size2 shaped_text_get_size(RID p_shaped) const override; - virtual float shaped_text_get_ascent(RID p_shaped) const override; - virtual float shaped_text_get_descent(RID p_shaped) const override; - virtual float shaped_text_get_width(RID p_shaped) const override; - virtual float shaped_text_get_underline_position(RID p_shaped) const override; - virtual float shaped_text_get_underline_thickness(RID p_shaped) const override; - GDVIRTUAL1RC(Size2, _shaped_text_get_size, RID); - GDVIRTUAL1RC(float, _shaped_text_get_ascent, RID); - GDVIRTUAL1RC(float, _shaped_text_get_descent, RID); - GDVIRTUAL1RC(float, _shaped_text_get_width, RID); - GDVIRTUAL1RC(float, _shaped_text_get_underline_position, RID); - GDVIRTUAL1RC(float, _shaped_text_get_underline_thickness, RID); - - virtual Direction shaped_text_get_dominant_direction_in_range(RID p_shaped, int p_start, int p_end) const override; - GDVIRTUAL3RC(int, _shaped_text_get_dominant_direction_in_range, RID, int, int); - - virtual CaretInfo shaped_text_get_carets(RID p_shaped, int p_position) const override; - virtual Vector<Vector2> shaped_text_get_selection(RID p_shaped, int p_start, int p_end) const override; - GDVIRTUAL3C(_shaped_text_get_carets, RID, int, GDNativePtr<CaretInfo>); - GDVIRTUAL3RC(Vector<Vector2>, _shaped_text_get_selection, RID, int, int); - - virtual int shaped_text_hit_test_grapheme(RID p_shaped, float p_coords) const override; - virtual int shaped_text_hit_test_position(RID p_shaped, float p_coords) const override; - GDVIRTUAL2RC(int, _shaped_text_hit_test_grapheme, RID, float); - GDVIRTUAL2RC(int, _shaped_text_hit_test_position, RID, float); - - virtual void shaped_text_draw(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l = -1.f, float p_clip_r = -1.f, const Color &p_color = Color(1, 1, 1)) const override; - virtual void shaped_text_draw_outline(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l = -1.f, float p_clip_r = -1.f, int p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const override; - GDVIRTUAL6C(_shaped_text_draw, RID, RID, const Vector2 &, float, float, const Color &); - GDVIRTUAL7C(_shaped_text_draw_outline, RID, RID, const Vector2 &, float, float, int, const Color &); - - virtual Vector2 shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const override; - virtual int shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const override; - virtual int shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const override; - GDVIRTUAL2RC(Vector2, _shaped_text_get_grapheme_bounds, RID, int); - GDVIRTUAL2RC(int, _shaped_text_next_grapheme_pos, RID, int); - GDVIRTUAL2RC(int, _shaped_text_prev_grapheme_pos, RID, int); + GDVIRTUAL2R(RID, create_shaped_text, Direction, Orientation); + + virtual void shaped_text_clear(const RID &p_shaped) override; + GDVIRTUAL1(shaped_text_clear, RID); + + virtual void shaped_text_set_direction(const RID &p_shaped, Direction p_direction = DIRECTION_AUTO) override; + virtual Direction shaped_text_get_direction(const RID &p_shaped) const override; + virtual Direction shaped_text_get_inferred_direction(const RID &p_shaped) const override; + GDVIRTUAL2(shaped_text_set_direction, RID, Direction); + GDVIRTUAL1RC(Direction, shaped_text_get_direction, RID); + GDVIRTUAL1RC(Direction, shaped_text_get_inferred_direction, RID); + + virtual void shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) override; + GDVIRTUAL2(shaped_text_set_bidi_override, RID, const Array &); + + virtual void shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) override; + virtual String shaped_text_get_custom_punctuation(const RID &p_shaped) const override; + GDVIRTUAL2(shaped_text_set_custom_punctuation, RID, String); + GDVIRTUAL1RC(String, shaped_text_get_custom_punctuation, RID); + + virtual void shaped_text_set_orientation(const RID &p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; + virtual Orientation shaped_text_get_orientation(const RID &p_shaped) const override; + GDVIRTUAL2(shaped_text_set_orientation, RID, Orientation); + GDVIRTUAL1RC(Orientation, shaped_text_get_orientation, RID); + + virtual void shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_invalid(const RID &p_shaped) const override; + GDVIRTUAL2(shaped_text_set_preserve_invalid, RID, bool); + GDVIRTUAL1RC(bool, shaped_text_get_preserve_invalid, RID); + + virtual void shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_control(const RID &p_shaped) const override; + GDVIRTUAL2(shaped_text_set_preserve_control, RID, bool); + GDVIRTUAL1RC(bool, shaped_text_get_preserve_control, RID); + + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) override; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; + GDVIRTUAL7R(bool, shaped_text_add_string, RID, const String &, const Array &, int64_t, const Dictionary &, const String &, const Variant &); + GDVIRTUAL5R(bool, shaped_text_add_object, RID, const Variant &, const Size2 &, InlineAlignment, int64_t); + GDVIRTUAL4R(bool, shaped_text_resize_object, RID, const Variant &, const Size2 &, InlineAlignment); + + virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; + virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; + GDVIRTUAL1RC(int64_t, shaped_get_span_count, RID); + GDVIRTUAL2RC(Variant, shaped_get_span_meta, RID, int64_t); + GDVIRTUAL5(shaped_set_span_update_font, RID, int64_t, const Array &, int64_t, const Dictionary &); + + virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override; + virtual RID shaped_text_get_parent(const RID &p_shaped) const override; + GDVIRTUAL3RC(RID, shaped_text_substr, RID, int64_t, int64_t); + GDVIRTUAL1RC(RID, shaped_text_get_parent, RID); + + virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; + virtual double shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) override; + GDVIRTUAL3R(double, shaped_text_fit_to_width, RID, double, int64_t); + GDVIRTUAL2R(double, shaped_text_tab_align, RID, const PackedFloat32Array &); + + virtual bool shaped_text_shape(const RID &p_shaped) override; + virtual bool shaped_text_update_breaks(const RID &p_shaped) override; + virtual bool shaped_text_update_justification_ops(const RID &p_shaped) override; + GDVIRTUAL1R(bool, shaped_text_shape, RID); + GDVIRTUAL1R(bool, shaped_text_update_breaks, RID); + GDVIRTUAL1R(bool, shaped_text_update_justification_ops, RID); + + virtual bool shaped_text_is_ready(const RID &p_shaped) const override; + GDVIRTUAL1RC(bool, shaped_text_is_ready, RID); + + virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override; + virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override; + GDVIRTUAL1RC(GDNativeConstPtr<const Glyph>, shaped_text_get_glyphs, RID); + GDVIRTUAL1R(GDNativeConstPtr<const Glyph>, shaped_text_sort_logical, RID); + GDVIRTUAL1RC(int64_t, shaped_text_get_glyph_count, RID); + + virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override; + GDVIRTUAL1RC(Vector2i, shaped_text_get_range, RID); + + virtual PackedInt32Array shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start = 0, bool p_once = true, int64_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual PackedInt32Array shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start = 0, int64_t p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual PackedInt32Array shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const override; + GDVIRTUAL5RC(PackedInt32Array, shaped_text_get_line_breaks_adv, RID, const PackedFloat32Array &, int64_t, bool, int64_t); + GDVIRTUAL4RC(PackedInt32Array, shaped_text_get_line_breaks, RID, double, int64_t, int64_t); + GDVIRTUAL2RC(PackedInt32Array, shaped_text_get_word_breaks, RID, int64_t); + + virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override; + virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override; + virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override; + GDVIRTUAL1RC(int64_t, shaped_text_get_trim_pos, RID); + GDVIRTUAL1RC(int64_t, shaped_text_get_ellipsis_pos, RID); + GDVIRTUAL1RC(GDNativeConstPtr<const Glyph>, shaped_text_get_ellipsis_glyphs, RID); + GDVIRTUAL1RC(int64_t, shaped_text_get_ellipsis_glyph_count, RID); + + virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, int64_t p_trim_flags) override; + GDVIRTUAL3(shaped_text_overrun_trim_to_width, RID, double, int64_t); + + virtual Array shaped_text_get_objects(const RID &p_shaped) const override; + virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override; + GDVIRTUAL1RC(Array, shaped_text_get_objects, RID); + GDVIRTUAL2RC(Rect2, shaped_text_get_object_rect, RID, const Variant &); + + virtual Size2 shaped_text_get_size(const RID &p_shaped) const override; + virtual double shaped_text_get_ascent(const RID &p_shaped) const override; + virtual double shaped_text_get_descent(const RID &p_shaped) const override; + virtual double shaped_text_get_width(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_position(const RID &p_shaped) const override; + virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override; + GDVIRTUAL1RC(Size2, shaped_text_get_size, RID); + GDVIRTUAL1RC(double, shaped_text_get_ascent, RID); + GDVIRTUAL1RC(double, shaped_text_get_descent, RID); + GDVIRTUAL1RC(double, shaped_text_get_width, RID); + GDVIRTUAL1RC(double, shaped_text_get_underline_position, RID); + GDVIRTUAL1RC(double, shaped_text_get_underline_thickness, RID); + + virtual Direction shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const override; + GDVIRTUAL3RC(int64_t, shaped_text_get_dominant_direction_in_range, RID, int64_t, int64_t); + + virtual CaretInfo shaped_text_get_carets(const RID &p_shaped, int64_t p_position) const override; + virtual Vector<Vector2> shaped_text_get_selection(const RID &p_shaped, int64_t p_start, int64_t p_end) const override; + GDVIRTUAL3C(shaped_text_get_carets, RID, int64_t, GDNativePtr<CaretInfo>); + GDVIRTUAL3RC(Vector<Vector2>, shaped_text_get_selection, RID, int64_t, int64_t); + + virtual int64_t shaped_text_hit_test_grapheme(const RID &p_shaped, double p_coords) const override; + virtual int64_t shaped_text_hit_test_position(const RID &p_shaped, double p_coords) const override; + GDVIRTUAL2RC(int64_t, shaped_text_hit_test_grapheme, RID, double); + GDVIRTUAL2RC(int64_t, shaped_text_hit_test_position, RID, double); + + virtual void shaped_text_draw(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l = -1.0, double p_clip_r = -1.0, const Color &p_color = Color(1, 1, 1)) const override; + virtual void shaped_text_draw_outline(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l = -1.0, double p_clip_r = -1.0, int64_t p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const override; + GDVIRTUAL6C(shaped_text_draw, RID, RID, const Vector2 &, double, double, const Color &); + GDVIRTUAL7C(shaped_text_draw_outline, RID, RID, const Vector2 &, double, double, int64_t, const Color &); + + virtual Vector2 shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const override; + virtual int64_t shaped_text_next_grapheme_pos(const RID &p_shaped, int64_t p_pos) const override; + virtual int64_t shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p_pos) const override; + GDVIRTUAL2RC(Vector2, shaped_text_get_grapheme_bounds, RID, int64_t); + GDVIRTUAL2RC(int64_t, shaped_text_next_grapheme_pos, RID, int64_t); + GDVIRTUAL2RC(int64_t, shaped_text_prev_grapheme_pos, RID, int64_t); virtual String format_number(const String &p_string, const String &p_language = "") const override; virtual String parse_number(const String &p_string, const String &p_language = "") const override; virtual String percent_sign(const String &p_language = "") const override; - GDVIRTUAL2RC(String, _format_number, const String &, const String &); - GDVIRTUAL2RC(String, _parse_number, const String &, const String &); - GDVIRTUAL1RC(String, _percent_sign, const String &); + GDVIRTUAL2RC(String, format_number, const String &, const String &); + GDVIRTUAL2RC(String, parse_number, const String &, const String &); + GDVIRTUAL1RC(String, percent_sign, const String &); + + virtual String strip_diacritics(const String &p_string) const override; + GDVIRTUAL1RC(String, strip_diacritics, const String &); virtual String string_to_upper(const String &p_string, const String &p_language = "") const override; virtual String string_to_lower(const String &p_string, const String &p_language = "") const override; - GDVIRTUAL2RC(String, _string_to_upper, const String &, const String &); - GDVIRTUAL2RC(String, _string_to_lower, const String &, const String &); + GDVIRTUAL2RC(String, string_to_upper, const String &, const String &); + GDVIRTUAL2RC(String, string_to_lower, const String &, const String &); TextServerExtension(); ~TextServerExtension(); diff --git a/servers/text_server.cpp b/servers/text_server.cpp index aaba79c049..ec31885cae 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -200,7 +200,7 @@ void TextServer::_bind_methods() { ClassDB::bind_method(D_METHOD("tag_to_name", "tag"), &TextServer::tag_to_name); ClassDB::bind_method(D_METHOD("has", "rid"), &TextServer::has); - ClassDB::bind_method(D_METHOD("free_rid", "rid"), &TextServer::free); // shouldn't conflict with Object::free() + ClassDB::bind_method(D_METHOD("free_rid", "rid"), &TextServer::free_rid); /* Font Interface */ @@ -493,13 +493,19 @@ void TextServer::_bind_methods() { BIND_ENUM_CONSTANT(SUBPIXEL_POSITIONING_AUTO); BIND_ENUM_CONSTANT(SUBPIXEL_POSITIONING_ONE_HALF); BIND_ENUM_CONSTANT(SUBPIXEL_POSITIONING_ONE_QUARTER); + BIND_ENUM_CONSTANT(SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE); + BIND_ENUM_CONSTANT(SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE); /* Feature */ + BIND_ENUM_CONSTANT(FEATURE_SIMPLE_LAYOUT); BIND_ENUM_CONSTANT(FEATURE_BIDI_LAYOUT); BIND_ENUM_CONSTANT(FEATURE_VERTICAL_LAYOUT); BIND_ENUM_CONSTANT(FEATURE_SHAPING); BIND_ENUM_CONSTANT(FEATURE_KASHIDA_JUSTIFICATION); BIND_ENUM_CONSTANT(FEATURE_BREAK_ITERATORS); + BIND_ENUM_CONSTANT(FEATURE_FONT_BITMAP); + BIND_ENUM_CONSTANT(FEATURE_FONT_DYNAMIC); + BIND_ENUM_CONSTANT(FEATURE_FONT_MSDF); BIND_ENUM_CONSTANT(FEATURE_FONT_SYSTEM); BIND_ENUM_CONSTANT(FEATURE_FONT_VARIABLE); BIND_ENUM_CONSTANT(FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION); @@ -522,7 +528,7 @@ void TextServer::_bind_methods() { BIND_ENUM_CONSTANT(FONT_FIXED_WIDTH); } -Vector2 TextServer::get_hex_code_box_size(int p_size, char32_t p_index) const { +Vector2 TextServer::get_hex_code_box_size(int64_t p_size, int64_t p_index) const { int w = ((p_index <= 0xFF) ? 1 : ((p_index <= 0xFFFF) ? 2 : 3)); int sp = MAX(0, w - 1); int sz = MAX(1, Math::round(p_size / 15.f)); @@ -530,7 +536,7 @@ Vector2 TextServer::get_hex_code_box_size(int p_size, char32_t p_index) const { return Vector2(4 + 3 * w + sp + 1, 15) * sz; } -void TextServer::_draw_hex_code_box_number(RID p_canvas, int p_size, const Vector2 &p_pos, uint8_t p_index, const Color &p_color) const { +void TextServer::_draw_hex_code_box_number(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, uint8_t p_index, const Color &p_color) const { static uint8_t chars[] = { 0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47, 0x00 }; uint8_t x = chars[p_index]; if (x & (1 << 6)) { @@ -556,7 +562,7 @@ void TextServer::_draw_hex_code_box_number(RID p_canvas, int p_size, const Vecto } } -void TextServer::draw_hex_code_box(RID p_canvas, int p_size, const Vector2 &p_pos, char32_t p_index, const Color &p_color) const { +void TextServer::draw_hex_code_box(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { if (p_index == 0) { return; } @@ -600,7 +606,7 @@ void TextServer::draw_hex_code_box(RID p_canvas, int p_size, const Vector2 &p_po } } -PackedInt32Array TextServer::shaped_text_get_line_breaks_adv(RID p_shaped, const PackedFloat32Array &p_width, int p_start, bool p_once, uint16_t /*TextBreakFlag*/ p_break_flags) const { +PackedInt32Array TextServer::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, int64_t /*TextBreakFlag*/ p_break_flags) const { PackedInt32Array lines; ERR_FAIL_COND_V(p_width.is_empty(), lines); @@ -676,13 +682,13 @@ PackedInt32Array TextServer::shaped_text_get_line_breaks_adv(RID p_shaped, const return lines; } -PackedInt32Array TextServer::shaped_text_get_line_breaks(RID p_shaped, float p_width, int p_start, uint16_t /*TextBreakFlag*/ p_break_flags) const { +PackedInt32Array TextServer::shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start, int64_t /*TextBreakFlag*/ p_break_flags) const { PackedInt32Array lines; const_cast<TextServer *>(this)->shaped_text_update_breaks(p_shaped); const Vector2i &range = shaped_text_get_range(p_shaped); - float width = 0.f; + double width = 0.f; int line_start = MAX(p_start, range.x); int last_safe_break = -1; int word_count = 0; @@ -744,7 +750,7 @@ PackedInt32Array TextServer::shaped_text_get_line_breaks(RID p_shaped, float p_w return lines; } -PackedInt32Array TextServer::shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags) const { +PackedInt32Array TextServer::shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags) const { PackedInt32Array words; const_cast<TextServer *>(this)->shaped_text_update_justification_ops(p_shaped); @@ -776,7 +782,7 @@ PackedInt32Array TextServer::shaped_text_get_word_breaks(RID p_shaped, int p_gra return words; } -CaretInfo TextServer::shaped_text_get_carets(RID p_shaped, int p_position) const { +CaretInfo TextServer::shaped_text_get_carets(const RID &p_shaped, int64_t p_position) const { Vector<Rect2> carets; TextServer::Orientation orientation = shaped_text_get_orientation(p_shaped); @@ -926,7 +932,7 @@ CaretInfo TextServer::shaped_text_get_carets(RID p_shaped, int p_position) const return caret; } -Dictionary TextServer::_shaped_text_get_carets_wrapper(RID p_shaped, int p_position) const { +Dictionary TextServer::_shaped_text_get_carets_wrapper(const RID &p_shaped, int64_t p_position) const { Dictionary ret; CaretInfo caret = shaped_text_get_carets(p_shaped, p_position); @@ -939,7 +945,7 @@ Dictionary TextServer::_shaped_text_get_carets_wrapper(RID p_shaped, int p_posit return ret; } -TextServer::Direction TextServer::shaped_text_get_dominant_direction_in_range(RID p_shaped, int p_start, int p_end) const { +TextServer::Direction TextServer::shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const { if (p_start == p_end) { return DIRECTION_AUTO; } @@ -973,7 +979,7 @@ TextServer::Direction TextServer::shaped_text_get_dominant_direction_in_range(RI } } -Vector<Vector2> TextServer::shaped_text_get_selection(RID p_shaped, int p_start, int p_end) const { +Vector<Vector2> TextServer::shaped_text_get_selection(const RID &p_shaped, int64_t p_start, int64_t p_end) const { Vector<Vector2> ranges; if (p_start == p_end) { @@ -1066,9 +1072,9 @@ Vector<Vector2> TextServer::shaped_text_get_selection(RID p_shaped, int p_start, return ranges; } -int TextServer::shaped_text_hit_test_grapheme(RID p_shaped, float p_coords) const { +int64_t TextServer::shaped_text_hit_test_grapheme(const RID &p_shaped, double p_coords) const { // Exact grapheme hit test, return -1 if missed. - float off = 0.0f; + double off = 0.0f; int v_size = shaped_text_get_glyph_count(p_shaped); const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); @@ -1084,7 +1090,7 @@ int TextServer::shaped_text_hit_test_grapheme(RID p_shaped, float p_coords) cons return -1; } -int TextServer::shaped_text_hit_test_position(RID p_shaped, float p_coords) const { +int64_t TextServer::shaped_text_hit_test_position(const RID &p_shaped, double p_coords) const { int v_size = shaped_text_get_glyph_count(p_shaped); const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); @@ -1177,7 +1183,7 @@ int TextServer::shaped_text_hit_test_position(RID p_shaped, float p_coords) cons return 0; } -Vector2 TextServer::shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const { +Vector2 TextServer::shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const { int v_size = shaped_text_get_glyph_count(p_shaped); const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); @@ -1198,7 +1204,7 @@ Vector2 TextServer::shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) con return Vector2(); } -int TextServer::shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const { +int64_t TextServer::shaped_text_next_grapheme_pos(const RID &p_shaped, int64_t p_pos) const { int v_size = shaped_text_get_glyph_count(p_shaped); const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); for (int i = 0; i < v_size; i++) { @@ -1209,7 +1215,7 @@ int TextServer::shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const { return p_pos; } -int TextServer::shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const { +int64_t TextServer::shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p_pos) const { int v_size = shaped_text_get_glyph_count(p_shaped); const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); for (int i = 0; i < v_size; i++) { @@ -1221,7 +1227,7 @@ int TextServer::shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const { return p_pos; } -void TextServer::shaped_text_draw(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l, float p_clip_r, const Color &p_color) const { +void TextServer::shaped_text_draw(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, const Color &p_color) const { TextServer::Orientation orientation = shaped_text_get_orientation(p_shaped); bool hex_codes = shaped_text_get_preserve_control(p_shaped) || shaped_text_get_preserve_invalid(p_shaped); @@ -1318,7 +1324,7 @@ void TextServer::shaped_text_draw(RID p_shaped, RID p_canvas, const Vector2 &p_p } } -void TextServer::shaped_text_draw_outline(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l, float p_clip_r, int p_outline_size, const Color &p_color) const { +void TextServer::shaped_text_draw_outline(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, int64_t p_outline_size, const Color &p_color) const { TextServer::Orientation orientation = shaped_text_get_orientation(p_shaped); bool rtl = (shaped_text_get_inferred_direction(p_shaped) == DIRECTION_RTL); @@ -1538,7 +1544,7 @@ String TextServer::strip_diacritics(const String &p_string) const { return result; } -Array TextServer::_shaped_text_get_glyphs_wrapper(RID p_shaped) const { +Array TextServer::_shaped_text_get_glyphs_wrapper(const RID &p_shaped) const { Array ret; const Glyph *glyphs = shaped_text_get_glyphs(p_shaped); @@ -1563,7 +1569,7 @@ Array TextServer::_shaped_text_get_glyphs_wrapper(RID p_shaped) const { return ret; } -Array TextServer::_shaped_text_sort_logical_wrapper(RID p_shaped) { +Array TextServer::_shaped_text_sort_logical_wrapper(const RID &p_shaped) { Array ret; const Glyph *glyphs = shaped_text_sort_logical(p_shaped); @@ -1588,7 +1594,7 @@ Array TextServer::_shaped_text_sort_logical_wrapper(RID p_shaped) { return ret; } -Array TextServer::_shaped_text_get_ellipsis_glyphs_wrapper(RID p_shaped) const { +Array TextServer::_shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const { Array ret; const Glyph *glyphs = shaped_text_get_ellipsis_glyphs(p_shaped); diff --git a/servers/text_server.h b/servers/text_server.h index 83dc3df56d..365b7ff663 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -102,25 +102,29 @@ public: }; enum SubpixelPositioning { - SUBPIXEL_POSITIONING_DISABLED, - SUBPIXEL_POSITIONING_AUTO, - SUBPIXEL_POSITIONING_ONE_HALF, - SUBPIXEL_POSITIONING_ONE_QUARTER, - }; + SUBPIXEL_POSITIONING_DISABLED = 0, + SUBPIXEL_POSITIONING_AUTO = 1, + SUBPIXEL_POSITIONING_ONE_HALF = 2, + SUBPIXEL_POSITIONING_ONE_QUARTER = 3, - const int SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE = 20; - const int SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE = 16; + SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE = 20, + SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE = 16, + }; enum Feature { - FEATURE_BIDI_LAYOUT = 1 << 0, - FEATURE_VERTICAL_LAYOUT = 1 << 1, - FEATURE_SHAPING = 1 << 2, - FEATURE_KASHIDA_JUSTIFICATION = 1 << 3, - FEATURE_BREAK_ITERATORS = 1 << 4, - FEATURE_FONT_SYSTEM = 1 << 5, - FEATURE_FONT_VARIABLE = 1 << 6, - FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION = 1 << 7, - FEATURE_USE_SUPPORT_DATA = 1 << 8, + FEATURE_SIMPLE_LAYOUT = 1 << 0, + FEATURE_BIDI_LAYOUT = 1 << 1, + FEATURE_VERTICAL_LAYOUT = 1 << 2, + FEATURE_SHAPING = 1 << 3, + FEATURE_KASHIDA_JUSTIFICATION = 1 << 4, + FEATURE_BREAK_ITERATORS = 1 << 5, + FEATURE_FONT_BITMAP = 1 << 6, + FEATURE_FONT_DYNAMIC = 1 << 7, + FEATURE_FONT_MSDF = 1 << 8, + FEATURE_FONT_SYSTEM = 1 << 9, + FEATURE_FONT_VARIABLE = 1 << 10, + FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION = 1 << 11, + FEATURE_USE_SUPPORT_DATA = 1 << 12, }; enum ContourPointTag { @@ -142,62 +146,9 @@ public: FONT_FIXED_WIDTH = 1 << 2, }; - void _draw_hex_code_box_number(RID p_canvas, int p_size, const Vector2 &p_pos, uint8_t p_index, const Color &p_color) const; + void _draw_hex_code_box_number(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, uint8_t p_index, const Color &p_color) const; protected: - struct TrimData { - int trim_pos = -1; - int ellipsis_pos = -1; - Vector<Glyph> ellipsis_glyph_buf; - }; - - struct ShapedTextData { - Mutex mutex; - - /* Source data */ - RID parent; // Substring parent ShapedTextData. - - int start = 0; // Substring start offset in the parent string. - int end = 0; // Substring end offset in the parent string. - - String text; - String custom_punct; - TextServer::Direction direction = DIRECTION_LTR; // Desired text direction. - TextServer::Orientation orientation = ORIENTATION_HORIZONTAL; - - struct EmbeddedObject { - int pos = 0; - InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; - Rect2 rect; - }; - Map<Variant, EmbeddedObject> objects; - - /* Shaped data */ - TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. - bool valid = false; // String is shaped. - bool line_breaks_valid = false; // Line and word break flags are populated (and virtual zero width spaces inserted). - bool justification_ops_valid = false; // Virtual elongation glyphs are added to the string. - bool sort_valid = false; - bool text_trimmed = false; - - bool preserve_invalid = true; // Draw hex code box instead of missing characters. - bool preserve_control = false; // Draw control characters. - - float ascent = 0.f; // Ascent for horizontal layout, 1/2 of width for vertical. - float descent = 0.f; // Descent for horizontal layout, 1/2 of width for vertical. - float width = 0.f; // Width for horizontal layout, height for vertical. - float width_trimmed = 0.f; - - float upos = 0.f; - float uthk = 0.f; - - TrimData overrun_trim_data; - bool fit_width_minimum_reached = false; - - Vector<Glyph> glyphs; - Vector<Glyph> glyphs_logical; - }; - Map<char32_t, char32_t> diacritics_map; void _diacritics_map_add(const String &p_from, char32_t p_to); void _init_diacritics_map(); @@ -207,10 +158,10 @@ protected: public: virtual bool has_feature(Feature p_feature) const = 0; virtual String get_name() const = 0; - virtual uint32_t get_features() const = 0; + virtual int64_t get_features() const = 0; - virtual void free(RID p_rid) = 0; - virtual bool has(RID p_rid) = 0; + virtual void free_rid(const RID &p_rid) = 0; + virtual bool has(const RID &p_rid) = 0; virtual bool load_support_data(const String &p_filename) = 0; virtual String get_support_data_filename() const = 0; @@ -219,251 +170,251 @@ public: virtual bool is_locale_right_to_left(const String &p_locale) const = 0; - virtual int32_t name_to_tag(const String &p_name) const { return 0; }; - virtual String tag_to_name(int32_t p_tag) const { return ""; }; + virtual int64_t name_to_tag(const String &p_name) const { return 0; }; + virtual String tag_to_name(int64_t p_tag) const { return ""; }; /* Font interface */ virtual RID create_font() = 0; - virtual void font_set_data(RID p_font_rid, const PackedByteArray &p_data) = 0; - virtual void font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) = 0; + virtual void font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) = 0; + virtual void font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) = 0; - virtual void font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) = 0; - virtual uint32_t /*FontStyle*/ font_get_style(RID p_font_rid) const = 0; + virtual void font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) = 0; + virtual int64_t /*FontStyle*/ font_get_style(const RID &p_font_rid) const = 0; - virtual void font_set_name(RID p_font_rid, const String &p_name) = 0; - virtual String font_get_name(RID p_font_rid) const = 0; + virtual void font_set_name(const RID &p_font_rid, const String &p_name) = 0; + virtual String font_get_name(const RID &p_font_rid) const = 0; - virtual void font_set_style_name(RID p_font_rid, const String &p_name) = 0; - virtual String font_get_style_name(RID p_font_rid) const = 0; + virtual void font_set_style_name(const RID &p_font_rid, const String &p_name) = 0; + virtual String font_get_style_name(const RID &p_font_rid) const = 0; - virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) = 0; - virtual bool font_is_antialiased(RID p_font_rid) const = 0; + virtual void font_set_antialiased(const RID &p_font_rid, bool p_antialiased) = 0; + virtual bool font_is_antialiased(const RID &p_font_rid) const = 0; - virtual void font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) = 0; - virtual bool font_is_multichannel_signed_distance_field(RID p_font_rid) const = 0; + virtual void font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) = 0; + virtual bool font_is_multichannel_signed_distance_field(const RID &p_font_rid) const = 0; - virtual void font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) = 0; - virtual int font_get_msdf_pixel_range(RID p_font_rid) const = 0; + virtual void font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) = 0; + virtual int64_t font_get_msdf_pixel_range(const RID &p_font_rid) const = 0; - virtual void font_set_msdf_size(RID p_font_rid, int p_msdf_size) = 0; - virtual int font_get_msdf_size(RID p_font_rid) const = 0; + virtual void font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) = 0; + virtual int64_t font_get_msdf_size(const RID &p_font_rid) const = 0; - virtual void font_set_fixed_size(RID p_font_rid, int p_fixed_size) = 0; - virtual int font_get_fixed_size(RID p_font_rid) const = 0; + virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) = 0; + virtual int64_t font_get_fixed_size(const RID &p_font_rid) const = 0; - virtual void font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) = 0; - virtual bool font_is_force_autohinter(RID p_font_rid) const = 0; + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) = 0; + virtual bool font_is_force_autohinter(const RID &p_font_rid) const = 0; - virtual void font_set_hinting(RID p_font_rid, Hinting p_hinting) = 0; - virtual Hinting font_get_hinting(RID p_font_rid) const = 0; + virtual void font_set_hinting(const RID &p_font_rid, Hinting p_hinting) = 0; + virtual Hinting font_get_hinting(const RID &p_font_rid) const = 0; - virtual void font_set_subpixel_positioning(RID p_font_rid, SubpixelPositioning p_subpixel) = 0; - virtual SubpixelPositioning font_get_subpixel_positioning(RID p_font_rid) const = 0; + virtual void font_set_subpixel_positioning(const RID &p_font_rid, SubpixelPositioning p_subpixel) = 0; + virtual SubpixelPositioning font_get_subpixel_positioning(const RID &p_font_rid) const = 0; - virtual void font_set_embolden(RID p_font_rid, float p_strength) = 0; - virtual float font_get_embolden(RID p_font_rid) const = 0; + virtual void font_set_embolden(const RID &p_font_rid, double p_strength) = 0; + virtual double font_get_embolden(const RID &p_font_rid) const = 0; - virtual void font_set_transform(RID p_font_rid, Transform2D p_transform) = 0; - virtual Transform2D font_get_transform(RID p_font_rid) const = 0; + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) = 0; + virtual Transform2D font_get_transform(const RID &p_font_rid) const = 0; - virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) = 0; - virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const = 0; + virtual void font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) = 0; + virtual Dictionary font_get_variation_coordinates(const RID &p_font_rid) const = 0; - virtual void font_set_oversampling(RID p_font_rid, float p_oversampling) = 0; - virtual float font_get_oversampling(RID p_font_rid) const = 0; + virtual void font_set_oversampling(const RID &p_font_rid, double p_oversampling) = 0; + virtual double font_get_oversampling(const RID &p_font_rid) const = 0; - virtual Array font_get_size_cache_list(RID p_font_rid) const = 0; - virtual void font_clear_size_cache(RID p_font_rid) = 0; - virtual void font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) = 0; + virtual Array font_get_size_cache_list(const RID &p_font_rid) const = 0; + virtual void font_clear_size_cache(const RID &p_font_rid) = 0; + virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) = 0; - virtual void font_set_ascent(RID p_font_rid, int p_size, float p_ascent) = 0; - virtual float font_get_ascent(RID p_font_rid, int p_size) const = 0; + virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) = 0; + virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const = 0; - virtual void font_set_descent(RID p_font_rid, int p_size, float p_descent) = 0; - virtual float font_get_descent(RID p_font_rid, int p_size) const = 0; + virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) = 0; + virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const = 0; - virtual void font_set_underline_position(RID p_font_rid, int p_size, float p_underline_position) = 0; - virtual float font_get_underline_position(RID p_font_rid, int p_size) const = 0; + virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) = 0; + virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const = 0; - virtual void font_set_underline_thickness(RID p_font_rid, int p_size, float p_underline_thickness) = 0; - virtual float font_get_underline_thickness(RID p_font_rid, int p_size) const = 0; + virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) = 0; + virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const = 0; - virtual void font_set_scale(RID p_font_rid, int p_size, float p_scale) = 0; - virtual float font_get_scale(RID p_font_rid, int p_size) const = 0; + virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) = 0; + virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const = 0; - virtual void font_set_spacing(RID p_font_rid, int p_size, SpacingType p_spacing, int p_value) = 0; - virtual int font_get_spacing(RID p_font_rid, int p_size, SpacingType p_spacing) const = 0; + virtual void font_set_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing, int64_t p_value) = 0; + virtual int64_t font_get_spacing(const RID &p_font_rid, int64_t p_size, SpacingType p_spacing) const = 0; - virtual int font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const = 0; - virtual void font_clear_textures(RID p_font_rid, const Vector2i &p_size) = 0; - virtual void font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) = 0; + virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const = 0; + virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) = 0; + virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) = 0; - virtual void font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) = 0; - virtual Ref<Image> font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const = 0; + virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) = 0; + virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const = 0; - virtual void font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) = 0; - virtual PackedInt32Array font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const = 0; + virtual void font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) = 0; + virtual PackedInt32Array font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const = 0; - virtual Array font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const = 0; - virtual void font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) = 0; - virtual void font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) = 0; + virtual Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const = 0; + virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) = 0; + virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) = 0; - virtual Vector2 font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const = 0; - virtual void font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) = 0; + virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const = 0; + virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) = 0; - virtual Vector2 font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const = 0; - virtual void font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) = 0; + virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const = 0; + virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) = 0; - virtual Vector2 font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const = 0; - virtual void font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) = 0; + virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const = 0; + virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) = 0; - virtual Rect2 font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const = 0; - virtual void font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) = 0; + virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const = 0; + virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) = 0; - virtual int font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const = 0; - virtual void font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) = 0; + virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const = 0; + virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) = 0; - virtual Dictionary font_get_glyph_contours(RID p_font, int p_size, int32_t p_index) const = 0; + virtual Dictionary font_get_glyph_contours(const RID &p_font, int64_t p_size, int64_t p_index) const = 0; - virtual Array font_get_kerning_list(RID p_font_rid, int p_size) const = 0; - virtual void font_clear_kerning_map(RID p_font_rid, int p_size) = 0; - virtual void font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) = 0; + virtual Array font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const = 0; + virtual void font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) = 0; + virtual void font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) = 0; - virtual void font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) = 0; - virtual Vector2 font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const = 0; + virtual void font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) = 0; + virtual Vector2 font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const = 0; - virtual int32_t font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector) const = 0; + virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const = 0; - virtual bool font_has_char(RID p_font_rid, char32_t p_char) const = 0; - virtual String font_get_supported_chars(RID p_font_rid) const = 0; + virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const = 0; + virtual String font_get_supported_chars(const RID &p_font_rid) const = 0; - virtual void font_render_range(RID p_font, const Vector2i &p_size, char32_t p_start, char32_t p_end) = 0; - virtual void font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) = 0; + virtual void font_render_range(const RID &p_font, const Vector2i &p_size, int64_t p_start, int64_t p_end) = 0; + virtual void font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) = 0; - virtual void font_draw_glyph(RID p_font, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const = 0; - virtual void font_draw_glyph_outline(RID p_font, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const = 0; + virtual void font_draw_glyph(const RID &p_font, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const = 0; + virtual void font_draw_glyph_outline(const RID &p_font, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color = Color(1, 1, 1)) const = 0; - virtual bool font_is_language_supported(RID p_font_rid, const String &p_language) const = 0; - virtual void font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) = 0; - virtual bool font_get_language_support_override(RID p_font_rid, const String &p_language) = 0; - virtual void font_remove_language_support_override(RID p_font_rid, const String &p_language) = 0; - virtual Vector<String> font_get_language_support_overrides(RID p_font_rid) = 0; + virtual bool font_is_language_supported(const RID &p_font_rid, const String &p_language) const = 0; + virtual void font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) = 0; + virtual bool font_get_language_support_override(const RID &p_font_rid, const String &p_language) = 0; + virtual void font_remove_language_support_override(const RID &p_font_rid, const String &p_language) = 0; + virtual PackedStringArray font_get_language_support_overrides(const RID &p_font_rid) = 0; - virtual bool font_is_script_supported(RID p_font_rid, const String &p_script) const = 0; - virtual void font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) = 0; - virtual bool font_get_script_support_override(RID p_font_rid, const String &p_script) = 0; - virtual void font_remove_script_support_override(RID p_font_rid, const String &p_script) = 0; - virtual Vector<String> font_get_script_support_overrides(RID p_font_rid) = 0; + virtual bool font_is_script_supported(const RID &p_font_rid, const String &p_script) const = 0; + virtual void font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) = 0; + virtual bool font_get_script_support_override(const RID &p_font_rid, const String &p_script) = 0; + virtual void font_remove_script_support_override(const RID &p_font_rid, const String &p_script) = 0; + virtual PackedStringArray font_get_script_support_overrides(const RID &p_font_rid) = 0; - virtual void font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) = 0; - virtual Dictionary font_get_opentype_feature_overrides(RID p_font_rid) const = 0; + virtual void font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) = 0; + virtual Dictionary font_get_opentype_feature_overrides(const RID &p_font_rid) const = 0; - virtual Dictionary font_supported_feature_list(RID p_font_rid) const = 0; - virtual Dictionary font_supported_variation_list(RID p_font_rid) const = 0; + virtual Dictionary font_supported_feature_list(const RID &p_font_rid) const = 0; + virtual Dictionary font_supported_variation_list(const RID &p_font_rid) const = 0; - virtual float font_get_global_oversampling() const = 0; - virtual void font_set_global_oversampling(float p_oversampling) = 0; + virtual double font_get_global_oversampling() const = 0; + virtual void font_set_global_oversampling(double p_oversampling) = 0; - virtual Vector2 get_hex_code_box_size(int p_size, char32_t p_index) const; - virtual void draw_hex_code_box(RID p_canvas, int p_size, const Vector2 &p_pos, char32_t p_index, const Color &p_color) const; + virtual Vector2 get_hex_code_box_size(int64_t p_size, int64_t p_index) const; + virtual void draw_hex_code_box(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const; /* Shaped text buffer interface */ virtual RID create_shaped_text(Direction p_direction = DIRECTION_AUTO, Orientation p_orientation = ORIENTATION_HORIZONTAL) = 0; - virtual void shaped_text_clear(RID p_shaped) = 0; + virtual void shaped_text_clear(const RID &p_shaped) = 0; - virtual void shaped_text_set_direction(RID p_shaped, Direction p_direction = DIRECTION_AUTO) = 0; - virtual Direction shaped_text_get_direction(RID p_shaped) const = 0; - virtual Direction shaped_text_get_inferred_direction(RID p_shaped) const = 0; + virtual void shaped_text_set_direction(const RID &p_shaped, Direction p_direction = DIRECTION_AUTO) = 0; + virtual Direction shaped_text_get_direction(const RID &p_shaped) const = 0; + virtual Direction shaped_text_get_inferred_direction(const RID &p_shaped) const = 0; - virtual void shaped_text_set_bidi_override(RID p_shaped, const Array &p_override) = 0; + virtual void shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) = 0; - virtual void shaped_text_set_custom_punctuation(RID p_shaped, const String &p_punct) = 0; - virtual String shaped_text_get_custom_punctuation(RID p_shaped) const = 0; + virtual void shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) = 0; + virtual String shaped_text_get_custom_punctuation(const RID &p_shaped) const = 0; - virtual void shaped_text_set_orientation(RID p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) = 0; - virtual Orientation shaped_text_get_orientation(RID p_shaped) const = 0; + virtual void shaped_text_set_orientation(const RID &p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) = 0; + virtual Orientation shaped_text_get_orientation(const RID &p_shaped) const = 0; - virtual void shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) = 0; - virtual bool shaped_text_get_preserve_invalid(RID p_shaped) const = 0; + virtual void shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) = 0; + virtual bool shaped_text_get_preserve_invalid(const RID &p_shaped) const = 0; - virtual void shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) = 0; - virtual bool shaped_text_get_preserve_control(RID p_shaped) const = 0; + virtual void shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) = 0; + virtual bool shaped_text_get_preserve_control(const RID &p_shaped) const = 0; - virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) = 0; - virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) = 0; - virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) = 0; + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) = 0; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) = 0; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) = 0; - virtual int shaped_get_span_count(RID p_shaped) const = 0; - virtual Variant shaped_get_span_meta(RID p_shaped, int p_index) const = 0; - virtual void shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary()) = 0; + virtual int64_t shaped_get_span_count(const RID &p_shaped) const = 0; + virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const = 0; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) = 0; - virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const = 0; // Copy shaped substring (e.g. line break) without reshaping, but correctly reordered, preservers range. - virtual RID shaped_text_get_parent(RID p_shaped) const = 0; + virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const = 0; // Copy shaped substring (e.g. line break) without reshaping, but correctly reordered, preservers range. + virtual RID shaped_text_get_parent(const RID &p_shaped) const = 0; - virtual float shaped_text_fit_to_width(RID p_shaped, float p_width, uint16_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) = 0; - virtual float shaped_text_tab_align(RID p_shaped, const PackedFloat32Array &p_tab_stops) = 0; + virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) = 0; + virtual double shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) = 0; - virtual bool shaped_text_shape(RID p_shaped) = 0; - virtual bool shaped_text_update_breaks(RID p_shaped) = 0; - virtual bool shaped_text_update_justification_ops(RID p_shaped) = 0; + virtual bool shaped_text_shape(const RID &p_shaped) = 0; + virtual bool shaped_text_update_breaks(const RID &p_shaped) = 0; + virtual bool shaped_text_update_justification_ops(const RID &p_shaped) = 0; - virtual bool shaped_text_is_ready(RID p_shaped) const = 0; + virtual bool shaped_text_is_ready(const RID &p_shaped) const = 0; - virtual const Glyph *shaped_text_get_glyphs(RID p_shaped) const = 0; - Array _shaped_text_get_glyphs_wrapper(RID p_shaped) const; - virtual const Glyph *shaped_text_sort_logical(RID p_shaped) = 0; - Array _shaped_text_sort_logical_wrapper(RID p_shaped); - virtual int shaped_text_get_glyph_count(RID p_shaped) const = 0; + virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const = 0; + Array _shaped_text_get_glyphs_wrapper(const RID &p_shaped) const; + virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) = 0; + Array _shaped_text_sort_logical_wrapper(const RID &p_shaped); + virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const = 0; - virtual Vector2i shaped_text_get_range(RID p_shaped) const = 0; + virtual Vector2i shaped_text_get_range(const RID &p_shaped) const = 0; - virtual PackedInt32Array shaped_text_get_line_breaks_adv(RID p_shaped, const PackedFloat32Array &p_width, int p_start = 0, bool p_once = true, uint16_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const; - virtual PackedInt32Array shaped_text_get_line_breaks(RID p_shaped, float p_width, int p_start = 0, uint16_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const; - virtual PackedInt32Array shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const; + virtual PackedInt32Array shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start = 0, bool p_once = true, int64_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const; + virtual PackedInt32Array shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start = 0, int64_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const; + virtual PackedInt32Array shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const; - virtual int shaped_text_get_trim_pos(RID p_shaped) const = 0; - virtual int shaped_text_get_ellipsis_pos(RID p_shaped) const = 0; - virtual const Glyph *shaped_text_get_ellipsis_glyphs(RID p_shaped) const = 0; - Array _shaped_text_get_ellipsis_glyphs_wrapper(RID p_shaped) const; - virtual int shaped_text_get_ellipsis_glyph_count(RID p_shaped) const = 0; + virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const = 0; + virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const = 0; + virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const = 0; + Array _shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const; + virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const = 0; - virtual void shaped_text_overrun_trim_to_width(RID p_shaped, float p_width, uint16_t p_trim_flags) = 0; + virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, int64_t p_trim_flags) = 0; - virtual Array shaped_text_get_objects(RID p_shaped) const = 0; - virtual Rect2 shaped_text_get_object_rect(RID p_shaped, Variant p_key) const = 0; + virtual Array shaped_text_get_objects(const RID &p_shaped) const = 0; + virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const = 0; - virtual Size2 shaped_text_get_size(RID p_shaped) const = 0; - virtual float shaped_text_get_ascent(RID p_shaped) const = 0; - virtual float shaped_text_get_descent(RID p_shaped) const = 0; - virtual float shaped_text_get_width(RID p_shaped) const = 0; - virtual float shaped_text_get_underline_position(RID p_shaped) const = 0; - virtual float shaped_text_get_underline_thickness(RID p_shaped) const = 0; + virtual Size2 shaped_text_get_size(const RID &p_shaped) const = 0; + virtual double shaped_text_get_ascent(const RID &p_shaped) const = 0; + virtual double shaped_text_get_descent(const RID &p_shaped) const = 0; + virtual double shaped_text_get_width(const RID &p_shaped) const = 0; + virtual double shaped_text_get_underline_position(const RID &p_shaped) const = 0; + virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const = 0; - virtual Direction shaped_text_get_dominant_direction_in_range(RID p_shaped, int p_start, int p_end) const; + virtual Direction shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const; - virtual CaretInfo shaped_text_get_carets(RID p_shaped, int p_position) const; - Dictionary _shaped_text_get_carets_wrapper(RID p_shaped, int p_position) const; + virtual CaretInfo shaped_text_get_carets(const RID &p_shaped, int64_t p_position) const; + Dictionary _shaped_text_get_carets_wrapper(const RID &p_shaped, int64_t p_position) const; - virtual Vector<Vector2> shaped_text_get_selection(RID p_shaped, int p_start, int p_end) const; + virtual Vector<Vector2> shaped_text_get_selection(const RID &p_shaped, int64_t p_start, int64_t p_end) const; - virtual int shaped_text_hit_test_grapheme(RID p_shaped, float p_coords) const; // Return grapheme index. - virtual int shaped_text_hit_test_position(RID p_shaped, float p_coords) const; // Return caret/selection position. + virtual int64_t shaped_text_hit_test_grapheme(const RID &p_shaped, double p_coords) const; // Return grapheme index. + virtual int64_t shaped_text_hit_test_position(const RID &p_shaped, double p_coords) const; // Return caret/selection position. - virtual Vector2 shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const; - virtual int shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const; - virtual int shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const; + virtual Vector2 shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const; + virtual int64_t shaped_text_next_grapheme_pos(const RID &p_shaped, int64_t p_pos) const; + virtual int64_t shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p_pos) const; // The pen position is always placed on the baseline and moveing left to right. - virtual void shaped_text_draw(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l = -1.f, float p_clip_r = -1.f, const Color &p_color = Color(1, 1, 1)) const; - virtual void shaped_text_draw_outline(RID p_shaped, RID p_canvas, const Vector2 &p_pos, float p_clip_l = -1.f, float p_clip_r = -1.f, int p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const; + virtual void shaped_text_draw(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l = -1.0, double p_clip_r = -1.0, const Color &p_color = Color(1, 1, 1)) const; + virtual void shaped_text_draw_outline(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l = -1.0, double p_clip_r = -1.0, int64_t p_outline_size = 1, const Color &p_color = Color(1, 1, 1)) const; // Number conversion. - virtual String format_number(const String &p_string, const String &p_language = "") const { return p_string; }; - virtual String parse_number(const String &p_string, const String &p_language = "") const { return p_string; }; - virtual String percent_sign(const String &p_language = "") const { return "%"; }; + virtual String format_number(const String &p_string, const String &p_language = "") const = 0; + virtual String parse_number(const String &p_string, const String &p_language = "") const = 0; + virtual String percent_sign(const String &p_language = "") const = 0; virtual String strip_diacritics(const String &p_string) const; @@ -507,23 +458,6 @@ struct CaretInfo { TextServer::Direction t_dir; }; -struct GlyphCompare { // For line breaking reordering. - _FORCE_INLINE_ bool operator()(const Glyph &l, const Glyph &r) const { - if (l.start == r.start) { - if (l.count == r.count) { - if ((l.flags & TextServer::GRAPHEME_IS_VIRTUAL) == TextServer::GRAPHEME_IS_VIRTUAL) { - return false; - } else { - return true; - } - } - return l.count > r.count; // Sort first glyph with count & flags, order of the rest are irrelevant. - } else { - return l.start < r.start; - } - } -}; - /*************************************************************************/ class TextServerManager : public Object { diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h index e4145c8408..5cf5403a50 100644 --- a/tests/core/object/test_class_db.h +++ b/tests/core/object/test_class_db.h @@ -671,10 +671,6 @@ void add_exposed_classes(Context &r_context) { } else { exposed_class.methods.push_back(method); } - - if (method.is_virtual) { - TEST_COND(String(method.name)[0] != '_', "Virtual method ", String(method.name), " does not start with underscore."); - } } // Add signals diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h index 8bd35df107..0e0d2a218c 100644 --- a/tests/scene/test_code_edit.h +++ b/tests/scene/test_code_edit.h @@ -2901,291 +2901,293 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { } SUBCASE("[CodeEdit] autocomplete completion") { - CHECK(code_edit->get_code_completion_selected_index() == -1); - code_edit->set_code_completion_enabled(true); - CHECK(code_edit->get_code_completion_selected_index() == -1); - - code_edit->update_code_completion_options(); - code_edit->set_code_completion_selected_index(1); - CHECK(code_edit->get_code_completion_selected_index() == -1); - CHECK(code_edit->get_code_completion_option(0).size() == 0); - CHECK(code_edit->get_code_completion_options().size() == 0); - - /* Adding does not update the list. */ - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_0.", "item_0"); - - code_edit->set_code_completion_selected_index(1); - CHECK(code_edit->get_code_completion_selected_index() == -1); - CHECK(code_edit->get_code_completion_option(0).size() == 0); - CHECK(code_edit->get_code_completion_options().size() == 0); - - /* After update, pending add should not be counted, */ - /* also does not work on col 0 */ - code_edit->insert_text_at_caret("i"); - code_edit->update_code_completion_options(); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0", Color(1, 0, 0), RES(), Color(1, 0, 0)); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_1.", "item_1"); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_2.", "item_2"); - - ERR_PRINT_OFF; - code_edit->set_code_completion_selected_index(1); - ERR_PRINT_ON; - CHECK(code_edit->get_code_completion_selected_index() == 0); - CHECK(code_edit->get_code_completion_option(0).size() == 6); - CHECK(code_edit->get_code_completion_options().size() == 1); - - /* Check cancel closes completion. */ - SEND_GUI_ACTION(code_edit, "ui_cancel"); - CHECK(code_edit->get_code_completion_selected_index() == -1); - - code_edit->update_code_completion_options(); - CHECK(code_edit->get_code_completion_selected_index() == 0); - code_edit->set_code_completion_selected_index(1); - CHECK(code_edit->get_code_completion_selected_index() == 1); - CHECK(code_edit->get_code_completion_option(0).size() == 6); - CHECK(code_edit->get_code_completion_options().size() == 3); - - /* Check data. */ - Dictionary option = code_edit->get_code_completion_option(0); - CHECK((int)option["kind"] == (int)CodeEdit::CodeCompletionKind::KIND_CLASS); - CHECK(option["display_text"] == "item_0."); - CHECK(option["insert_text"] == "item_0"); - CHECK(option["font_color"] == Color(1, 0, 0)); - CHECK(option["icon"] == RES()); - CHECK(option["default_value"] == Color(1, 0, 0)); - - /* Set size for mouse input. */ - code_edit->set_size(Size2(100, 100)); - - /* Check input. */ - SEND_GUI_ACTION(code_edit, "ui_end"); - CHECK(code_edit->get_code_completion_selected_index() == 2); - - SEND_GUI_ACTION(code_edit, "ui_home"); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_ACTION(code_edit, "ui_page_down"); - CHECK(code_edit->get_code_completion_selected_index() == 2); - - SEND_GUI_ACTION(code_edit, "ui_page_up"); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_ACTION(code_edit, "ui_up"); - CHECK(code_edit->get_code_completion_selected_index() == 2); - - SEND_GUI_ACTION(code_edit, "ui_down"); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_KEY_EVENT(code_edit, Key::T); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_ACTION(code_edit, "ui_left"); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_ACTION(code_edit, "ui_right"); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); - CHECK(code_edit->get_code_completion_selected_index() == 0); + if (TS->has_feature(TextServer::FEATURE_FONT_DYNAMIC) && TS->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + CHECK(code_edit->get_code_completion_selected_index() == -1); + code_edit->set_code_completion_enabled(true); + CHECK(code_edit->get_code_completion_selected_index() == -1); + + code_edit->update_code_completion_options(); + code_edit->set_code_completion_selected_index(1); + CHECK(code_edit->get_code_completion_selected_index() == -1); + CHECK(code_edit->get_code_completion_option(0).size() == 0); + CHECK(code_edit->get_code_completion_options().size() == 0); + + /* Adding does not update the list. */ + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_0.", "item_0"); + + code_edit->set_code_completion_selected_index(1); + CHECK(code_edit->get_code_completion_selected_index() == -1); + CHECK(code_edit->get_code_completion_option(0).size() == 0); + CHECK(code_edit->get_code_completion_options().size() == 0); + + /* After update, pending add should not be counted, */ + /* also does not work on col 0 */ + code_edit->insert_text_at_caret("i"); + code_edit->update_code_completion_options(); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0", Color(1, 0, 0), RES(), Color(1, 0, 0)); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_1.", "item_1"); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_VARIABLE, "item_2.", "item_2"); - Point2 caret_pos = code_edit->get_caret_draw_pos(); - caret_pos.y -= code_edit->get_line_height(); - SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_DOWN, MouseButton::NONE); - CHECK(code_edit->get_code_completion_selected_index() == 1); - - SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_UP, MouseButton::NONE); - CHECK(code_edit->get_code_completion_selected_index() == 0); - - /* Single click selects. */ - SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::LEFT, MouseButton::MASK_LEFT); - CHECK(code_edit->get_code_completion_selected_index() == 2); - - /* Double click inserts. */ - SEND_GUI_DOUBLE_CLICK(code_edit, caret_pos); - CHECK(code_edit->get_code_completion_selected_index() == -1); - CHECK(code_edit->get_line(0) == "item_2"); + ERR_PRINT_OFF; + code_edit->set_code_completion_selected_index(1); + ERR_PRINT_ON; + CHECK(code_edit->get_code_completion_selected_index() == 0); + CHECK(code_edit->get_code_completion_option(0).size() == 6); + CHECK(code_edit->get_code_completion_options().size() == 1); - code_edit->set_auto_brace_completion_enabled(false); + /* Check cancel closes completion. */ + SEND_GUI_ACTION(code_edit, "ui_cancel"); + CHECK(code_edit->get_code_completion_selected_index() == -1); - /* Does nothing in readonly. */ - code_edit->undo(); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - code_edit->set_editable(false); - code_edit->confirm_code_completion(); - code_edit->set_editable(true); - CHECK(code_edit->get_line(0) == "i"); + code_edit->update_code_completion_options(); + CHECK(code_edit->get_code_completion_selected_index() == 0); + code_edit->set_code_completion_selected_index(1); + CHECK(code_edit->get_code_completion_selected_index() == 1); + CHECK(code_edit->get_code_completion_option(0).size() == 6); + CHECK(code_edit->get_code_completion_options().size() == 3); - /* Replace */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0 test"); + /* Check data. */ + Dictionary option = code_edit->get_code_completion_option(0); + CHECK((int)option["kind"] == (int)CodeEdit::CodeCompletionKind::KIND_CLASS); + CHECK(option["display_text"] == "item_0."); + CHECK(option["insert_text"] == "item_0"); + CHECK(option["font_color"] == Color(1, 0, 0)); + CHECK(option["icon"] == RES()); + CHECK(option["default_value"] == Color(1, 0, 0)); - /* Replace string. */ - code_edit->clear(); - code_edit->insert_text_at_caret("\"item_1 test\""); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "\"item_0\""); + /* Set size for mouse input. */ + code_edit->set_size(Size2(100, 100)); - /* Normal replace if no end is given. */ - code_edit->clear(); - code_edit->insert_text_at_caret("\"item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "\"item_0\" test"); + /* Check input. */ + SEND_GUI_ACTION(code_edit, "ui_end"); + CHECK(code_edit->get_code_completion_selected_index() == 2); - /* Insert at completion. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); - CHECK(code_edit->get_line(0) == "item_01 test"); + SEND_GUI_ACTION(code_edit, "ui_home"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* Insert at completion with string should have same output. */ - code_edit->clear(); - code_edit->insert_text_at_caret("\"item_1 test\""); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); - CHECK(code_edit->get_line(0) == "\"item_0\"1 test\""); + SEND_GUI_ACTION(code_edit, "ui_page_down"); + CHECK(code_edit->get_code_completion_selected_index() == 2); - /* Merge symbol at end on insert text. */ - /* End on completion entry. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0( test"); - CHECK(code_edit->get_caret_column() == 7); + SEND_GUI_ACTION(code_edit, "ui_page_up"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* End of text*/ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1( test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0( test"); - CHECK(code_edit->get_caret_column() == 6); + SEND_GUI_ACTION(code_edit, "ui_up"); + CHECK(code_edit->get_code_completion_selected_index() == 2); - /* End of both. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1( test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0( test"); - CHECK(code_edit->get_caret_column() == 7); + SEND_GUI_ACTION(code_edit, "ui_down"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* Full set. */ - /* End on completion entry. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 8); + SEND_GUI_KEY_EVENT(code_edit, Key::T); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* End of text*/ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1() test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 6); + SEND_GUI_ACTION(code_edit, "ui_left"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* End of both. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1() test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 8); + SEND_GUI_ACTION(code_edit, "ui_right"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* Autobrace completion. */ - code_edit->set_auto_brace_completion_enabled(true); + SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* End on completion entry. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 7); + Point2 caret_pos = code_edit->get_caret_draw_pos(); + caret_pos.y -= code_edit->get_line_height(); + SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_DOWN, MouseButton::NONE); + CHECK(code_edit->get_code_completion_selected_index() == 1); - /* End of text*/ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1( test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0( test"); - CHECK(code_edit->get_caret_column() == 6); + SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_UP, MouseButton::NONE); + CHECK(code_edit->get_code_completion_selected_index() == 0); - /* End of both. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1( test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0( test"); - CHECK(code_edit->get_caret_column() == 7); + /* Single click selects. */ + SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::LEFT, MouseButton::MASK_LEFT); + CHECK(code_edit->get_code_completion_selected_index() == 2); - /* Full set. */ - /* End on completion entry. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1 test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 8); + /* Double click inserts. */ + SEND_GUI_DOUBLE_CLICK(code_edit, caret_pos); + CHECK(code_edit->get_code_completion_selected_index() == -1); + CHECK(code_edit->get_line(0) == "item_2"); - /* End of text*/ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1() test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 6); + code_edit->set_auto_brace_completion_enabled(false); - /* End of both. */ - code_edit->clear(); - code_edit->insert_text_at_caret("item_1() test"); - code_edit->set_caret_column(2); - code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); - code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); - CHECK(code_edit->get_line(0) == "item_0() test"); - CHECK(code_edit->get_caret_column() == 8); + /* Does nothing in readonly. */ + code_edit->undo(); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + code_edit->set_editable(false); + code_edit->confirm_code_completion(); + code_edit->set_editable(true); + CHECK(code_edit->get_line(0) == "i"); + + /* Replace */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0 test"); + + /* Replace string. */ + code_edit->clear(); + code_edit->insert_text_at_caret("\"item_1 test\""); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "\"item_0\""); + + /* Normal replace if no end is given. */ + code_edit->clear(); + code_edit->insert_text_at_caret("\"item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "\"item_0\" test"); + + /* Insert at completion. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); + CHECK(code_edit->get_line(0) == "item_01 test"); + + /* Insert at completion with string should have same output. */ + code_edit->clear(); + code_edit->insert_text_at_caret("\"item_1 test\""); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); + CHECK(code_edit->get_line(0) == "\"item_0\"1 test\""); + + /* Merge symbol at end on insert text. */ + /* End on completion entry. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0( test"); + CHECK(code_edit->get_caret_column() == 7); + + /* End of text*/ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1( test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0( test"); + CHECK(code_edit->get_caret_column() == 6); + + /* End of both. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1( test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0( test"); + CHECK(code_edit->get_caret_column() == 7); + + /* Full set. */ + /* End on completion entry. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 8); + + /* End of text*/ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1() test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 6); + + /* End of both. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1() test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 8); + + /* Autobrace completion. */ + code_edit->set_auto_brace_completion_enabled(true); + + /* End on completion entry. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 7); + + /* End of text*/ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1( test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0( test"); + CHECK(code_edit->get_caret_column() == 6); + + /* End of both. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1( test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0( test"); + CHECK(code_edit->get_caret_column() == 7); + + /* Full set. */ + /* End on completion entry. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1 test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 8); + + /* End of text*/ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1() test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 6); + + /* End of both. */ + code_edit->clear(); + code_edit->insert_text_at_caret("item_1() test"); + code_edit->set_caret_column(2); + code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); + code_edit->update_code_completion_options(); + SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + CHECK(code_edit->get_line(0) == "item_0() test"); + CHECK(code_edit->get_caret_column() == 8); + } } memdelete(code_edit); @@ -3198,33 +3200,35 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") { code_edit->set_symbol_lookup_on_click_enabled(true); CHECK(code_edit->is_symbol_lookup_on_click_enabled()); - /* Set size for mouse input. */ - code_edit->set_size(Size2(100, 100)); + if (TS->has_feature(TextServer::FEATURE_FONT_DYNAMIC) && TS->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + /* Set size for mouse input. */ + code_edit->set_size(Size2(100, 100)); - code_edit->set_text("this is some text"); + code_edit->set_text("this is some text"); - Point2 caret_pos = code_edit->get_caret_draw_pos(); - caret_pos.x += 58; - SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::NONE, MouseButton::NONE); - CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text"); + Point2 caret_pos = code_edit->get_caret_draw_pos(); + caret_pos.x += 58; + SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::NONE, MouseButton::NONE); + CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text"); - SIGNAL_WATCH(code_edit, "symbol_validate"); + SIGNAL_WATCH(code_edit, "symbol_validate"); #ifdef OSX_ENABLED - SEND_GUI_KEY_EVENT(code_edit, Key::META); + SEND_GUI_KEY_EVENT(code_edit, Key::META); #else - SEND_GUI_KEY_EVENT(code_edit, Key::CTRL); + SEND_GUI_KEY_EVENT(code_edit, Key::CTRL); #endif - Array signal_args; - Array arg; - arg.push_back("some"); - signal_args.push_back(arg); - SIGNAL_CHECK("symbol_validate", signal_args); + Array signal_args; + Array arg; + arg.push_back("some"); + signal_args.push_back(arg); + SIGNAL_CHECK("symbol_validate", signal_args); - SIGNAL_UNWATCH(code_edit, "symbol_validate"); + SIGNAL_UNWATCH(code_edit, "symbol_validate"); - memdelete(code_edit); + memdelete(code_edit); + } } TEST_CASE("[SceneTree][CodeEdit] line length guidelines") { diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.h index 0a64237285..d7de94516f 100644 --- a/tests/servers/test_text_server.h +++ b/tests/servers/test_text_server.h @@ -46,10 +46,14 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC)) { + continue; + } + RID font = ts->create_font(); ts->font_set_data_ptr(font, _font_NotoSans_Regular, _font_NotoSans_Regular_size); TEST_FAIL_COND(font == RID(), "Loading font failed."); - ts->free(font); + ts->free_rid(font); } } @@ -58,12 +62,16 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC) || !ts->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + continue; + } + RID font1 = ts->create_font(); ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size); RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size); - Vector<RID> font; + Array font; font.push_back(font1); font.push_back(font2); @@ -93,10 +101,10 @@ TEST_SUITE("[[TextServer]") { TEST_FAIL_COND(glyphs[j].font_size != 16, "Incorrect glyph font size."); } - ts->free(ctx); + ts->free_rid(ctx); for (int j = 0; j < font.size(); j++) { - ts->free(font[j]); + ts->free_rid(font[j]); } font.clear(); } @@ -107,7 +115,7 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); - if (!ts->has_feature(TextServer::FEATURE_BIDI_LAYOUT)) { + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC) || !ts->has_feature(TextServer::FEATURE_BIDI_LAYOUT)) { continue; } @@ -116,7 +124,7 @@ TEST_SUITE("[[TextServer]") { RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size); - Vector<RID> font; + Array font; font.push_back(font1); font.push_back(font2); @@ -145,10 +153,10 @@ TEST_SUITE("[[TextServer]") { } } - ts->free(ctx); + ts->free_rid(ctx); for (int j = 0; j < font.size(); j++) { - ts->free(font[j]); + ts->free_rid(font[j]); } font.clear(); } @@ -159,6 +167,10 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC) || !ts->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + continue; + } + RID font1 = ts->create_font(); ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size); RID font2 = ts->create_font(); @@ -166,7 +178,7 @@ TEST_SUITE("[[TextServer]") { RID font3 = ts->create_font(); ts->font_set_data_ptr(font3, _font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size); - Vector<RID> font; + Array font; font.push_back(font1); font.push_back(font2); font.push_back(font3); @@ -198,7 +210,7 @@ TEST_SUITE("[[TextServer]") { TEST_FAIL_COND((soft || space || hard || virt || elo), "Invalid glyph flags."); } } - ts->free(ctx); + ts->free_rid(ctx); } { @@ -241,7 +253,7 @@ TEST_SUITE("[[TextServer]") { } } } - ts->free(ctx); + ts->free_rid(ctx); } { @@ -294,7 +306,7 @@ TEST_SUITE("[[TextServer]") { } } - ts->free(ctx); + ts->free_rid(ctx); } { @@ -322,7 +334,7 @@ TEST_SUITE("[[TextServer]") { TEST_FAIL_COND((soft || space || hard || virt || elo), "Invalid glyph flags."); } } - ts->free(ctx); + ts->free_rid(ctx); } if (ts->has_feature(TextServer::FEATURE_BREAK_ITERATORS)) { @@ -350,11 +362,11 @@ TEST_SUITE("[[TextServer]") { TEST_FAIL_COND((soft || space || hard || virt || elo), "Invalid glyph flags."); } } - ts->free(ctx); + ts->free_rid(ctx); } for (int j = 0; j < font.size(); j++) { - ts->free(font[j]); + ts->free_rid(font[j]); } font.clear(); } @@ -365,6 +377,10 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC) || !ts->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + continue; + } + String test_1 = U"test test test"; // 5^ 10^ @@ -373,7 +389,7 @@ TEST_SUITE("[[TextServer]") { RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size); - Vector<RID> font; + Array font; font.push_back(font1); font.push_back(font2); @@ -395,10 +411,10 @@ TEST_SUITE("[[TextServer]") { TEST_FAIL_COND(brks[5] != 14, "Invalid line break position."); } - ts->free(ctx); + ts->free_rid(ctx); for (int j = 0; j < font.size(); j++) { - ts->free(font[j]); + ts->free_rid(font[j]); } font.clear(); } @@ -409,12 +425,16 @@ TEST_SUITE("[[TextServer]") { Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(i); TEST_FAIL_COND(ts.is_null(), "Invalid TS interface."); + if (!ts->has_feature(TextServer::FEATURE_FONT_DYNAMIC) || !ts->has_feature(TextServer::FEATURE_SIMPLE_LAYOUT)) { + continue; + } + RID font1 = ts->create_font(); ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size); RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size); - Vector<RID> font; + Array font; font.push_back(font1); font.push_back(font2); @@ -438,7 +458,7 @@ TEST_SUITE("[[TextServer]") { width = ts->shaped_text_fit_to_width(ctx, 100, TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA); TEST_FAIL_COND((width <= width_old || width > 100), "Invalid fill width."); - ts->free(ctx); + ts->free_rid(ctx); ctx = ts->create_shaped_text(); TEST_FAIL_COND(ctx == RID(), "Creating text buffer failed."); @@ -451,7 +471,7 @@ TEST_SUITE("[[TextServer]") { width = ts->shaped_text_fit_to_width(ctx, 100, TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA); TEST_FAIL_COND((width <= width_old || width > 100), "Invalid fill width."); - ts->free(ctx); + ts->free_rid(ctx); } ctx = ts->create_shaped_text(); @@ -463,10 +483,10 @@ TEST_SUITE("[[TextServer]") { width = ts->shaped_text_fit_to_width(ctx, 100, TextServer::JUSTIFICATION_WORD_BOUND); TEST_FAIL_COND((width <= width_old || width > 100), "Invalid fill width."); - ts->free(ctx); + ts->free_rid(ctx); for (int j = 0; j < font.size(); j++) { - ts->free(font[j]); + ts->free_rid(font[j]); } font.clear(); } diff --git a/thirdparty/README.md b/thirdparty/README.md index c8ea18a4e3..2b90fb1657 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -204,7 +204,7 @@ Files extracted from upstream source: ## harfbuzz - Upstream: https://github.com/harfbuzz/harfbuzz -- Version: 4.0.0 (8d1b000a3edc90c12267b836b4ef3f81c0e53edc, 2022) +- Version: 4.0.1 (1f79ba9407ecd54e382997940cbcc3fb71bef8be, 2022) - License: MIT Files extracted from upstream source: diff --git a/thirdparty/harfbuzz/src/hb-aat-layout.cc b/thirdparty/harfbuzz/src/hb-aat-layout.cc index e2d4de2ccd..caff204d67 100644 --- a/thirdparty/harfbuzz/src/hb-aat-layout.cc +++ b/thirdparty/harfbuzz/src/hb-aat-layout.cc @@ -108,7 +108,7 @@ static const hb_aat_feature_mapping_t feature_mappings[] = {HB_TAG ('f','r','a','c'), HB_AAT_LAYOUT_FEATURE_TYPE_FRACTIONS, HB_AAT_LAYOUT_FEATURE_SELECTOR_DIAGONAL_FRACTIONS, HB_AAT_LAYOUT_FEATURE_SELECTOR_NO_FRACTIONS}, {HB_TAG ('f','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_FEATURE_SELECTOR_MONOSPACED_TEXT, (hb_aat_layout_feature_selector_t) 7}, {HB_TAG ('h','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALT_HALF_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7}, - {HB_TAG ('h','i','s','t'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_FEATURE_SELECTOR_HISTORICAL_LIGATURES_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_HISTORICAL_LIGATURES_OFF}, + {HB_TAG ('h','i','s','t'), (hb_aat_layout_feature_type_t) 40, (hb_aat_layout_feature_selector_t) 0, (hb_aat_layout_feature_selector_t) 1}, {HB_TAG ('h','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_ALTERNATE_KANA, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALTERNATE_HORIZ_KANA_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALTERNATE_HORIZ_KANA_OFF}, {HB_TAG ('h','l','i','g'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_FEATURE_SELECTOR_HISTORICAL_LIGATURES_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_HISTORICAL_LIGATURES_OFF}, {HB_TAG ('h','n','g','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TRANSLITERATION, HB_AAT_LAYOUT_FEATURE_SELECTOR_HANJA_TO_HANGUL, HB_AAT_LAYOUT_FEATURE_SELECTOR_NO_TRANSLITERATION}, @@ -170,6 +170,7 @@ static const hb_aat_feature_mapping_t feature_mappings[] = {HB_TAG ('v','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_ALTERNATE_KANA, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALTERNATE_VERT_KANA_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALTERNATE_VERT_KANA_OFF}, {HB_TAG ('v','p','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_FEATURE_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7}, {HB_TAG ('v','r','t','2'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION, HB_AAT_LAYOUT_FEATURE_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_OFF}, + {HB_TAG ('v','r','t','r'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION, (hb_aat_layout_feature_selector_t) 2, (hb_aat_layout_feature_selector_t) 3}, {HB_TAG ('z','e','r','o'), HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, HB_AAT_LAYOUT_FEATURE_SELECTOR_SLASHED_ZERO_ON, HB_AAT_LAYOUT_FEATURE_SELECTOR_SLASHED_ZERO_OFF}, }; diff --git a/thirdparty/harfbuzz/src/hb-buffer-deserialize-text.hh b/thirdparty/harfbuzz/src/hb-buffer-deserialize-text.hh index b599e9667c..06a605e225 100644 --- a/thirdparty/harfbuzz/src/hb-buffer-deserialize-text.hh +++ b/thirdparty/harfbuzz/src/hb-buffer-deserialize-text.hh @@ -478,7 +478,7 @@ _resume: case 18: #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -535,7 +535,7 @@ _resume: case 16: #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -635,7 +635,7 @@ _resume: } #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -645,7 +645,7 @@ _resume: case 17: #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -674,7 +674,7 @@ _resume: } #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -701,7 +701,7 @@ _resume: } #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -733,7 +733,7 @@ _again: case 16: #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) @@ -820,7 +820,7 @@ _again: } #line 58 "hb-buffer-deserialize-text.rl" { - /* TODO Unescape delimeters. */ + /* TODO Unescape delimiters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) diff --git a/thirdparty/harfbuzz/src/hb-buffer.h b/thirdparty/harfbuzz/src/hb-buffer.h index ece7d2d8cf..14aaa5e1f5 100644 --- a/thirdparty/harfbuzz/src/hb-buffer.h +++ b/thirdparty/harfbuzz/src/hb-buffer.h @@ -117,7 +117,7 @@ typedef struct hb_glyph_info_t { * from there, and repeat. * At the start of next line a similar algorithm can * be implemented. That is: 1. Iterate forward from - * the line-break position untill the first cluster + * the line-break position until the first cluster * start position that is NOT unsafe-to-concat, 2. * shape the segment from beginning of the line to * that position, 3. check whether the resulting diff --git a/thirdparty/harfbuzz/src/hb-ot-layout-base-table.hh b/thirdparty/harfbuzz/src/hb-ot-layout-base-table.hh index eb4c3b46e2..1b9dfcd3f5 100644 --- a/thirdparty/harfbuzz/src/hb-ot-layout-base-table.hh +++ b/thirdparty/harfbuzz/src/hb-ot-layout-base-table.hh @@ -41,7 +41,10 @@ namespace OT { struct BaseCoordFormat1 { - hb_position_t get_coord () const { return coordinate; } + hb_position_t get_coord (hb_font_t *font, hb_direction_t direction) const + { + return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (coordinate) : font->em_scale_x (coordinate); + } bool sanitize (hb_sanitize_context_t *c) const { @@ -58,10 +61,10 @@ struct BaseCoordFormat1 struct BaseCoordFormat2 { - hb_position_t get_coord () const + hb_position_t get_coord (hb_font_t *font, hb_direction_t direction) const { /* TODO */ - return coordinate; + return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (coordinate) : font->em_scale_x (coordinate); } bool sanitize (hb_sanitize_context_t *c) const @@ -87,9 +90,10 @@ struct BaseCoordFormat3 hb_direction_t direction) const { const Device &device = this+deviceTable; - return coordinate + (HB_DIRECTION_IS_VERTICAL (direction) ? - device.get_y_delta (font, var_store) : - device.get_x_delta (font, var_store)); + + return HB_DIRECTION_IS_HORIZONTAL (direction) + ? font->em_scale_y (coordinate) + device.get_y_delta (font, var_store) + : font->em_scale_x (coordinate) + device.get_x_delta (font, var_store); } @@ -120,8 +124,8 @@ struct BaseCoord hb_direction_t direction) const { switch (u.format) { - case 1: return u.format1.get_coord (); - case 2: return u.format2.get_coord (); + case 1: return u.format1.get_coord (font, direction); + case 2: return u.format2.get_coord (font, direction); case 3: return u.format3.get_coord (font, var_store, direction); default:return 0; } diff --git a/thirdparty/harfbuzz/src/hb-ot-layout.cc b/thirdparty/harfbuzz/src/hb-ot-layout.cc index 07bbe3bc84..01053ab737 100644 --- a/thirdparty/harfbuzz/src/hb-ot-layout.cc +++ b/thirdparty/harfbuzz/src/hb-ot-layout.cc @@ -2060,12 +2060,7 @@ hb_ot_layout_get_baseline (hb_font_t *font, hb_tag_t language_tag, hb_position_t *coord /* OUT. May be NULL. */) { - bool result = font->face->table.BASE->get_baseline (font, baseline_tag, direction, script_tag, language_tag, coord); - - if (result && coord) - *coord = HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (*coord) : font->em_scale_x (*coord); - - return result; + return font->face->table.BASE->get_baseline (font, baseline_tag, direction, script_tag, language_tag, coord); } /** diff --git a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-machine.hh b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-machine.hh index fb9c60cce9..54f69c8284 100644 --- a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-machine.hh +++ b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-machine.hh @@ -92,41 +92,60 @@ enum use_syllable_type_t { #define use_syllable_machine_ex_VMPst 39u #define use_syllable_machine_ex_VPre 22u #define use_syllable_machine_ex_VPst 35u +#define use_syllable_machine_ex_WJ 16u #define use_syllable_machine_ex_ZWNJ 14u -#line 99 "hb-ot-shape-complex-use-machine.hh" +#line 100 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { - 0u, 51u, 41u, 42u, 42u, 42u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, + 0u, 51u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, + 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, 1u, 1u, 24u, 48u, + 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, 11u, 48u, 1u, 48u, + 11u, 48u, 41u, 42u, 42u, 42u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, 1u, 1u, 24u, 48u, 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, 11u, 48u, 1u, 48u, 13u, 13u, 4u, 4u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, 1u, 1u, 24u, 48u, 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, - 22u, 48u, 11u, 48u, 1u, 48u, 4u, 4u, 13u, 13u, 1u, 48u, 11u, 48u, 41u, 42u, - 42u, 42u, 1u, 5u, 50u, 52u, 49u, 52u, 49u, 51u, 0 + 22u, 48u, 11u, 48u, 1u, 48u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, + 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, + 1u, 1u, 24u, 48u, 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, + 11u, 48u, 1u, 48u, 4u, 4u, 13u, 13u, 1u, 48u, 11u, 48u, 41u, 42u, 42u, 42u, + 1u, 5u, 50u, 52u, 49u, 52u, 49u, 51u, 0 }; static const char _use_syllable_machine_key_spans[] = { - 52, 2, 1, 38, 38, 1, 27, 26, + 52, 38, 38, 1, 27, 26, 24, 23, + 22, 2, 1, 25, 25, 25, 1, 25, + 26, 26, 26, 27, 27, 27, 38, 48, + 38, 2, 1, 38, 38, 1, 27, 26, 24, 23, 22, 2, 1, 25, 25, 25, 1, 25, 26, 26, 26, 27, 27, 27, 38, 48, 1, 1, 38, 38, 1, 27, 26, 24, 23, 22, 2, 1, 25, 25, 25, 1, 25, 26, 26, 26, 27, 27, - 27, 38, 48, 1, 1, 48, 38, 2, - 1, 5, 3, 4, 3 + 27, 38, 48, 38, 38, 1, 27, 26, + 24, 23, 22, 2, 1, 25, 25, 25, + 1, 25, 26, 26, 26, 27, 27, 27, + 38, 48, 1, 1, 48, 38, 2, 1, + 5, 3, 4, 3 }; static const short _use_syllable_machine_index_offsets[] = { - 0, 53, 56, 58, 97, 136, 138, 166, - 193, 218, 242, 265, 268, 270, 296, 322, - 348, 350, 376, 403, 430, 457, 485, 513, - 541, 580, 629, 631, 633, 672, 711, 713, - 741, 768, 793, 817, 840, 843, 845, 871, - 897, 923, 925, 951, 978, 1005, 1032, 1060, - 1088, 1116, 1155, 1204, 1206, 1208, 1257, 1296, - 1299, 1301, 1307, 1311, 1316 + 0, 53, 92, 131, 133, 161, 188, 213, + 237, 260, 263, 265, 291, 317, 343, 345, + 371, 398, 425, 452, 480, 508, 536, 575, + 624, 663, 666, 668, 707, 746, 748, 776, + 803, 828, 852, 875, 878, 880, 906, 932, + 958, 960, 986, 1013, 1040, 1067, 1095, 1123, + 1151, 1190, 1239, 1241, 1243, 1282, 1321, 1323, + 1351, 1378, 1403, 1427, 1450, 1453, 1455, 1481, + 1507, 1533, 1535, 1561, 1588, 1615, 1642, 1670, + 1698, 1726, 1765, 1814, 1853, 1892, 1894, 1922, + 1949, 1974, 1998, 2021, 2024, 2026, 2052, 2078, + 2104, 2106, 2132, 2159, 2186, 2213, 2241, 2269, + 2297, 2336, 2385, 2387, 2389, 2438, 2477, 2480, + 2482, 2488, 2492, 2497 }; static const char _use_syllable_machine_indicies[] = { @@ -136,178 +155,331 @@ static const char _use_syllable_machine_indicies[] = { 11, 12, 13, 14, 15, 9, 16, 17, 18, 19, 20, 21, 2, 22, 23, 24, 2, 25, 26, 27, 28, 29, 30, 31, - 6, 32, 2, 33, 2, 0, 35, 34, - 35, 34, 37, 38, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 39, 40, 41, - 42, 43, 44, 45, 39, 46, 1, 47, - 48, 49, 50, 36, 51, 52, 53, 36, - 36, 36, 36, 54, 55, 56, 57, 38, - 36, 37, 38, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 39, 40, 41, 42, - 43, 44, 45, 39, 46, 47, 47, 48, - 49, 50, 36, 51, 52, 53, 36, 36, - 36, 36, 54, 55, 56, 57, 38, 36, - 37, 58, 39, 40, 41, 42, 43, 36, - 36, 36, 36, 36, 36, 48, 49, 50, - 36, 51, 52, 53, 36, 36, 36, 36, - 40, 55, 56, 57, 59, 36, 40, 41, - 42, 43, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 51, 52, 53, 36, - 36, 36, 36, 36, 55, 56, 57, 59, - 36, 41, 42, 43, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 55, 56, - 57, 36, 42, 43, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 55, 56, - 57, 36, 43, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 55, 56, 57, - 36, 55, 56, 36, 56, 36, 41, 42, - 43, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 51, 52, 53, 36, 36, - 36, 36, 36, 55, 56, 57, 59, 36, - 41, 42, 43, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 52, 53, - 36, 36, 36, 36, 36, 55, 56, 57, - 59, 36, 41, 42, 43, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 53, 36, 36, 36, 36, 36, 55, - 56, 57, 59, 36, 61, 60, 41, 42, - 43, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 55, 56, 57, 59, 36, - 40, 41, 42, 43, 36, 36, 36, 36, - 36, 36, 48, 49, 50, 36, 51, 52, - 53, 36, 36, 36, 36, 40, 55, 56, - 57, 59, 36, 40, 41, 42, 43, 36, - 36, 36, 36, 36, 36, 36, 49, 50, - 36, 51, 52, 53, 36, 36, 36, 36, - 40, 55, 56, 57, 59, 36, 40, 41, - 42, 43, 36, 36, 36, 36, 36, 36, - 36, 36, 50, 36, 51, 52, 53, 36, - 36, 36, 36, 40, 55, 56, 57, 59, - 36, 39, 40, 41, 42, 43, 36, 45, - 39, 36, 36, 36, 48, 49, 50, 36, - 51, 52, 53, 36, 36, 36, 36, 40, - 55, 56, 57, 59, 36, 39, 40, 41, - 42, 43, 36, 36, 39, 36, 36, 36, - 48, 49, 50, 36, 51, 52, 53, 36, - 36, 36, 36, 40, 55, 56, 57, 59, - 36, 39, 40, 41, 42, 43, 44, 45, - 39, 36, 36, 36, 48, 49, 50, 36, - 51, 52, 53, 36, 36, 36, 36, 40, - 55, 56, 57, 59, 36, 37, 38, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 39, 40, 41, 42, 43, 44, 45, 39, - 46, 36, 47, 48, 49, 50, 36, 51, - 52, 53, 36, 36, 36, 36, 54, 55, - 56, 57, 38, 36, 37, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 40, 41, 42, 43, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 51, 52, 53, 58, 58, 58, 58, 58, - 55, 56, 57, 59, 58, 63, 62, 3, - 64, 37, 38, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 39, 40, 41, 42, - 43, 44, 45, 39, 46, 1, 47, 48, - 49, 50, 36, 51, 52, 53, 36, 0, - 35, 36, 54, 55, 56, 57, 38, 36, - 5, 6, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 9, 10, 11, 12, 13, - 14, 15, 9, 16, 18, 18, 19, 20, - 21, 65, 22, 23, 24, 65, 65, 65, - 65, 28, 29, 30, 31, 6, 65, 5, - 65, 9, 10, 11, 12, 13, 65, 65, - 65, 65, 65, 65, 19, 20, 21, 65, - 22, 23, 24, 65, 65, 65, 65, 10, - 29, 30, 31, 66, 65, 10, 11, 12, - 13, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 22, 23, 24, 65, 65, - 65, 65, 65, 29, 30, 31, 66, 65, - 11, 12, 13, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 29, 30, 31, - 65, 12, 13, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 29, 30, 31, - 65, 13, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 29, 30, 31, 65, - 29, 30, 65, 30, 65, 11, 12, 13, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 22, 23, 24, 65, 65, 65, - 65, 65, 29, 30, 31, 66, 65, 11, - 12, 13, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 23, 24, 65, - 65, 65, 65, 65, 29, 30, 31, 66, - 65, 11, 12, 13, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 24, 65, 65, 65, 65, 65, 29, 30, - 31, 66, 65, 67, 65, 11, 12, 13, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 29, 30, 31, 66, 65, 10, - 11, 12, 13, 65, 65, 65, 65, 65, - 65, 19, 20, 21, 65, 22, 23, 24, - 65, 65, 65, 65, 10, 29, 30, 31, - 66, 65, 10, 11, 12, 13, 65, 65, - 65, 65, 65, 65, 65, 20, 21, 65, - 22, 23, 24, 65, 65, 65, 65, 10, - 29, 30, 31, 66, 65, 10, 11, 12, - 13, 65, 65, 65, 65, 65, 65, 65, - 65, 21, 65, 22, 23, 24, 65, 65, - 65, 65, 10, 29, 30, 31, 66, 65, - 9, 10, 11, 12, 13, 65, 15, 9, - 65, 65, 65, 19, 20, 21, 65, 22, - 23, 24, 65, 65, 65, 65, 10, 29, - 30, 31, 66, 65, 9, 10, 11, 12, - 13, 65, 65, 9, 65, 65, 65, 19, - 20, 21, 65, 22, 23, 24, 65, 65, - 65, 65, 10, 29, 30, 31, 66, 65, + 6, 32, 2, 33, 2, 35, 36, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 37, 38, 39, 40, 41, 42, 43, 37, + 44, 45, 46, 47, 48, 49, 34, 50, + 51, 52, 34, 53, 54, 34, 55, 56, + 57, 58, 36, 34, 35, 36, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 37, + 38, 39, 40, 41, 42, 43, 37, 44, + 46, 46, 47, 48, 49, 34, 50, 51, + 52, 34, 34, 34, 34, 55, 56, 57, + 58, 36, 34, 35, 34, 37, 38, 39, + 40, 41, 34, 34, 34, 34, 34, 34, + 47, 48, 49, 34, 50, 51, 52, 34, + 34, 34, 34, 38, 56, 57, 58, 59, + 34, 38, 39, 40, 41, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 50, + 51, 52, 34, 34, 34, 34, 34, 56, + 57, 58, 59, 34, 39, 40, 41, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 56, 57, 58, 34, 40, 41, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 56, 57, 58, 34, 41, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 56, 57, 58, 34, 56, 57, 34, 57, + 34, 39, 40, 41, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 50, 51, + 52, 34, 34, 34, 34, 34, 56, 57, + 58, 59, 34, 39, 40, 41, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 51, 52, 34, 34, 34, 34, 34, + 56, 57, 58, 59, 34, 39, 40, 41, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 52, 34, 34, 34, + 34, 34, 56, 57, 58, 59, 34, 60, + 34, 39, 40, 41, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 56, 57, + 58, 59, 34, 38, 39, 40, 41, 34, + 34, 34, 34, 34, 34, 47, 48, 49, + 34, 50, 51, 52, 34, 34, 34, 34, + 38, 56, 57, 58, 59, 34, 38, 39, + 40, 41, 34, 34, 34, 34, 34, 34, + 34, 48, 49, 34, 50, 51, 52, 34, + 34, 34, 34, 38, 56, 57, 58, 59, + 34, 38, 39, 40, 41, 34, 34, 34, + 34, 34, 34, 34, 34, 49, 34, 50, + 51, 52, 34, 34, 34, 34, 38, 56, + 57, 58, 59, 34, 37, 38, 39, 40, + 41, 34, 43, 37, 34, 34, 34, 47, + 48, 49, 34, 50, 51, 52, 34, 34, + 34, 34, 38, 56, 57, 58, 59, 34, + 37, 38, 39, 40, 41, 34, 34, 37, + 34, 34, 34, 47, 48, 49, 34, 50, + 51, 52, 34, 34, 34, 34, 38, 56, + 57, 58, 59, 34, 37, 38, 39, 40, + 41, 42, 43, 37, 34, 34, 34, 47, + 48, 49, 34, 50, 51, 52, 34, 34, + 34, 34, 38, 56, 57, 58, 59, 34, + 35, 36, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 37, 38, 39, 40, 41, + 42, 43, 37, 44, 34, 46, 47, 48, + 49, 34, 50, 51, 52, 34, 34, 34, + 34, 55, 56, 57, 58, 36, 34, 35, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 38, 39, 40, + 41, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 50, 51, 52, 34, 34, + 34, 34, 34, 56, 57, 58, 59, 34, + 35, 36, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 37, 38, 39, 40, 41, + 42, 43, 37, 44, 45, 46, 47, 48, + 49, 34, 50, 51, 52, 34, 34, 34, + 34, 55, 56, 57, 58, 36, 34, 53, + 54, 34, 54, 34, 62, 63, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 64, + 65, 66, 67, 68, 69, 70, 64, 71, + 1, 72, 73, 74, 75, 61, 76, 77, + 78, 61, 61, 61, 61, 79, 80, 81, + 82, 63, 61, 62, 63, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 64, 65, + 66, 67, 68, 69, 70, 64, 71, 72, + 72, 73, 74, 75, 61, 76, 77, 78, + 61, 61, 61, 61, 79, 80, 81, 82, + 63, 61, 62, 83, 64, 65, 66, 67, + 68, 61, 61, 61, 61, 61, 61, 73, + 74, 75, 61, 76, 77, 78, 61, 61, + 61, 61, 65, 80, 81, 82, 84, 61, + 65, 66, 67, 68, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 76, 77, + 78, 61, 61, 61, 61, 61, 80, 81, + 82, 84, 61, 66, 67, 68, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 80, 81, 82, 61, 67, 68, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 80, 81, 82, 61, 68, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 80, + 81, 82, 61, 80, 81, 61, 81, 61, + 66, 67, 68, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 76, 77, 78, + 61, 61, 61, 61, 61, 80, 81, 82, + 84, 61, 66, 67, 68, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 77, 78, 61, 61, 61, 61, 61, 80, + 81, 82, 84, 61, 66, 67, 68, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 78, 61, 61, 61, 61, + 61, 80, 81, 82, 84, 61, 86, 85, + 66, 67, 68, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 80, 81, 82, + 84, 61, 65, 66, 67, 68, 61, 61, + 61, 61, 61, 61, 73, 74, 75, 61, + 76, 77, 78, 61, 61, 61, 61, 65, + 80, 81, 82, 84, 61, 65, 66, 67, + 68, 61, 61, 61, 61, 61, 61, 61, + 74, 75, 61, 76, 77, 78, 61, 61, + 61, 61, 65, 80, 81, 82, 84, 61, + 65, 66, 67, 68, 61, 61, 61, 61, + 61, 61, 61, 61, 75, 61, 76, 77, + 78, 61, 61, 61, 61, 65, 80, 81, + 82, 84, 61, 64, 65, 66, 67, 68, + 61, 70, 64, 61, 61, 61, 73, 74, + 75, 61, 76, 77, 78, 61, 61, 61, + 61, 65, 80, 81, 82, 84, 61, 64, + 65, 66, 67, 68, 61, 61, 64, 61, + 61, 61, 73, 74, 75, 61, 76, 77, + 78, 61, 61, 61, 61, 65, 80, 81, + 82, 84, 61, 64, 65, 66, 67, 68, + 69, 70, 64, 61, 61, 61, 73, 74, + 75, 61, 76, 77, 78, 61, 61, 61, + 61, 65, 80, 81, 82, 84, 61, 62, + 63, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 64, 65, 66, 67, 68, 69, + 70, 64, 71, 61, 72, 73, 74, 75, + 61, 76, 77, 78, 61, 61, 61, 61, + 79, 80, 81, 82, 63, 61, 62, 83, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 65, 66, 67, 68, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 76, 77, 78, 83, 83, 83, + 83, 83, 80, 81, 82, 84, 83, 88, + 87, 3, 89, 90, 91, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 92, 93, + 94, 95, 96, 97, 98, 92, 99, 100, + 101, 102, 103, 104, 61, 105, 106, 107, + 61, 53, 54, 61, 108, 109, 110, 82, + 91, 61, 90, 91, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 92, 93, 94, + 95, 96, 97, 98, 92, 99, 101, 101, + 102, 103, 104, 61, 105, 106, 107, 61, + 61, 61, 61, 108, 109, 110, 82, 91, + 61, 90, 83, 92, 93, 94, 95, 96, + 61, 61, 61, 61, 61, 61, 102, 103, + 104, 61, 105, 106, 107, 61, 61, 61, + 61, 93, 109, 110, 82, 111, 61, 93, + 94, 95, 96, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 105, 106, 107, + 61, 61, 61, 61, 61, 109, 110, 82, + 111, 61, 94, 95, 96, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 109, + 110, 82, 61, 95, 96, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 109, + 110, 82, 61, 96, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 109, 110, + 82, 61, 109, 110, 61, 110, 61, 94, + 95, 96, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 105, 106, 107, 61, + 61, 61, 61, 61, 109, 110, 82, 111, + 61, 94, 95, 96, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 106, + 107, 61, 61, 61, 61, 61, 109, 110, + 82, 111, 61, 94, 95, 96, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 107, 61, 61, 61, 61, 61, + 109, 110, 82, 111, 61, 112, 85, 94, + 95, 96, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 109, 110, 82, 111, + 61, 93, 94, 95, 96, 61, 61, 61, + 61, 61, 61, 102, 103, 104, 61, 105, + 106, 107, 61, 61, 61, 61, 93, 109, + 110, 82, 111, 61, 93, 94, 95, 96, + 61, 61, 61, 61, 61, 61, 61, 103, + 104, 61, 105, 106, 107, 61, 61, 61, + 61, 93, 109, 110, 82, 111, 61, 93, + 94, 95, 96, 61, 61, 61, 61, 61, + 61, 61, 61, 104, 61, 105, 106, 107, + 61, 61, 61, 61, 93, 109, 110, 82, + 111, 61, 92, 93, 94, 95, 96, 61, + 98, 92, 61, 61, 61, 102, 103, 104, + 61, 105, 106, 107, 61, 61, 61, 61, + 93, 109, 110, 82, 111, 61, 92, 93, + 94, 95, 96, 61, 61, 92, 61, 61, + 61, 102, 103, 104, 61, 105, 106, 107, + 61, 61, 61, 61, 93, 109, 110, 82, + 111, 61, 92, 93, 94, 95, 96, 97, + 98, 92, 61, 61, 61, 102, 103, 104, + 61, 105, 106, 107, 61, 61, 61, 61, + 93, 109, 110, 82, 111, 61, 90, 91, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 92, 93, 94, 95, 96, 97, 98, + 92, 99, 61, 101, 102, 103, 104, 61, + 105, 106, 107, 61, 61, 61, 61, 108, + 109, 110, 82, 91, 61, 90, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 93, 94, 95, 96, 83, + 83, 83, 83, 83, 83, 83, 83, 83, + 83, 105, 106, 107, 83, 83, 83, 83, + 83, 109, 110, 82, 111, 83, 90, 91, + 61, 61, 61, 61, 61, 61, 61, 61, + 61, 92, 93, 94, 95, 96, 97, 98, + 92, 99, 100, 101, 102, 103, 104, 61, + 105, 106, 107, 61, 61, 61, 61, 108, + 109, 110, 82, 91, 61, 5, 6, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 9, 10, 11, 12, 13, 14, 15, 9, - 65, 65, 65, 19, 20, 21, 65, 22, - 23, 24, 65, 65, 65, 65, 10, 29, - 30, 31, 66, 65, 5, 6, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 9, - 10, 11, 12, 13, 14, 15, 9, 16, - 65, 18, 19, 20, 21, 65, 22, 23, - 24, 65, 65, 65, 65, 28, 29, 30, - 31, 6, 65, 5, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 10, 11, 12, 13, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 22, - 23, 24, 65, 65, 65, 65, 65, 29, - 30, 31, 66, 65, 68, 65, 7, 65, - 1, 65, 65, 65, 1, 65, 65, 65, - 65, 65, 5, 6, 7, 65, 65, 65, - 65, 65, 65, 65, 65, 9, 10, 11, - 12, 13, 14, 15, 9, 16, 17, 18, - 19, 20, 21, 65, 22, 23, 24, 65, - 25, 26, 65, 28, 29, 30, 31, 6, - 65, 5, 6, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 9, 10, 11, 12, - 13, 14, 15, 9, 16, 17, 18, 19, - 20, 21, 65, 22, 23, 24, 65, 65, - 65, 65, 28, 29, 30, 31, 6, 65, - 25, 26, 65, 26, 65, 1, 69, 69, - 69, 1, 69, 71, 70, 32, 70, 32, - 71, 70, 71, 70, 32, 70, 33, 70, - 0 + 16, 18, 18, 19, 20, 21, 113, 22, + 23, 24, 113, 113, 113, 113, 28, 29, + 30, 31, 6, 113, 5, 113, 9, 10, + 11, 12, 13, 113, 113, 113, 113, 113, + 113, 19, 20, 21, 113, 22, 23, 24, + 113, 113, 113, 113, 10, 29, 30, 31, + 114, 113, 10, 11, 12, 13, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 22, 23, 24, 113, 113, 113, 113, 113, + 29, 30, 31, 114, 113, 11, 12, 13, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 29, 30, 31, 113, 12, 13, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 29, 30, 31, 113, 13, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 29, 30, 31, 113, 29, 30, 113, + 30, 113, 11, 12, 13, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 22, + 23, 24, 113, 113, 113, 113, 113, 29, + 30, 31, 114, 113, 11, 12, 13, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 23, 24, 113, 113, 113, 113, + 113, 29, 30, 31, 114, 113, 11, 12, + 13, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 24, 113, 113, + 113, 113, 113, 29, 30, 31, 114, 113, + 115, 113, 11, 12, 13, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 29, + 30, 31, 114, 113, 10, 11, 12, 13, + 113, 113, 113, 113, 113, 113, 19, 20, + 21, 113, 22, 23, 24, 113, 113, 113, + 113, 10, 29, 30, 31, 114, 113, 10, + 11, 12, 13, 113, 113, 113, 113, 113, + 113, 113, 20, 21, 113, 22, 23, 24, + 113, 113, 113, 113, 10, 29, 30, 31, + 114, 113, 10, 11, 12, 13, 113, 113, + 113, 113, 113, 113, 113, 113, 21, 113, + 22, 23, 24, 113, 113, 113, 113, 10, + 29, 30, 31, 114, 113, 9, 10, 11, + 12, 13, 113, 15, 9, 113, 113, 113, + 19, 20, 21, 113, 22, 23, 24, 113, + 113, 113, 113, 10, 29, 30, 31, 114, + 113, 9, 10, 11, 12, 13, 113, 113, + 9, 113, 113, 113, 19, 20, 21, 113, + 22, 23, 24, 113, 113, 113, 113, 10, + 29, 30, 31, 114, 113, 9, 10, 11, + 12, 13, 14, 15, 9, 113, 113, 113, + 19, 20, 21, 113, 22, 23, 24, 113, + 113, 113, 113, 10, 29, 30, 31, 114, + 113, 5, 6, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 9, 10, 11, 12, + 13, 14, 15, 9, 16, 113, 18, 19, + 20, 21, 113, 22, 23, 24, 113, 113, + 113, 113, 28, 29, 30, 31, 6, 113, + 5, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 10, 11, + 12, 13, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 22, 23, 24, 113, + 113, 113, 113, 113, 29, 30, 31, 114, + 113, 116, 113, 7, 113, 1, 113, 113, + 113, 1, 113, 113, 113, 113, 113, 5, + 6, 7, 113, 113, 113, 113, 113, 113, + 113, 113, 9, 10, 11, 12, 13, 14, + 15, 9, 16, 17, 18, 19, 20, 21, + 113, 22, 23, 24, 113, 25, 26, 113, + 28, 29, 30, 31, 6, 113, 5, 6, + 113, 113, 113, 113, 113, 113, 113, 113, + 113, 9, 10, 11, 12, 13, 14, 15, + 9, 16, 17, 18, 19, 20, 21, 113, + 22, 23, 24, 113, 113, 113, 113, 28, + 29, 30, 31, 6, 113, 25, 26, 113, + 26, 113, 1, 117, 117, 117, 1, 117, + 119, 118, 32, 118, 32, 119, 118, 119, + 118, 32, 118, 33, 118, 0 }; static const char _use_syllable_machine_trans_targs[] = { - 1, 3, 0, 26, 28, 29, 30, 51, - 53, 31, 32, 33, 34, 35, 46, 47, - 48, 54, 49, 43, 44, 45, 38, 39, - 40, 55, 56, 57, 50, 36, 37, 0, - 58, 60, 0, 2, 0, 4, 5, 6, - 7, 8, 9, 10, 21, 22, 23, 24, - 18, 19, 20, 13, 14, 15, 25, 11, - 12, 0, 0, 16, 0, 17, 0, 27, - 0, 0, 41, 42, 52, 0, 0, 59 + 1, 27, 0, 50, 52, 76, 77, 98, + 100, 78, 79, 80, 81, 82, 93, 94, + 95, 101, 96, 90, 91, 92, 85, 86, + 87, 102, 103, 104, 97, 83, 84, 0, + 105, 107, 0, 2, 3, 4, 5, 6, + 7, 8, 19, 20, 21, 24, 22, 16, + 17, 18, 11, 12, 13, 25, 26, 23, + 9, 10, 0, 14, 15, 0, 28, 29, + 30, 31, 32, 33, 34, 45, 46, 47, + 48, 42, 43, 44, 37, 38, 39, 49, + 35, 36, 0, 0, 40, 0, 41, 0, + 51, 0, 53, 54, 55, 56, 57, 58, + 59, 70, 71, 72, 75, 73, 67, 68, + 69, 62, 63, 64, 74, 60, 61, 65, + 66, 0, 88, 89, 99, 0, 0, 106 }; static const char _use_syllable_machine_trans_actions[] = { @@ -315,11 +487,17 @@ static const char _use_syllable_machine_trans_actions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 5, 0, 6, 0, 0, 0, + 0, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 9, 0, 10, 0, 11, + 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 8, 0, 9, 0, 10, 0, - 11, 12, 0, 0, 0, 13, 14, 0 + 0, 13, 0, 0, 0, 14, 15, 0 }; static const char _use_syllable_machine_to_state_actions[] = { @@ -330,7 +508,13 @@ static const char _use_syllable_machine_to_state_actions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 }; static const char _use_syllable_machine_from_state_actions[] = { @@ -341,18 +525,30 @@ static const char _use_syllable_machine_from_state_actions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 }; static const short _use_syllable_machine_eof_trans[] = { - 0, 35, 35, 37, 37, 59, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, - 61, 37, 37, 37, 37, 37, 37, 37, - 37, 59, 63, 65, 37, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 70, 71, 71, 71 + 0, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 62, 62, 84, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, + 86, 62, 62, 62, 62, 62, 62, 62, + 62, 84, 88, 90, 62, 62, 84, 62, + 62, 62, 62, 62, 62, 62, 62, 62, + 62, 86, 62, 62, 62, 62, 62, 62, + 62, 62, 84, 62, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, + 118, 119, 119, 119 }; static const int use_syllable_machine_start = 0; @@ -366,7 +562,7 @@ static const int use_syllable_machine_en_main = 0; -#line 179 "hb-ot-shape-complex-use-machine.rl" +#line 181 "hb-ot-shape-complex-use-machine.rl" #define found_syllable(syllable_type) \ @@ -422,7 +618,7 @@ HB_FUNCOBJ (machine_index); static bool not_ccs_default_ignorable (const hb_glyph_info_t &i) -{ return !(i.use_category() == USE(CGJ) && _hb_glyph_info_is_default_ignorable (&i)); } +{ return i.use_category() != USE(CGJ); } static inline void find_syllables_use (hb_buffer_t *buffer) @@ -451,7 +647,7 @@ find_syllables_use (hb_buffer_t *buffer) unsigned int act HB_UNUSED; int cs; -#line 453 "hb-ot-shape-complex-use-machine.hh" +#line 651 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; ts = 0; @@ -459,12 +655,12 @@ find_syllables_use (hb_buffer_t *buffer) act = 0; } -#line 263 "hb-ot-shape-complex-use-machine.rl" +#line 267 "hb-ot-shape-complex-use-machine.rl" unsigned int syllable_serial = 1; -#line 466 "hb-ot-shape-complex-use-machine.hh" +#line 664 "hb-ot-shape-complex-use-machine.hh" { int _slen; int _trans; @@ -478,7 +674,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 480 "hb-ot-shape-complex-use-machine.hh" +#line 678 "hb-ot-shape-complex-use-machine.hh" } _keys = _use_syllable_machine_trans_keys + (cs<<1); @@ -496,55 +692,59 @@ _eof_trans: goto _again; switch ( _use_syllable_machine_trans_actions[_trans] ) { - case 7: -#line 169 "hb-ot-shape-complex-use-machine.rl" + case 8: +#line 171 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (use_standard_cluster); }} break; - case 4: + case 6: #line 174 "hb-ot-shape-complex-use-machine.rl" + {te = p+1;{ found_syllable (use_symbol_cluster); }} + break; + case 4: +#line 176 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (use_broken_cluster); }} break; case 3: -#line 175 "hb-ot-shape-complex-use-machine.rl" +#line 177 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (use_non_cluster); }} break; - case 8: -#line 167 "hb-ot-shape-complex-use-machine.rl" + case 9: +#line 169 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_virama_terminated_cluster); }} break; - case 9: -#line 168 "hb-ot-shape-complex-use-machine.rl" + case 10: +#line 170 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_sakot_terminated_cluster); }} break; - case 6: -#line 169 "hb-ot-shape-complex-use-machine.rl" + case 7: +#line 171 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_standard_cluster); }} break; - case 11: -#line 170 "hb-ot-shape-complex-use-machine.rl" + case 12: +#line 172 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_number_joiner_terminated_cluster); }} break; - case 10: -#line 171 "hb-ot-shape-complex-use-machine.rl" + case 11: +#line 173 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_numeral_cluster); }} break; case 5: -#line 172 "hb-ot-shape-complex-use-machine.rl" +#line 174 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_symbol_cluster); }} break; - case 14: -#line 173 "hb-ot-shape-complex-use-machine.rl" + case 15: +#line 175 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_hieroglyph_cluster); }} break; - case 12: -#line 174 "hb-ot-shape-complex-use-machine.rl" + case 13: +#line 176 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_broken_cluster); }} break; - case 13: -#line 175 "hb-ot-shape-complex-use-machine.rl" + case 14: +#line 177 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (use_non_cluster); }} break; -#line 546 "hb-ot-shape-complex-use-machine.hh" +#line 748 "hb-ot-shape-complex-use-machine.hh" } _again: @@ -553,7 +753,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 555 "hb-ot-shape-complex-use-machine.hh" +#line 757 "hb-ot-shape-complex-use-machine.hh" } if ( ++p != pe ) @@ -569,7 +769,7 @@ _again: } -#line 268 "hb-ot-shape-complex-use-machine.rl" +#line 272 "hb-ot-shape-complex-use-machine.rl" } diff --git a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.hh b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.hh index 7a3a995c8c..951fb28377 100644 --- a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.hh +++ b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.hh @@ -62,6 +62,7 @@ #define SE USE(SE) /* HIEROGLYPH_SEGMENT_END */ #define SUB USE(SUB) /* CONS_SUB */ #define Sk USE(Sk) /* SAKOT */ +#define WJ USE(WJ) /* Word_Joiner */ #define ZWNJ USE(ZWNJ) /* ZWNJ */ #define CMAbv USE(CMAbv) #define CMBlw USE(CMBlw) @@ -102,7 +103,7 @@ static const uint8_t use_table[] = { /* Latin-1 Supplement */ - /* 00A0 */ GB, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 00A0 */ GB, O, O, O, O, O, O, O, O, O, O, O, O, WJ, O, O, /* 00B0 */ O, O, FMPst, FMPst, O, O, O, O, O, O, O, O, O, O, O, O, /* 00C0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 00D0 */ O, O, O, O, O, O, O, GB, @@ -127,7 +128,7 @@ static const uint8_t use_table[] = { O, O, B, B, B, B, B, B, /* 07D0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 07E0 */ B, B, B, B, B, B, B, B, B, B, B, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, - /* 07F0 */ VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, O, O, O, B, O, O, VMAbv, O, O, + /* 07F0 */ VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, O, O, O, B, WJ, WJ, VMAbv, O, O, #define use_offset_0x0840u 152 @@ -135,7 +136,7 @@ static const uint8_t use_table[] = { /* Mandaic */ /* 0840 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0850 */ B, B, B, B, B, B, B, B, B, CMBlw, CMBlw, CMBlw, O, O, O, O, + /* 0850 */ B, B, B, B, B, B, B, B, B, CMBlw, CMBlw, CMBlw, WJ, WJ, O, WJ, #define use_offset_0x0900u 184 @@ -153,102 +154,102 @@ static const uint8_t use_table[] = { /* Bengali */ - /* 0980 */ GB, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B, - /* 0990 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 09A0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 09B0 */ B, O, B, O, O, O, B, B, B, B, O, O, CMBlw, B, VPst, VPre, - /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O, - /* 09D0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, B, B, O, B, - /* 09E0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, B, O, FMAbv, O, + /* 0980 */ GB, VMAbv, VMPst, VMPst, WJ, B, B, B, B, B, B, B, B, WJ, WJ, B, + /* 0990 */ B, WJ, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 09A0 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 09B0 */ B, WJ, B, WJ, WJ, WJ, B, B, B, B, WJ, WJ, CMBlw, B, VPst, VPre, + /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, WJ, WJ, VPre, VPre, WJ, WJ, VPre, VPre, H, O, WJ, + /* 09D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, VPst, WJ, WJ, WJ, WJ, B, B, WJ, B, + /* 09E0 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, B, O, FMAbv, WJ, /* Gurmukhi */ - /* 0A00 */ O, VMAbv, VMAbv, VMPst, O, B, B, B, B, B, B, O, O, O, O, B, - /* 0A10 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0A20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 0A30 */ B, O, B, B, O, B, B, O, B, B, O, O, CMBlw, O, VPst, VPre, - /* 0A40 */ VPst, VBlw, VBlw, O, O, O, O, VAbv, VAbv, O, O, VAbv, VAbv, H, O, O, - /* 0A50 */ O, VMBlw, O, O, O, O, O, O, O, B, B, B, B, O, B, O, - /* 0A60 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0A70 */ VMAbv, CMAbv, GB, GB, O, MBlw, O, O, O, O, O, O, O, O, O, O, + /* 0A00 */ WJ, VMAbv, VMAbv, VMPst, WJ, B, B, B, B, B, B, WJ, WJ, WJ, WJ, B, + /* 0A10 */ B, WJ, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0A20 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 0A30 */ B, WJ, B, B, WJ, B, B, WJ, B, B, WJ, WJ, CMBlw, WJ, VPst, VPre, + /* 0A40 */ VPst, VBlw, VBlw, WJ, WJ, WJ, WJ, VAbv, VAbv, WJ, WJ, VAbv, VAbv, H, WJ, WJ, + /* 0A50 */ WJ, VMBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, B, B, B, B, WJ, B, WJ, + /* 0A60 */ WJ, WJ, WJ, WJ, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0A70 */ VMAbv, CMAbv, GB, GB, O, MBlw, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Gujarati */ - /* 0A80 */ O, VMAbv, VMAbv, VMPst, O, B, B, B, B, B, B, B, B, B, O, B, - /* 0A90 */ B, B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0AA0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 0AB0 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VPre, - /* 0AC0 */ VPst, VBlw, VBlw, VBlw, VBlw, VAbv, O, VAbv, VAbv, VAbv, O, VPst, VPst, H, O, O, - /* 0AD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 0AE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0AF0 */ O, O, O, O, O, O, O, O, O, B, VMAbv, VMAbv, VMAbv, CMAbv, CMAbv, CMAbv, + /* 0A80 */ WJ, VMAbv, VMAbv, VMPst, WJ, B, B, B, B, B, B, B, B, B, WJ, B, + /* 0A90 */ B, B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0AA0 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 0AB0 */ B, WJ, B, B, WJ, B, B, B, B, B, WJ, WJ, CMBlw, B, VPst, VPre, + /* 0AC0 */ VPst, VBlw, VBlw, VBlw, VBlw, VAbv, WJ, VAbv, VAbv, VAbv, WJ, VPst, VPst, H, WJ, WJ, + /* 0AD0 */ O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 0AE0 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0AF0 */ O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, B, VMAbv, VMAbv, VMAbv, CMAbv, CMAbv, CMAbv, /* Oriya */ - /* 0B00 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B, - /* 0B10 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0B20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 0B30 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VAbv, - /* 0B40 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O, - /* 0B50 */ O, O, O, O, O, VAbv, VAbv, VAbv, O, O, O, O, B, B, O, B, - /* 0B60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0B70 */ O, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 0B00 */ WJ, VMAbv, VMPst, VMPst, WJ, B, B, B, B, B, B, B, B, WJ, WJ, B, + /* 0B10 */ B, WJ, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0B20 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 0B30 */ B, WJ, B, B, WJ, B, B, B, B, B, WJ, WJ, CMBlw, B, VPst, VAbv, + /* 0B40 */ VPst, VBlw, VBlw, VBlw, VBlw, WJ, WJ, VPre, VPre, WJ, WJ, VPre, VPre, H, WJ, WJ, + /* 0B50 */ WJ, WJ, WJ, WJ, WJ, VAbv, VAbv, VAbv, WJ, WJ, WJ, WJ, B, B, WJ, B, + /* 0B60 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0B70 */ O, B, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Tamil */ - /* 0B80 */ O, O, VMAbv, O, O, B, B, B, B, B, B, O, O, O, B, B, - /* 0B90 */ B, O, B, B, B, B, O, O, O, B, B, O, B, O, B, B, - /* 0BA0 */ O, O, O, B, B, O, O, O, B, B, B, O, O, O, B, B, - /* 0BB0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, VPst, VPst, - /* 0BC0 */ VAbv, VPst, VPst, O, O, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, O, O, - /* 0BD0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, O, - /* 0BE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0BF0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 0B80 */ WJ, WJ, VMAbv, O, WJ, B, B, B, B, B, B, WJ, WJ, WJ, B, B, + /* 0B90 */ B, WJ, B, B, B, B, WJ, WJ, WJ, B, B, WJ, B, WJ, B, B, + /* 0BA0 */ WJ, WJ, WJ, B, B, WJ, WJ, WJ, B, B, B, WJ, WJ, WJ, B, B, + /* 0BB0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, VPst, VPst, + /* 0BC0 */ VAbv, VPst, VPst, WJ, WJ, WJ, VPre, VPre, VPre, WJ, VPre, VPre, VPre, H, WJ, WJ, + /* 0BD0 */ O, WJ, WJ, WJ, WJ, WJ, WJ, VPst, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 0BE0 */ WJ, WJ, WJ, WJ, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0BF0 */ O, O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, /* Telugu */ - /* 0C00 */ VMAbv, VMPst, VMPst, VMPst, VMAbv, B, B, B, B, B, B, B, B, O, B, B, - /* 0C10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0C20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 0C30 */ B, B, B, B, B, B, B, B, B, B, O, O, CMBlw, B, VAbv, VAbv, - /* 0C40 */ VAbv, VPst, VPst, VPst, VPst, O, VAbv, VAbv, VAbv, O, VAbv, VAbv, VAbv, H, O, O, - /* 0C50 */ O, O, O, O, O, VAbv, VBlw, O, B, B, B, O, O, O, O, O, - /* 0C60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0C70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 0C00 */ VMAbv, VMPst, VMPst, VMPst, VMAbv, B, B, B, B, B, B, B, B, WJ, B, B, + /* 0C10 */ B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0C20 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 0C30 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, CMBlw, B, VAbv, VAbv, + /* 0C40 */ VAbv, VPst, VPst, VPst, VPst, WJ, VAbv, VAbv, VAbv, WJ, VAbv, VAbv, VAbv, H, WJ, WJ, + /* 0C50 */ WJ, WJ, WJ, WJ, WJ, VAbv, VBlw, WJ, B, B, B, WJ, WJ, O, WJ, WJ, + /* 0C60 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0C70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, O, O, O, O, O, /* Kannada */ - /* 0C80 */ B, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B, - /* 0C90 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0CA0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 0CB0 */ B, B, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VAbv, - /* 0CC0 */ VAbv, VPst, VPst, VPst, VPst, O, VAbv, VAbv, VAbv, O, VAbv, VAbv, VAbv, H, O, O, - /* 0CD0 */ O, O, O, O, O, VPst, VPst, O, O, O, O, O, O, O, B, O, - /* 0CE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0CF0 */ O, CS, CS, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 0C80 */ B, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, WJ, B, B, + /* 0C90 */ B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0CA0 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 0CB0 */ B, B, B, B, WJ, B, B, B, B, B, WJ, WJ, CMBlw, B, VPst, VAbv, + /* 0CC0 */ VAbv, VPst, VPst, VPst, VPst, WJ, VAbv, VAbv, VAbv, WJ, VAbv, VAbv, VAbv, H, WJ, WJ, + /* 0CD0 */ WJ, WJ, WJ, WJ, WJ, VPst, VPst, WJ, WJ, WJ, WJ, WJ, WJ, O, B, WJ, + /* 0CE0 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0CF0 */ WJ, CS, CS, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Malayalam */ - /* 0D00 */ VMAbv, VMAbv, VMPst, VMPst, B, B, B, B, B, B, B, B, B, O, B, B, - /* 0D10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0D00 */ VMAbv, VMAbv, VMPst, VMPst, B, B, B, B, B, B, B, B, B, WJ, B, B, + /* 0D10 */ B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, VAbv, VAbv, B, VPst, VPst, - /* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, R, O, - /* 0D50 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, B, - /* 0D60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, + /* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, WJ, VPre, VPre, VPre, WJ, VPre, VPre, VPre, H, R, O, + /* 0D50 */ WJ, WJ, WJ, WJ, O, O, O, VPst, O, O, O, O, O, O, O, B, + /* 0D60 */ B, B, VBlw, VBlw, WJ, WJ, B, B, B, B, B, B, B, B, B, B, /* 0D70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* Sinhala */ - /* 0D80 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, B, B, B, - /* 0D90 */ B, B, B, B, B, B, B, O, O, O, B, B, B, B, B, B, + /* 0D80 */ WJ, VMAbv, VMPst, VMPst, WJ, B, B, B, B, B, B, B, B, B, B, B, + /* 0D90 */ B, B, B, B, B, B, B, WJ, WJ, WJ, B, B, B, B, B, B, /* 0DA0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0DB0 */ B, B, O, B, B, B, B, B, B, B, B, B, O, B, O, O, - /* 0DC0 */ B, B, B, B, B, B, B, O, O, O, H, O, O, O, O, VPst, - /* 0DD0 */ VPst, VPst, VAbv, VAbv, VBlw, O, VBlw, O, VPst, VPre, VPre, VPre, VPre, VPre, VPre, VPst, - /* 0DE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0DF0 */ O, O, VPst, VPst, O, O, O, O, + /* 0DB0 */ B, B, WJ, B, B, B, B, B, B, B, B, B, WJ, B, WJ, WJ, + /* 0DC0 */ B, B, B, B, B, B, B, WJ, WJ, WJ, H, WJ, WJ, WJ, WJ, VPst, + /* 0DD0 */ VPst, VPst, VAbv, VAbv, VBlw, WJ, VBlw, WJ, VPst, VPre, VPre, VPre, VPre, VPre, VPre, VPst, + /* 0DE0 */ WJ, WJ, WJ, WJ, WJ, WJ, B, B, B, B, B, B, B, B, B, B, + /* 0DF0 */ WJ, WJ, VPst, VPst, O, WJ, WJ, WJ, #define use_offset_0x0f00u 1456 @@ -259,14 +260,14 @@ static const uint8_t use_table[] = { /* 0F10 */ O, O, O, O, O, O, O, O, VBlw, VBlw, O, O, O, O, O, O, /* 0F20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0F30 */ B, B, B, B, O, FBlw, O, FBlw, O, CMAbv, O, O, O, O, VPst, VPre, - /* 0F40 */ B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, B, + /* 0F40 */ B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, B, /* 0F50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 0F60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, - /* 0F70 */ O, CMBlw, VBlw, VAbv, VAbv, VBlw, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VMAbv, O, + /* 0F60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, + /* 0F70 */ WJ, CMBlw, VBlw, VAbv, VAbv, VBlw, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VMAbv, O, /* 0F80 */ VBlw, VAbv, VMAbv, VMAbv, VBlw, O, VMAbv, VMAbv, B, B, B, B, B, SUB, SUB, SUB, - /* 0F90 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, + /* 0F90 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, WJ, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 0FA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, - /* 0FB0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, O, O, + /* 0FB0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, WJ, O, O, /* 0FC0 */ O, O, O, O, O, O, FBlw, O, #define use_offset_0x1000u 1656 @@ -291,22 +292,22 @@ static const uint8_t use_table[] = { /* Tagalog */ /* 1700 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1710 */ B, B, VAbv, VBlw, VBlw, VPst, O, O, O, O, O, O, O, O, O, B, + /* 1710 */ B, B, VAbv, VBlw, VBlw, VPst, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, B, /* Hanunoo */ /* 1720 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1730 */ B, B, VAbv, VBlw, VPst, O, O, O, O, O, O, O, O, O, O, O, + /* 1730 */ B, B, VAbv, VBlw, VPst, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Buhid */ /* 1740 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1750 */ B, B, VAbv, VBlw, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1750 */ B, B, VAbv, VBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Tagbanwa */ - /* 1760 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, B, B, - /* 1770 */ B, O, VAbv, VBlw, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1760 */ B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, B, B, + /* 1770 */ B, WJ, VAbv, VBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Khmer */ @@ -315,23 +316,23 @@ static const uint8_t use_table[] = { /* 17A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 17B0 */ B, B, B, B, CGJ, CGJ, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VPre, VPre, /* 17C0 */ VPre, VPre, VPre, VPre, VPre, VPre, VMAbv, VMPst, VPst, VMAbv, VMAbv, FMAbv, FAbv, CMAbv, FMAbv, VMAbv, - /* 17D0 */ FMAbv, VAbv, H, FMAbv, O, O, O, O, O, O, O, O, B, FMAbv, O, O, - /* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, - /* 17F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 17D0 */ FMAbv, VAbv, H, FMAbv, O, O, O, O, O, O, O, O, B, FMAbv, WJ, WJ, + /* 17E0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, + /* 17F0 */ O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, /* Mongolian */ - /* 1800 */ B, O, O, O, O, O, O, B, O, O, B, CGJ, CGJ, CGJ, O, CGJ, - /* 1810 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1800 */ B, O, O, O, O, O, O, B, O, O, B, CGJ, CGJ, CGJ, WJ, CGJ, + /* 1810 */ O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, /* 1820 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1830 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1840 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1850 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1860 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1870 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, + /* 1870 */ B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* 1880 */ GB, GB, GB, GB, GB, CMAbv, CMAbv, B, B, B, B, B, B, B, B, B, /* 1890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 18A0 */ B, B, B, B, B, B, B, B, B, CMBlw, B, O, O, O, O, O, + /* 18A0 */ B, B, B, B, B, B, B, B, B, CMBlw, B, WJ, WJ, WJ, WJ, WJ, #define use_offset_0x1900u 2248 @@ -339,43 +340,43 @@ static const uint8_t use_table[] = { /* Limbu */ /* 1900 */ GB, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1910 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, - /* 1920 */ VAbv, VAbv, VBlw, VPst, VPst, VAbv, VAbv, VAbv, VAbv, SUB, SUB, SUB, O, O, O, O, - /* 1930 */ FPst, FPst, VMBlw, FPst, FPst, FPst, FPst, FPst, FPst, FBlw, VMAbv, FMBlw, O, O, O, O, - /* 1940 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, + /* 1910 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, + /* 1920 */ VAbv, VAbv, VBlw, VPst, VPst, VAbv, VAbv, VAbv, VAbv, SUB, SUB, SUB, WJ, WJ, WJ, WJ, + /* 1930 */ FPst, FPst, VMBlw, FPst, FPst, FPst, FPst, FPst, FPst, FBlw, VMAbv, FMBlw, WJ, WJ, WJ, WJ, + /* 1940 */ O, WJ, WJ, WJ, O, O, B, B, B, B, B, B, B, B, B, B, /* Tai Le */ /* 1950 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1960 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, - /* 1970 */ B, B, B, B, B, O, O, O, O, O, O, O, O, O, O, O, + /* 1960 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, + /* 1970 */ B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* New Tai Lue */ /* 1980 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1990 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 19A0 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, + /* 19A0 */ B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, /* 19B0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 19C0 */ B, B, B, B, B, B, B, B, VMPst, VMPst, O, O, O, O, O, O, - /* 19D0 */ B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, + /* 19C0 */ B, B, B, B, B, B, B, B, VMPst, VMPst, WJ, WJ, WJ, WJ, WJ, WJ, + /* 19D0 */ B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, O, O, /* 19E0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 19F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* Buginese */ /* 1A00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1A10 */ B, B, B, B, B, B, B, VAbv, VAbv, VPre, VPst, VAbv, O, O, O, O, + /* 1A10 */ B, B, B, B, B, B, B, VAbv, VAbv, VPre, VPst, VAbv, WJ, WJ, O, O, /* Tai Tham */ /* 1A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1A30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, MAbv, SUB, SUB, SUB, SUB, O, + /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, MAbv, SUB, SUB, SUB, SUB, WJ, /* 1A60 */ Sk, VPst, VAbv, VPst, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VAbv, VBlw, VPst, VPre, VPre, - /* 1A70 */ VPre, VPre, VPre, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VAbv, VMAbv, VMAbv, O, O, VMBlw, - /* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, - /* 1A90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 1A70 */ VPre, VPre, VPre, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VAbv, VMAbv, VMAbv, WJ, WJ, VMBlw, + /* 1A80 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, + /* 1A90 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, #define use_offset_0x1b00u 2664 @@ -386,10 +387,10 @@ static const uint8_t use_table[] = { /* 1B10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1B30 */ B, B, B, B, CMAbv, VPst, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VPre, - /* 1B40 */ VPre, VPre, VAbv, VAbv, H, B, B, B, B, B, B, B, B, O, O, O, - /* 1B50 */ B, B, B, B, B, B, B, B, B, B, O, GB, GB, O, O, GB, - /* 1B60 */ O, O, GB, O, O, O, O, O, GB, O, O, SMAbv, SMBlw, SMAbv, SMAbv, SMAbv, - /* 1B70 */ SMAbv, SMAbv, SMAbv, SMAbv, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1B40 */ VPre, VPre, VAbv, VAbv, H, B, B, B, B, B, B, B, B, WJ, WJ, WJ, + /* 1B50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 1B60 */ O, O, O, O, O, O, O, O, O, O, O, SMAbv, SMBlw, SMAbv, SMAbv, SMAbv, + /* 1B70 */ SMAbv, SMAbv, SMAbv, SMAbv, O, O, O, O, O, O, O, O, O, O, O, WJ, /* Sundanese */ @@ -403,15 +404,15 @@ static const uint8_t use_table[] = { /* 1BC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BE0 */ B, B, B, B, B, B, CMAbv, VPst, VAbv, VAbv, VPst, VPst, VPst, VAbv, VPst, VAbv, - /* 1BF0 */ FAbv, FAbv, CMBlw, CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1BF0 */ FAbv, FAbv, CMBlw, CMBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, /* Lepcha */ /* 1C00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1C10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1C20 */ B, B, B, B, SUB, SUB, VPst, VPre, VPre, VPre, VPst, VPst, VBlw, FAbv, FAbv, FAbv, - /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FMAbv, CMBlw, O, O, O, O, O, O, O, O, - /* 1C40 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, B, B, + /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FMAbv, CMBlw, WJ, WJ, WJ, O, O, O, O, O, + /* 1C40 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, B, B, B, #define use_offset_0x1cd0u 3000 @@ -420,7 +421,7 @@ static const uint8_t use_table[] = { /* 1CD0 */ VMAbv, VMAbv, VMAbv, O, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMAbv, VMAbv, VMBlw, VMBlw, VMBlw, VMBlw, /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O, - /* 1CF0 */ O, O, O, O, VMAbv, CS, CS, VMPst, VMAbv, VMAbv, GB, O, O, O, O, O, + /* 1CF0 */ O, O, O, O, VMAbv, CS, CS, VMPst, VMAbv, VMAbv, GB, WJ, WJ, WJ, WJ, WJ, #define use_offset_0x1df8u 3048 @@ -432,31 +433,33 @@ static const uint8_t use_table[] = { /* General Punctuation */ - O, O, O, O, ZWNJ, CGJ, O, O, - /* 2010 */ GB, GB, GB, GB, GB, O, O, O, - -#define use_offset_0x2070u 3072 - + O, O, O, WJ, ZWNJ, CGJ, WJ, WJ, + /* 2010 */ GB, GB, GB, GB, GB, O, O, O, O, O, O, O, O, O, O, O, + /* 2020 */ O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, O, + /* 2030 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 2040 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 2050 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 2060 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Superscripts and Subscripts */ - /* 2070 */ O, O, O, O, FMPst, O, O, O, O, O, O, O, O, O, O, O, + /* 2070 */ O, O, WJ, WJ, FMPst, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FMPst, FMPst, FMPst, O, O, O, -#define use_offset_0x20f0u 3096 +#define use_offset_0x20f0u 3184 /* Combining Diacritical Marks for Symbols */ - /* 20F0 */ VMAbv, O, O, O, O, O, O, O, + /* 20F0 */ VMAbv, WJ, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x25c8u 3104 +#define use_offset_0x25c8u 3192 /* Geometric Shapes */ O, O, O, O, B, O, O, O, -#define use_offset_0x2d30u 3112 +#define use_offset_0x2d30u 3200 /* Tifinagh */ @@ -464,25 +467,25 @@ static const uint8_t use_table[] = { /* 2D30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 2D40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 2D50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 2D60 */ B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, B, - /* 2D70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, H, + /* 2D60 */ B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, B, + /* 2D70 */ O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, H, -#define use_offset_0xa800u 3192 +#define use_offset_0xa800u 3280 /* Syloti Nagri */ /* A800 */ B, B, VAbv, B, B, B, H, B, B, B, B, VMAbv, B, B, B, B, /* A810 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* A820 */ B, B, B, VPst, VPst, VBlw, VAbv, VPst, O, O, O, O, VBlw, O, O, O, - /* A830 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* A820 */ B, B, B, VPst, VPst, VBlw, VAbv, VPst, O, O, O, O, VBlw, WJ, WJ, WJ, + /* A830 */ O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, /* Phags-pa */ /* A840 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A850 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A860 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* A870 */ B, B, B, B, O, O, O, O, O, O, O, O, O, O, O, O, + /* A870 */ B, B, B, B, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Saurashtra */ @@ -490,8 +493,8 @@ static const uint8_t use_table[] = { /* A890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A8A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A8B0 */ B, B, B, B, MPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, - /* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, O, O, O, O, O, O, O, O, O, O, - /* A8D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, + /* A8D0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, /* Devanagari Extended */ @@ -508,9 +511,9 @@ static const uint8_t use_table[] = { /* A930 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A940 */ B, B, B, B, B, B, B, VBlw, VBlw, VBlw, VAbv, VBlw, VBlw, VBlw, VBlw, FAbv, - /* A950 */ FAbv, FAbv, FPst, VPst, O, O, O, O, O, O, O, O, O, O, O, O, + /* A950 */ FAbv, FAbv, FPst, VPst, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, /* A960 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* A970 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* A970 */ O, O, O, O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, /* Javanese */ @@ -518,22 +521,22 @@ static const uint8_t use_table[] = { /* A990 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A9A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* A9B0 */ B, B, B, CMAbv, VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VPre, VAbv, MBlw, MPst, MBlw, - /* A9C0 */ H, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* A9D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* A9C0 */ H, O, O, O, O, O, O, O, O, O, O, O, O, O, WJ, O, + /* A9D0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, O, O, /* Myanmar Extended-B */ /* A9E0 */ B, B, B, B, B, VAbv, O, B, B, B, B, B, B, B, B, B, - /* A9F0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, + /* A9F0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, /* Cham */ /* AA00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* AA10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* AA20 */ B, B, B, B, B, B, B, B, B, VMAbv, VAbv, VAbv, VAbv, VBlw, VAbv, VPre, - /* AA30 */ VPre, VAbv, VBlw, MPst, MPre, MAbv, MBlw, O, O, O, O, O, O, O, O, O, - /* AA40 */ B, B, B, FAbv, B, B, B, B, B, B, B, B, FAbv, FPst, O, O, - /* AA50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* AA30 */ VPre, VAbv, VBlw, MPst, MPre, MAbv, MBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* AA40 */ B, B, B, FAbv, B, B, B, B, B, B, B, B, FAbv, FPst, WJ, WJ, + /* AA50 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, O, O, O, O, /* Myanmar Extended-A */ @@ -546,115 +549,128 @@ static const uint8_t use_table[] = { /* AA90 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* AAA0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* AAB0 */ VAbv, B, VAbv, VAbv, VBlw, B, B, VAbv, VAbv, B, B, B, B, B, VAbv, VMAbv, - /* AAC0 */ B, VMAbv, B, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* AAD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* AAC0 */ B, VMAbv, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* AAD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, O, /* Meetei Mayek Extensions */ /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, - /* AAF0 */ O, O, O, O, O, VMPst, H, O, + /* AAF0 */ O, O, O, O, O, VMPst, H, WJ, -#define use_offset_0xabc0u 3952 +#define use_offset_0xabc0u 4040 /* Meetei Mayek */ /* ABC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* ABD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, - /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, WJ, WJ, + /* ABF0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0xfe00u 4016 +#define use_offset_0xfe00u 4104 /* Variation Selectors */ /* FE00 */ CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, -#define use_offset_0x10570u 4032 +#define use_offset_0xfef8u 4120 + + + /* Arabic Presentation Forms-B */ + O, O, O, O, O, WJ, WJ, WJ, + +#define use_offset_0xfff0u 4128 + + + /* Specials */ + + /* FFF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, O, WJ, WJ, + +#define use_offset_0x10570u 4144 /* Vithkuqi */ - /* 10570 */ B, B, B, B, B, B, B, B, B, B, B, O, B, B, B, B, - /* 10580 */ B, B, B, B, B, B, B, B, B, B, B, O, B, B, B, B, - /* 10590 */ B, B, B, O, B, B, O, B, B, B, B, B, B, B, B, B, - /* 105A0 */ B, B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 105B0 */ B, B, O, B, B, B, B, B, B, B, O, B, B, O, O, O, + /* 10570 */ B, B, B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, + /* 10580 */ B, B, B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, + /* 10590 */ B, B, B, WJ, B, B, WJ, B, B, B, B, B, B, B, B, B, + /* 105A0 */ B, B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 105B0 */ B, B, WJ, B, B, B, B, B, B, B, WJ, B, B, WJ, WJ, WJ, -#define use_offset_0x10a00u 4112 +#define use_offset_0x10a00u 4224 /* Kharoshthi */ - /* 10A00 */ B, VBlw, VBlw, VBlw, O, VAbv, VBlw, O, O, O, O, O, VPst, VMBlw, VMBlw, VMAbv, - /* 10A10 */ B, B, B, B, O, B, B, B, O, B, B, B, B, B, B, B, + /* 10A00 */ B, VBlw, VBlw, VBlw, WJ, VAbv, VBlw, WJ, WJ, WJ, WJ, WJ, VPst, VMBlw, VMBlw, VMAbv, + /* 10A10 */ B, B, B, B, WJ, B, B, B, WJ, B, B, B, B, B, B, B, /* 10A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10A30 */ B, B, B, B, B, B, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, - /* 10A40 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, + /* 10A30 */ B, B, B, B, B, B, WJ, WJ, CMAbv, CMBlw, CMBlw, WJ, WJ, WJ, WJ, H, + /* 10A40 */ B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x10ac0u 4192 +#define use_offset_0x10ac0u 4304 /* Manichaean */ /* 10AC0 */ B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, B, /* 10AD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10AE0 */ B, B, B, B, B, CMBlw, CMBlw, O, O, O, O, B, B, B, B, B, + /* 10AE0 */ B, B, B, B, B, CMBlw, CMBlw, WJ, WJ, WJ, WJ, B, B, B, B, B, -#define use_offset_0x10b80u 4240 +#define use_offset_0x10b80u 4352 /* Psalter Pahlavi */ /* 10B80 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10B90 */ B, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 10BA0 */ O, O, O, O, O, O, O, O, O, B, B, B, B, B, B, O, + /* 10B90 */ B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, WJ, WJ, WJ, + /* 10BA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, B, B, B, B, B, B, O, -#define use_offset_0x10d00u 4288 +#define use_offset_0x10d00u 4400 /* Hanifi Rohingya */ /* 10D00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 10D10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10D20 */ B, B, B, B, VMAbv, VMAbv, VMAbv, CMAbv, O, O, O, O, O, O, O, O, - /* 10D30 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 10D20 */ B, B, B, B, VMAbv, VMAbv, VMAbv, CMAbv, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 10D30 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x10e80u 4352 +#define use_offset_0x10e80u 4464 /* Yezidi */ /* 10E80 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 10E90 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10EA0 */ B, B, B, B, B, B, B, B, B, B, O, VAbv, VAbv, O, O, O, - /* 10EB0 */ B, B, O, O, O, O, O, O, + /* 10EA0 */ B, B, B, B, B, B, B, B, B, B, WJ, VAbv, VAbv, O, WJ, WJ, + /* 10EB0 */ B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x10f30u 4408 +#define use_offset_0x10f30u 4520 /* Sogdian */ /* 10F30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 10F40 */ B, B, B, B, B, B, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, - /* 10F50 */ VMBlw, B, B, B, B, O, O, O, O, O, O, O, O, O, O, O, - /* 10F60 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 10F50 */ VMBlw, B, B, B, B, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, + /* 10F60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Old Uyghur */ /* 10F70 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 10F80 */ B, B, CMBlw, CMBlw, CMBlw, CMBlw, O, O, O, O, O, O, O, O, O, O, - /* 10F90 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 10FA0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 10F80 */ B, B, CMBlw, CMBlw, CMBlw, CMBlw, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, + /* 10F90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 10FA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Chorasmian */ /* 10FB0 */ B, O, B, B, B, B, B, O, B, B, B, B, B, B, B, B, - /* 10FC0 */ O, B, B, B, B, O, O, O, O, B, B, B, O, O, O, O, - /* 10FD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 10FC0 */ O, B, B, B, B, O, O, O, O, B, B, B, WJ, WJ, WJ, WJ, + /* 10FD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* 10FE0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 10FF0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 10FF0 */ O, O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Brahmi */ @@ -662,10 +678,10 @@ static const uint8_t use_table[] = { /* 11010 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11020 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11030 */ B, B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, - /* 11040 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, O, O, O, O, O, O, O, O, O, - /* 11050 */ O, O, N, N, N, N, N, N, N, N, N, N, N, N, N, N, + /* 11040 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, O, O, O, O, O, O, O, WJ, WJ, + /* 11050 */ WJ, WJ, N, N, N, N, N, N, N, N, N, N, N, N, N, N, /* 11060 */ N, N, N, N, N, N, B, B, B, B, B, B, B, B, B, B, - /* 11070 */ VAbv, B, B, VAbv, VAbv, B, O, O, O, O, O, O, O, O, O, HN, + /* 11070 */ VAbv, B, B, VAbv, VAbv, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, HN, /* Kaithi */ @@ -673,9 +689,9 @@ static const uint8_t use_table[] = { /* 11090 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, - /* 110C0 */ O, O, VBlw, O, O, O, O, O, + /* 110C0 */ O, O, VBlw, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x11100u 4816 +#define use_offset_0x11100u 4928 /* Chakma */ @@ -683,14 +699,14 @@ static const uint8_t use_table[] = { /* 11100 */ VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11110 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11120 */ B, B, B, B, B, B, B, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VBlw, VAbv, VAbv, - /* 11130 */ VBlw, VAbv, VAbv, H, CMAbv, O, B, B, B, B, B, B, B, B, B, B, - /* 11140 */ O, O, O, O, B, VPst, VPst, B, O, O, O, O, O, O, O, O, + /* 11130 */ VBlw, VAbv, VAbv, H, CMAbv, WJ, B, B, B, B, B, B, B, B, B, B, + /* 11140 */ O, O, O, O, B, VPst, VPst, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Mahajani */ /* 11150 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11160 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11170 */ B, B, B, CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, + /* 11170 */ B, B, B, CMBlw, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Sharada */ @@ -698,50 +714,50 @@ static const uint8_t use_table[] = { /* 11190 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 111A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 111B0 */ B, B, B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, - /* 111C0 */ H, B, R, R, O, O, O, O, GB, FMBlw, CMBlw, VAbv, VBlw, O, VPre, VMAbv, + /* 111C0 */ H, B, R, R, O, O, O, O, O, FMBlw, CMBlw, VAbv, VBlw, O, VPre, VMAbv, /* 111D0 */ B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, /* Sinhala Archaic Numbers */ - /* 111E0 */ O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 111F0 */ B, B, B, B, B, O, O, O, O, O, O, O, O, O, O, O, + /* 111E0 */ WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 111F0 */ B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Khojki */ /* 11200 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11210 */ B, B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 11210 */ B, B, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, - /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, + /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, WJ, -#define use_offset_0x11280u 5136 +#define use_offset_0x11280u 5248 /* Multani */ - /* 11280 */ B, B, B, B, B, B, B, O, B, O, B, B, B, B, O, B, - /* 11290 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, B, - /* 112A0 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, + /* 11280 */ B, B, B, B, B, B, B, WJ, B, WJ, B, B, B, B, WJ, B, + /* 11290 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, B, + /* 112A0 */ B, B, B, B, B, B, B, B, B, O, WJ, WJ, WJ, WJ, WJ, WJ, /* Khudawadi */ /* 112B0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 112C0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 112D0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VMAbv, - /* 112E0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, CMBlw, VBlw, O, O, O, O, O, - /* 112F0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 112E0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, CMBlw, VBlw, WJ, WJ, WJ, WJ, WJ, + /* 112F0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, /* Grantha */ - /* 11300 */ VMAbv, VMAbv, VMAbv, VMAbv, O, B, B, B, B, B, B, B, B, O, O, B, - /* 11310 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11320 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, - /* 11330 */ B, O, B, B, O, B, B, B, B, B, O, CMBlw, CMBlw, B, VPst, VPst, - /* 11340 */ VAbv, VPst, VPst, VPst, VPst, O, O, VPre, VPre, O, O, VPre, VPre, HVM, O, O, - /* 11350 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, B, B, - /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, - /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, + /* 11300 */ VMAbv, VMAbv, VMAbv, VMAbv, WJ, B, B, B, B, B, B, B, B, WJ, WJ, B, + /* 11310 */ B, WJ, WJ, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 11320 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, + /* 11330 */ B, WJ, B, B, WJ, B, B, B, B, B, WJ, CMBlw, CMBlw, B, VPst, VPst, + /* 11340 */ VAbv, VPst, VPst, VPst, VPst, WJ, WJ, VPre, VPre, WJ, WJ, VPre, VPre, HVM, WJ, WJ, + /* 11350 */ O, WJ, WJ, WJ, WJ, WJ, WJ, VPst, WJ, WJ, WJ, WJ, WJ, O, B, B, + /* 11360 */ B, B, VPst, VPst, WJ, WJ, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, WJ, WJ, WJ, + /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, WJ, WJ, WJ, -#define use_offset_0x11400u 5384 +#define use_offset_0x11400u 5496 /* Newa */ @@ -751,9 +767,9 @@ static const uint8_t use_table[] = { /* 11420 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11430 */ B, B, B, B, B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, /* 11440 */ VPst, VPst, H, VMAbv, VMAbv, VMPst, CMBlw, B, O, O, O, O, O, O, O, O, - /* 11450 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, FMAbv, B, - /* 11460 */ CS, CS, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 11470 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 11450 */ B, B, B, B, B, B, B, B, B, B, O, O, WJ, O, FMAbv, B, + /* 11460 */ CS, CS, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11470 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Tirhuta */ @@ -761,10 +777,10 @@ static const uint8_t use_table[] = { /* 11490 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 114A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 114B0 */ VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VPre, VAbv, VPre, VPre, VPst, VPre, VMAbv, - /* 114C0 */ VMAbv, VMAbv, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, - /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 114C0 */ VMAbv, VMAbv, H, CMBlw, B, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 114D0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x11580u 5608 +#define use_offset_0x11580u 5720 /* Siddham */ @@ -772,11 +788,11 @@ static const uint8_t use_table[] = { /* 11580 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11590 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 115A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst, - /* 115B0 */ VPre, VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, VPre, VPre, VMAbv, VMAbv, VMPst, H, + /* 115B0 */ VPre, VPst, VBlw, VBlw, VBlw, VBlw, WJ, WJ, VPre, VPre, VPre, VPre, VMAbv, VMAbv, VMPst, H, /* 115C0 */ CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 115D0 */ O, O, O, O, O, O, O, O, B, B, B, B, VBlw, VBlw, O, O, - /* 115E0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 115F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 115D0 */ O, O, O, O, O, O, O, O, B, B, B, B, VBlw, VBlw, WJ, WJ, + /* 115E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 115F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Modi */ @@ -784,31 +800,31 @@ static const uint8_t use_table[] = { /* 11610 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11620 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11630 */ VPst, VPst, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPst, VPst, VMAbv, VMPst, H, - /* 11640 */ VAbv, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 11650 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, - /* 11660 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 11670 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 11640 */ VAbv, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11650 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11660 */ O, O, O, O, O, O, O, O, O, O, O, O, O, WJ, WJ, WJ, + /* 11670 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Takri */ /* 11680 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11690 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 116A0 */ B, B, B, B, B, B, B, B, B, B, B, VMAbv, VMPst, VAbv, VPre, VPst, - /* 116B0 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, CMBlw, B, O, O, O, O, O, O, O, - /* 116C0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, - /* 116D0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 116E0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 116F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 116B0 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, CMBlw, B, O, WJ, WJ, WJ, WJ, WJ, WJ, + /* 116C0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, + /* 116D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 116E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 116F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Ahom */ /* 11700 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11710 */ B, B, B, B, B, B, B, B, B, B, B, O, O, MBlw, MPre, MAbv, - /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O, + /* 11710 */ B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, MBlw, MPre, MAbv, + /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, WJ, WJ, WJ, WJ, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, - /* 11740 */ B, B, B, B, B, B, B, O, + /* 11740 */ B, B, B, B, B, B, B, WJ, -#define use_offset_0x11800u 6064 +#define use_offset_0x11800u 6176 /* Dogra */ @@ -816,31 +832,31 @@ static const uint8_t use_table[] = { /* 11800 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11810 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11820 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPre, VPst, VBlw, - /* 11830 */ VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VMAbv, VMPst, H, CMBlw, O, O, O, O, O, + /* 11830 */ VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VMAbv, VMPst, H, CMBlw, O, WJ, WJ, WJ, WJ, -#define use_offset_0x11900u 6128 +#define use_offset_0x11900u 6240 /* Dives Akuru */ - /* 11900 */ B, B, B, B, B, B, B, O, O, B, O, O, B, B, B, B, - /* 11910 */ B, B, B, B, O, B, B, O, B, B, B, B, B, B, B, B, + /* 11900 */ B, B, B, B, B, B, B, WJ, WJ, B, WJ, WJ, B, B, B, B, + /* 11910 */ B, B, B, B, WJ, B, B, WJ, B, B, B, B, B, B, B, B, /* 11920 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11930 */ VPst, VPst, VPst, VPst, VPst, VPre, O, VPre, VPre, O, O, VMAbv, VMAbv, VPst, H, R, - /* 11940 */ MPst, R, MPst, CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, - /* 11950 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 11930 */ VPst, VPst, VPst, VPst, VPst, VPre, WJ, VPre, VPre, WJ, WJ, VMAbv, VMAbv, VPst, H, R, + /* 11940 */ MPst, R, MPst, CMBlw, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11950 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x119a0u 6224 +#define use_offset_0x119a0u 6336 /* Nandinagari */ - /* 119A0 */ B, B, B, B, B, B, B, B, O, O, B, B, B, B, B, B, + /* 119A0 */ B, B, B, B, B, B, B, B, WJ, WJ, B, B, B, B, B, B, /* 119B0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 119C0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 119D0 */ B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, O, O, VAbv, VAbv, VPst, VPst, VMPst, VMPst, - /* 119E0 */ H, B, O, O, VPre, O, O, O, O, O, O, O, O, O, O, O, - /* 119F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 119D0 */ B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, WJ, WJ, VAbv, VAbv, VPst, VPst, VMPst, VMPst, + /* 119E0 */ H, B, O, O, VPre, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 119F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Zanabazar Square */ @@ -848,7 +864,7 @@ static const uint8_t use_table[] = { /* 11A10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11A30 */ B, B, B, FMBlw, VBlw, VMAbv, VMAbv, VMAbv, VMAbv, VMPst, R, MBlw, MBlw, MBlw, MBlw, GB, - /* 11A40 */ O, O, O, O, O, GB, O, H, O, O, O, O, O, O, O, O, + /* 11A40 */ O, O, O, O, O, GB, O, H, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Soyombo */ @@ -858,48 +874,48 @@ static const uint8_t use_table[] = { /* 11A80 */ B, B, B, B, R, R, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, B, O, O, -#define use_offset_0x11c00u 6480 +#define use_offset_0x11c00u 6592 /* Bhaiksuki */ - /* 11C00 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, + /* 11C00 */ B, B, B, B, B, B, B, B, B, WJ, B, B, B, B, B, B, /* 11C10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11C20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst, - /* 11C30 */ VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VBlw, O, VAbv, VAbv, VAbv, VAbv, VMAbv, VMAbv, VMPst, H, - /* 11C40 */ B, O, O, O, GB, GB, O, O, O, O, O, O, O, O, O, O, + /* 11C30 */ VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VBlw, WJ, VAbv, VAbv, VAbv, VAbv, VMAbv, VMAbv, VMPst, H, + /* 11C40 */ B, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* 11C50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11C60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, + /* 11C60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, /* Marchen */ /* 11C70 */ O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11C80 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11C90 */ O, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, - /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, - /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, + /* 11C90 */ WJ, WJ, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, + /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, WJ, SUB, SUB, SUB, SUB, SUB, SUB, SUB, + /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, WJ, -#define use_offset_0x11d00u 6664 +#define use_offset_0x11d00u 6776 /* Masaram Gondi */ - /* 11D00 */ B, B, B, B, B, B, B, O, B, B, O, B, B, B, B, B, + /* 11D00 */ B, B, B, B, B, B, B, WJ, B, B, WJ, B, B, B, B, B, /* 11D10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11D30 */ B, VAbv, VAbv, VAbv, VAbv, VAbv, VBlw, O, O, O, VAbv, O, VAbv, VAbv, O, VAbv, - /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O, - /* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 11D30 */ B, VAbv, VAbv, VAbv, VAbv, VAbv, VBlw, WJ, WJ, WJ, VAbv, WJ, VAbv, VAbv, WJ, VAbv, + /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11D50 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, /* Gunjala Gondi */ - /* 11D60 */ B, B, B, B, B, B, O, B, B, O, B, B, B, B, B, B, + /* 11D60 */ B, B, B, B, B, B, WJ, B, B, WJ, B, B, B, B, B, B, /* 11D70 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 11D80 */ B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VPst, VPst, O, - /* 11D90 */ VAbv, VAbv, O, VPst, VPst, VMAbv, VMPst, H, O, O, O, O, O, O, O, O, - /* 11DA0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 11D80 */ B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VPst, VPst, WJ, + /* 11D90 */ VAbv, VAbv, WJ, VPst, VPst, VMAbv, VMPst, H, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 11DA0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x11ee0u 6840 +#define use_offset_0x11ee0u 6952 /* Makasar */ @@ -907,7 +923,7 @@ static const uint8_t use_table[] = { /* 11EE0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11EF0 */ B, B, GB, VAbv, VBlw, VPre, VPst, O, -#define use_offset_0x13000u 6864 +#define use_offset_0x13000u 6976 /* Egyptian Hieroglyphs */ @@ -978,21 +994,21 @@ static const uint8_t use_table[] = { /* 133F0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 13400 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 13410 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 13420 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, + /* 13420 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, /* Egyptian Hieroglyph Format Controls */ - /* 13430 */ H, H, H, H, H, H, H, B, B, O, O, O, O, O, O, O, + /* 13430 */ H, H, H, H, H, H, H, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, -#define use_offset_0x16ac0u 7952 +#define use_offset_0x16ac0u 8064 /* Tangsa */ - /* 16AC0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 16AC0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, /* 16AD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 16AE0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, - /* 16AF0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 16AE0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, WJ, WJ, + /* 16AF0 */ O, O, O, O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Pahawh Hmong */ @@ -1001,7 +1017,7 @@ static const uint8_t use_table[] = { /* 16B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16B30 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, -#define use_offset_0x16f00u 8072 +#define use_offset_0x16f00u 8184 /* Miao */ @@ -1010,21 +1026,21 @@ static const uint8_t use_table[] = { /* 16F10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16F20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16F30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 16F40 */ B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, CMBlw, + /* 16F40 */ B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, CMBlw, /* 16F50 */ O, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, /* 16F60 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, /* 16F70 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, - /* 16F80 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, O, O, O, O, O, O, O, VMBlw, + /* 16F80 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, WJ, WJ, WJ, WJ, WJ, WJ, WJ, VMBlw, /* 16F90 */ VMBlw, VMBlw, VMBlw, O, O, O, O, O, -#define use_offset_0x16fe0u 8224 +#define use_offset_0x16fe0u 8336 /* Ideographic Symbols and Punctuation */ - /* 16FE0 */ O, O, O, O, B, O, O, O, + /* 16FE0 */ O, O, O, O, B, WJ, WJ, WJ, -#define use_offset_0x18b00u 8232 +#define use_offset_0x18b00u 8344 /* Khitan Small Script */ @@ -1058,9 +1074,9 @@ static const uint8_t use_table[] = { /* 18CA0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 18CB0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 18CC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 18CD0 */ B, B, B, B, B, B, O, O, + /* 18CD0 */ B, B, B, B, B, B, WJ, WJ, -#define use_offset_0x1bc00u 8704 +#define use_offset_0x1bc00u 8816 /* Duployan */ @@ -1071,39 +1087,46 @@ static const uint8_t use_table[] = { /* 1BC30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BC40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BC50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1BC60 */ B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, - /* 1BC70 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, - /* 1BC80 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, - /* 1BC90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, CMBlw, CMBlw, O, + /* 1BC60 */ B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, + /* 1BC70 */ B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, + /* 1BC80 */ B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* 1BC90 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, O, CMBlw, CMBlw, O, + +#define use_offset_0x1d170u 8976 + -#define use_offset_0x1e100u 8864 + /* Musical Symbols */ + + /* 1D170 */ O, O, O, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, O, O, O, O, O, + +#define use_offset_0x1e100u 8992 /* Nyiakeng Puachue Hmong */ /* 1E100 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1E110 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1E120 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, - /* 1E130 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, O, O, - /* 1E140 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, B, B, + /* 1E120 */ B, B, B, B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, + /* 1E130 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, WJ, WJ, + /* 1E140 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, B, B, -#define use_offset_0x1e290u 8944 +#define use_offset_0x1e290u 9072 /* Toto */ /* 1E290 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1E2A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, VMAbv, O, - /* 1E2B0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1E2A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, VMAbv, WJ, + /* 1E2B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Wancho */ /* 1E2C0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1E2D0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1E2E0 */ B, B, B, B, B, B, B, B, B, B, B, B, VMAbv, VMAbv, VMAbv, VMAbv, - /* 1E2F0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 1E2F0 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, WJ, O, -#define use_offset_0x1e900u 9056 +#define use_offset_0x1e900u 9184 /* Adlam */ @@ -1112,11 +1135,33 @@ static const uint8_t use_table[] = { /* 1E910 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1E920 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1E930 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1E940 */ B, B, B, B, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, B, O, O, O, O, - /* 1E950 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, + /* 1E940 */ B, B, B, B, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, B, WJ, WJ, WJ, WJ, + /* 1E950 */ B, B, B, B, B, B, B, B, B, B, WJ, WJ, WJ, WJ, O, O, + +#define use_offset_0xe0000u 9280 + + + /* Tags */ -#define use_offset_0xe0100u 9152 + /* E0000 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0010 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0020 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0030 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0040 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0050 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0060 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0070 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* No_Block */ + + /* E0080 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0090 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E00F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, /* Variation Selectors Supplement */ @@ -1136,11 +1181,240 @@ static const uint8_t use_table[] = { /* E01D0 */ CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, /* E01E0 */ CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, CGJ, -}; /* Table items: 9392; occupancy: 79% */ + /* No_Block */ + + /* E01F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0200 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0210 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0220 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0230 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0240 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0250 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0260 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0270 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0280 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0290 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E02F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0300 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0310 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0320 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0330 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0340 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0350 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0360 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0370 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0380 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0390 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E03F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0400 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0410 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0420 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0430 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0440 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0450 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0460 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0470 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0480 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0490 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E04F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0500 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0510 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0520 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0530 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0540 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0550 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0560 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0570 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0580 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0590 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E05F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0600 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0610 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0620 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0630 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0640 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0650 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0660 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0670 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0680 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0690 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E06F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0700 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0710 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0720 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0730 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0740 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0750 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0760 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0770 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0780 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0790 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E07F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0800 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0810 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0820 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0830 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0840 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0850 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0860 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0870 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0880 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0890 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E08F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0900 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0910 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0920 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0930 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0940 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0950 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0960 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0970 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0980 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0990 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09A0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09B0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09C0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09D0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09E0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E09F0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0A90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0AF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0B90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0BF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0C90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0CF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0D90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0DF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0E90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0EA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0EB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0EC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0ED0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0EE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0EF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F00 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F10 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F20 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F30 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F40 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F50 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F60 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F70 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F80 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0F90 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FA0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FB0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FC0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FD0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FE0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + /* E0FF0 */ WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, WJ, + +}; /* Table items: 13376; occupancy: 84% */ static inline uint8_t -hb_use_get_category (hb_codepoint_t u) +hb_use_get_category (hb_glyph_info_t info) { + hb_codepoint_t u = info.codepoint; switch (u >> 12) { case 0x0u: @@ -1164,8 +1438,7 @@ hb_use_get_category (hb_codepoint_t u) break; case 0x2u: - if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u]; - if (hb_in_range<hb_codepoint_t> (u, 0x2070u, 0x2087u)) return use_table[u - 0x2070u + use_offset_0x2070u]; + if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2087u)) return use_table[u - 0x2008u + use_offset_0x2008u]; if (hb_in_range<hb_codepoint_t> (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u]; if (hb_in_range<hb_codepoint_t> (u, 0x25C8u, 0x25CFu)) return use_table[u - 0x25C8u + use_offset_0x25c8u]; if (hb_in_range<hb_codepoint_t> (u, 0x2D30u, 0x2D7Fu)) return use_table[u - 0x2D30u + use_offset_0x2d30u]; @@ -1178,9 +1451,12 @@ hb_use_get_category (hb_codepoint_t u) case 0xFu: if (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)) return use_table[u - 0xFE00u + use_offset_0xfe00u]; + if (hb_in_range<hb_codepoint_t> (u, 0xFEF8u, 0xFEFFu)) return use_table[u - 0xFEF8u + use_offset_0xfef8u]; + if (hb_in_range<hb_codepoint_t> (u, 0xFFF0u, 0xFFFFu)) return use_table[u - 0xFFF0u + use_offset_0xfff0u]; break; case 0x10u: + if (hb_in_range<hb_codepoint_t> (u, 0xFFF0u, 0xFFFFu)) return use_table[u - 0xFFF0u + use_offset_0xfff0u]; if (hb_in_range<hb_codepoint_t> (u, 0x10570u, 0x105BFu)) return use_table[u - 0x10570u + use_offset_0x10570u]; if (hb_in_range<hb_codepoint_t> (u, 0x10A00u, 0x10A4Fu)) return use_table[u - 0x10A00u + use_offset_0x10a00u]; if (hb_in_range<hb_codepoint_t> (u, 0x10AC0u, 0x10AEFu)) return use_table[u - 0x10AC0u + use_offset_0x10ac0u]; @@ -1222,6 +1498,10 @@ hb_use_get_category (hb_codepoint_t u) if (hb_in_range<hb_codepoint_t> (u, 0x1BC00u, 0x1BC9Fu)) return use_table[u - 0x1BC00u + use_offset_0x1bc00u]; break; + case 0x1Du: + if (hb_in_range<hb_codepoint_t> (u, 0x1D170u, 0x1D17Fu)) return use_table[u - 0x1D170u + use_offset_0x1d170u]; + break; + case 0x1Eu: if (hb_in_range<hb_codepoint_t> (u, 0x1E100u, 0x1E14Fu)) return use_table[u - 0x1E100u + use_offset_0x1e100u]; if (hb_in_range<hb_codepoint_t> (u, 0x1E290u, 0x1E2FFu)) return use_table[u - 0x1E290u + use_offset_0x1e290u]; @@ -1229,13 +1509,19 @@ hb_use_get_category (hb_codepoint_t u) break; case 0xE0u: - if (hb_in_range<hb_codepoint_t> (u, 0xE0100u, 0xE01EFu)) return use_table[u - 0xE0100u + use_offset_0xe0100u]; + if (hb_in_range<hb_codepoint_t> (u, 0xE0000u, 0xE0FFFu)) return use_table[u - 0xE0000u + use_offset_0xe0000u]; + break; + + case 0xE1u: + if (hb_in_range<hb_codepoint_t> (u, 0xE0000u, 0xE0FFFu)) return use_table[u - 0xE0000u + use_offset_0xe0000u]; break; default: break; } - return USE(O); + if (_hb_glyph_info_get_general_category (&info) == HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) + return WJ; + return O; } #undef B @@ -1254,6 +1540,7 @@ hb_use_get_category (hb_codepoint_t u) #undef SE #undef SUB #undef Sk +#undef WJ #undef ZWNJ #undef CMAbv #undef CMBlw diff --git a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc index 70b637933d..95ef3fd6ec 100644 --- a/thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc +++ b/thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc @@ -206,7 +206,7 @@ setup_masks_use (const hb_ot_shape_plan_t *plan, unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - info[i].use_category() = hb_use_get_category (info[i].codepoint); + info[i].use_category() = hb_use_get_category (info[i]); } static void @@ -257,7 +257,6 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan, use_syllable_type_t syllable_type = (use_syllable_type_t) (info[start].syllable() & 0x0F); switch (syllable_type) { - case use_symbol_cluster: case use_hieroglyph_cluster: case use_non_cluster: /* These don't join. Nothing to do. */ @@ -269,6 +268,7 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan, case use_standard_cluster: case use_number_joiner_terminated_cluster: case use_numeral_cluster: + case use_symbol_cluster: case use_broken_cluster: bool join = last_form == JOINING_FORM_FINA || last_form == JOINING_FORM_ISOL; @@ -363,6 +363,7 @@ reorder_syllable_use (hb_buffer_t *buffer, unsigned int start, unsigned int end) (FLAG (use_virama_terminated_cluster) | FLAG (use_sakot_terminated_cluster) | FLAG (use_standard_cluster) | + FLAG (use_symbol_cluster) | FLAG (use_broken_cluster) | 0)))) return; diff --git a/thirdparty/harfbuzz/src/hb-ot-tag-table.hh b/thirdparty/harfbuzz/src/hb-ot-tag-table.hh index 61d2814e93..5261783277 100644 --- a/thirdparty/harfbuzz/src/hb-ot-tag-table.hh +++ b/thirdparty/harfbuzz/src/hb-ot-tag-table.hh @@ -7,7 +7,7 @@ * on files with these headers: * * <meta name="updated_at" content="2022-01-28 10:00 PM" /> - * File-Date: 2021-12-29 + * File-Date: 2022-03-02 */ #ifndef HB_OT_TAG_TABLE_HH @@ -54,6 +54,7 @@ static const LangTag ot_languages[] = { /*{"aio", HB_TAG('A','I','O',' ')},*/ /* Aiton */ {"aiw", HB_TAG('A','R','I',' ')}, /* Aari */ {"ajp", HB_TAG('A','R','A',' ')}, /* South Levantine Arabic -> Arabic */ + {"ajt", HB_TAG('A','R','A',' ')}, /* Judeo-Tunisian Arabic (retired code) -> Arabic */ {"ak", HB_TAG('A','K','A',' ')}, /* Akan [macrolanguage] */ {"akb", HB_TAG('A','K','B',' ')}, /* Batak Angkola */ {"akb", HB_TAG('B','T','K',' ')}, /* Batak Angkola -> Batak */ @@ -809,7 +810,7 @@ static const LangTag ot_languages[] = { {"lac", HB_TAG('M','Y','N',' ')}, /* Lacandon -> Mayan */ {"lad", HB_TAG('J','U','D',' ')}, /* Ladino */ {"lah", HB_TAG_NONE }, /* Lahnda [macrolanguage] != Lahuli */ - {"lak", HB_TAG_NONE }, /* Laka (Nigeria) != Lak */ + {"lak", HB_TAG_NONE }, /* Laka (Nigeria) (retired code) != Lak */ {"lam", HB_TAG_NONE }, /* Lamba != Lambani */ {"laz", HB_TAG_NONE }, /* Aribwatsa != Laz */ {"lb", HB_TAG('L','T','Z',' ')}, /* Luxembourgish */ @@ -1339,12 +1340,14 @@ static const LangTag ot_languages[] = { {"sla", HB_TAG_NONE }, /* Slavic [collection] != Slavey */ {"sm", HB_TAG('S','M','O',' ')}, /* Samoan */ {"sma", HB_TAG('S','S','M',' ')}, /* Southern Sami */ + {"smd", HB_TAG('M','B','N',' ')}, /* Sama (retired code) -> Mbundu */ {"smj", HB_TAG('L','S','M',' ')}, /* Lule Sami */ {"sml", HB_TAG_NONE }, /* Central Sama != Somali */ {"smn", HB_TAG('I','S','M',' ')}, /* Inari Sami */ {"sms", HB_TAG('S','K','S',' ')}, /* Skolt Sami */ {"smt", HB_TAG('Q','I','N',' ')}, /* Simte -> Chin */ {"sn", HB_TAG('S','N','A','0')}, /* Shona */ + {"snb", HB_TAG('I','B','A',' ')}, /* Sebuyau (retired code) -> Iban */ {"snh", HB_TAG_NONE }, /* Shinabo (retired code) != Sinhala (Sinhalese) */ /*{"snk", HB_TAG('S','N','K',' ')},*/ /* Soninke */ {"so", HB_TAG('S','M','L',' ')}, /* Somali */ diff --git a/thirdparty/harfbuzz/src/hb-repacker.hh b/thirdparty/harfbuzz/src/hb-repacker.hh index b1726d8beb..2a9e75c45b 100644 --- a/thirdparty/harfbuzz/src/hb-repacker.hh +++ b/thirdparty/harfbuzz/src/hb-repacker.hh @@ -37,7 +37,6 @@ * For a detailed writeup on the overflow resolution algorithm see: * docs/repacker.md */ - struct graph_t { struct vertex_t @@ -140,7 +139,8 @@ struct graph_t * the 'packed' object stack used internally in the * serializer */ - graph_t (const hb_vector_t<hb_serialize_context_t::object_t *>& objects) + template<typename T> + graph_t (const T& objects) : parents_invalid (true), distance_invalid (true), positions_invalid (true), @@ -1098,8 +1098,9 @@ struct graph_t hb_vector_t<unsigned> num_roots_for_space_; }; -static bool _try_isolating_subgraphs (const hb_vector_t<graph_t::overflow_record_t>& overflows, - graph_t& sorted_graph) +static inline +bool _try_isolating_subgraphs (const hb_vector_t<graph_t::overflow_record_t>& overflows, + graph_t& sorted_graph) { unsigned space = 0; hb_set_t roots_to_isolate; @@ -1147,9 +1148,10 @@ static bool _try_isolating_subgraphs (const hb_vector_t<graph_t::overflow_record return true; } -static bool _process_overflows (const hb_vector_t<graph_t::overflow_record_t>& overflows, - hb_set_t& priority_bumped_parents, - graph_t& sorted_graph) +static inline +bool _process_overflows (const hb_vector_t<graph_t::overflow_record_t>& overflows, + hb_set_t& priority_bumped_parents, + graph_t& sorted_graph) { bool resolution_attempted = false; @@ -1207,8 +1209,9 @@ static bool _process_overflows (const hb_vector_t<graph_t::overflow_record_t>& o * For a detailed writeup describing how the algorithm operates see: * docs/repacker.md */ +template<typename T> inline hb_blob_t* -hb_resolve_overflows (const hb_vector_t<hb_serialize_context_t::object_t *>& packed, +hb_resolve_overflows (const T& packed, hb_tag_t table_tag, unsigned max_rounds = 20) { // Kahn sort is ~twice as fast as shortest distance sort and works for many fonts diff --git a/thirdparty/harfbuzz/src/hb-serialize.hh b/thirdparty/harfbuzz/src/hb-serialize.hh index 6615f033c5..40895a4548 100644 --- a/thirdparty/harfbuzz/src/hb-serialize.hh +++ b/thirdparty/harfbuzz/src/hb-serialize.hh @@ -36,6 +36,9 @@ #include "hb-map.hh" #include "hb-pool.hh" +#ifdef HB_EXPERIMENTAL_API +#include "hb-subset-repacker.h" +#endif /* * Serialize @@ -70,6 +73,24 @@ struct hb_serialize_context_t virtual_links.fini (); } + object_t () = default; + +#ifdef HB_EXPERIMENTAL_API + object_t (const hb_object_t &o) + { + head = o.head; + tail = o.tail; + next = nullptr; + real_links.alloc (o.num_real_links); + for (unsigned i = 0 ; i < o.num_real_links; i++) + real_links.push (o.real_links[i]); + + virtual_links.alloc (o.num_virtual_links); + for (unsigned i = 0; i < o.num_virtual_links; i++) + virtual_links.push (o.virtual_links[i]); + } +#endif + bool operator == (const object_t &o) const { // Virtual links aren't considered for equality since they don't affect the functionality @@ -95,6 +116,20 @@ struct hb_serialize_context_t unsigned position: 28; unsigned bias; objidx_t objidx; + + link_t () = default; + +#ifdef HB_EXPERIMENTAL_API + link_t (const hb_link_t &o) + { + width = o.width; + is_signed = 0; + whence = 0; + position = o.position; + bias = 0; + objidx = o.objidx; + } +#endif }; char *head; diff --git a/thirdparty/harfbuzz/src/hb-subset-repacker.cc b/thirdparty/harfbuzz/src/hb-subset-repacker.cc new file mode 100644 index 0000000000..2447d296b8 --- /dev/null +++ b/thirdparty/harfbuzz/src/hb-subset-repacker.cc @@ -0,0 +1,49 @@ +/* + * Copyright © 2022 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + */ +#include "hb-repacker.hh" + +#ifdef HB_EXPERIMENTAL_API +/** + * hb_subset_repack_or_fail: + * @hb_objects: raw array of struct hb_object_t, which provides + * object graph info + * @num_hb_objs: number of hb_object_t in the hb_objects array. + * + * Given the input object graph info, repack a table to eliminate + * offset overflows. A nullptr is returned if the repacking attempt fails. + * + * Since: EXPERIMENTAL + **/ +hb_blob_t* hb_subset_repack_or_fail (hb_object_t* hb_objects, unsigned num_hb_objs) +{ + hb_vector_t<const hb_object_t *> packed; + packed.alloc (num_hb_objs + 1); + packed.push (nullptr); + for (unsigned i = 0 ; i < num_hb_objs ; i++) + packed.push (&(hb_objects[i])); + return hb_resolve_overflows (packed, HB_OT_TAG_GSUB); +} +#endif + diff --git a/thirdparty/harfbuzz/src/hb-subset-repacker.h b/thirdparty/harfbuzz/src/hb-subset-repacker.h new file mode 100644 index 0000000000..f9a2383698 --- /dev/null +++ b/thirdparty/harfbuzz/src/hb-subset-repacker.h @@ -0,0 +1,80 @@ +/* + * Copyright © 2022 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + */ + +#ifndef HB_SUBSET_REPACKER_H +#define HB_SUBSET_REPACKER_H + +#include "hb.h" + +HB_BEGIN_DECLS + +#ifdef HB_EXPERIMENTAL_API +/** + * struct hb_link_t + * width: offsetSize in bytes + * position: position of the offset field in bytes + * from beginning of subtable + * objidx: index of subtable + **/ +struct hb_link_t +{ + unsigned width; + unsigned position; + unsigned objidx; +}; + +typedef struct hb_link_t hb_link_t; + +/** + * struct hb_object_t + * head: start of object data + * tail: end of object data + * num_real_links: num of offset field in the object + * real_links: pointer to array of offset info + * num_virtual_links: num of objects that must be packed + * after current object in the final serialized order + * virtual_links: array of virtual link info + **/ +struct hb_object_t +{ + char *head; + char *tail; + unsigned num_real_links; + hb_link_t *real_links; + unsigned num_virtual_links; + hb_link_t *virtual_links; +}; + +typedef struct hb_object_t hb_object_t; + +HB_EXTERN hb_blob_t* +hb_subset_repack_or_fail (hb_object_t* hb_objects, + unsigned num_hb_objs); + +#endif + +HB_END_DECLS + +#endif /* HB_SUBSET_REPACKER_H */ diff --git a/thirdparty/harfbuzz/src/hb-version.h b/thirdparty/harfbuzz/src/hb-version.h index dd2c5288cc..e6bb69a0f2 100644 --- a/thirdparty/harfbuzz/src/hb-version.h +++ b/thirdparty/harfbuzz/src/hb-version.h @@ -53,14 +53,14 @@ HB_BEGIN_DECLS * * The micro component of the library version available at compile-time. */ -#define HB_VERSION_MICRO 0 +#define HB_VERSION_MICRO 1 /** * HB_VERSION_STRING: * * A string literal containing the library version available at compile-time. */ -#define HB_VERSION_STRING "4.0.0" +#define HB_VERSION_STRING "4.0.1" /** * HB_VERSION_ATLEAST: |