Skip to content

Commit

Permalink
Merge pull request #58233 from bruvzg/gde_ts
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Mar 18, 2022
2 parents da26fcc + f19cd44 commit 5c8bd6f
Show file tree
Hide file tree
Showing 49 changed files with 4,745 additions and 3,213 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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_"
Expand Down
4 changes: 2 additions & 2 deletions core/io/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 8 additions & 8 deletions core/io/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ class Image : public Resource {
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;
Expand Down Expand Up @@ -289,6 +281,14 @@ class Image : public Resource {
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
*/
Expand Down
6 changes: 6 additions & 0 deletions core/string/ustring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions core/string/ustring.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class String {
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);
Expand Down
2 changes: 2 additions & 0 deletions core/variant/variant_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
1 change: 1 addition & 0 deletions core/variant/variant_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/Font.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
24 changes: 24 additions & 0 deletions doc/classes/String.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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 &lt;">
<return type="bool" />
<argument index="0" name="right" type="String" />
Expand Down
53 changes: 36 additions & 17 deletions doc/classes/TextServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand All @@ -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">
Expand Down
9 changes: 9 additions & 0 deletions doc/classes/TextServerDummy.xml
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit 5c8bd6f

Please sign in to comment.