mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 22:23:07 +00:00
Merge pull request #89207 from bruvzg/_ts_req
[TextServer] Use GDVIRTUAL_REQUIRED_CALL for required extensions methods, update extension docs.
This commit is contained in:
commit
6c482fad89
@ -42,7 +42,7 @@
|
||||
<param index="0" name="cache_index" type="int" />
|
||||
<param index="1" name="size" type="Vector2i" />
|
||||
<description>
|
||||
Removes all rendered glyphs information from the cache entry.
|
||||
Removes all rendered glyph information from the cache entry.
|
||||
[b]Note:[/b] This function will not remove textures associated with the glyphs, use [method remove_texture] to remove them manually.
|
||||
</description>
|
||||
</method>
|
||||
@ -579,7 +579,7 @@
|
||||
<param index="0" name="cache_index" type="int" />
|
||||
<param index="1" name="transform" type="Transform2D" />
|
||||
<description>
|
||||
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs.
|
||||
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping, and rotating glyphs.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_variation_coordinates">
|
||||
|
@ -27,7 +27,7 @@
|
||||
<param index="0" name="direction" type="int" enum="TextServer.Direction" default="0" />
|
||||
<param index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
|
||||
<description>
|
||||
Creates new buffer for complex text layout, with the given [param direction] and [param orientation]. To free the resulting buffer, use [method free_rid] method.
|
||||
Creates a new buffer for complex text layout, with the given [param direction] and [param orientation]. To free the resulting buffer, use [method free_rid] method.
|
||||
[b]Note:[/b] Direction is ignored if server does not support [constant FEATURE_BIDI_LAYOUT] feature (supported by [TextServerAdvanced]).
|
||||
[b]Note:[/b] Orientation is ignored if server does not support [constant FEATURE_VERTICAL_LAYOUT] feature (supported by [TextServerAdvanced]).
|
||||
</description>
|
||||
@ -48,7 +48,7 @@
|
||||
<param index="0" name="font_rid" type="RID" />
|
||||
<param index="1" name="size" type="Vector2i" />
|
||||
<description>
|
||||
Removes all rendered glyphs information from the cache entry.
|
||||
Removes all 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>
|
||||
@ -956,7 +956,7 @@
|
||||
<param index="0" name="font_rid" type="RID" />
|
||||
<param index="1" name="transform" type="Transform2D" />
|
||||
<description>
|
||||
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs.
|
||||
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping, and rotating glyphs.
|
||||
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>
|
||||
@ -1115,7 +1115,7 @@
|
||||
<return type="int" />
|
||||
<param index="0" name="name" type="String" />
|
||||
<description>
|
||||
Converts readable feature, variation, script or language name to OpenType tag.
|
||||
Converts readable feature, variation, script, or language name to OpenType tag.
|
||||
</description>
|
||||
</method>
|
||||
<method name="parse_number" qualifiers="const">
|
||||
@ -1173,7 +1173,7 @@
|
||||
<param index="3" name="size" type="int" />
|
||||
<param index="4" name="opentype_features" type="Dictionary" default="{}" />
|
||||
<description>
|
||||
Changes text span font, font size and OpenType features, without changing the text.
|
||||
Changes text span font, font size, and OpenType features, without changing the text.
|
||||
</description>
|
||||
</method>
|
||||
<method name="shaped_text_add_object">
|
||||
@ -1758,7 +1758,7 @@
|
||||
<return type="String" />
|
||||
<param index="0" name="tag" type="int" />
|
||||
<description>
|
||||
Converts OpenType tag to readable feature, variation, script or language name.
|
||||
Converts OpenType tag to readable feature, variation, script, or language name.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -73,8 +73,6 @@ using namespace godot;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
#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 {
|
||||
switch (p_feature) {
|
||||
case FEATURE_SIMPLE_LAYOUT:
|
||||
@ -907,8 +905,8 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_f
|
||||
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)];
|
||||
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.0, amaster->axis[i].minimum, amaster->axis[i].maximum);
|
||||
}
|
||||
}
|
||||
@ -3704,9 +3702,9 @@ RID TextServerFallback::_find_sys_font_for_text(const RID &p_fdef, const String
|
||||
int font_weight = _font_get_weight(p_fdef);
|
||||
int font_stretch = _font_get_stretch(p_fdef);
|
||||
Dictionary dvar = _font_get_variation_coordinates(p_fdef);
|
||||
static int64_t wgth_tag = _name_to_tag("weight");
|
||||
static int64_t wdth_tag = _name_to_tag("width");
|
||||
static int64_t ital_tag = _name_to_tag("italic");
|
||||
static int64_t wgth_tag = name_to_tag("weight");
|
||||
static int64_t wdth_tag = name_to_tag("width");
|
||||
static int64_t ital_tag = name_to_tag("italic");
|
||||
if (dvar.has(wgth_tag)) {
|
||||
font_weight = dvar[wgth_tag].operator int();
|
||||
}
|
||||
|
@ -40,9 +40,87 @@ class TextServerDummy : public TextServerExtension {
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
||||
public:
|
||||
virtual String get_name() const override {
|
||||
return "Dummy";
|
||||
}
|
||||
virtual bool has_feature(Feature p_feature) const override { return false; }
|
||||
virtual String get_name() const override { return "Dummy"; }
|
||||
virtual int64_t get_features() const override { return 0; }
|
||||
virtual void free_rid(const RID &p_rid) override {}
|
||||
virtual bool has(const RID &p_rid) override { return false; }
|
||||
|
||||
virtual RID create_font() override { return 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 { return 0; }
|
||||
virtual void font_set_fixed_size_scale_mode(const RID &p_font_rid, TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) override {}
|
||||
virtual TextServer::FixedSizeScaleMode font_get_fixed_size_scale_mode(const RID &p_font_rid) const override { return FIXED_SIZE_SCALE_DISABLE; }
|
||||
virtual TypedArray<Vector2i> font_get_size_cache_list(const RID &p_font_rid) const override { return TypedArray<Vector2i>(); }
|
||||
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(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 { return 0; }
|
||||
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 { return 0; }
|
||||
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 { return 0; }
|
||||
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 { return 0; }
|
||||
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 { return 0; }
|
||||
virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override { return 0; }
|
||||
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(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 { return Ref<Image>(); }
|
||||
virtual PackedInt32Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override { return PackedInt32Array(); }
|
||||
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(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override { return Vector2(); }
|
||||
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(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); }
|
||||
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(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); }
|
||||
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(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Rect2(); }
|
||||
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 int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return 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) override {}
|
||||
virtual RID font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return RID(); }
|
||||
virtual Size2 font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Size2(); }
|
||||
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 override { return 0; }
|
||||
virtual int64_t font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const override { return 0; }
|
||||
virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override { return false; }
|
||||
virtual String font_get_supported_chars(const RID &p_font_rid) const override { return String(); }
|
||||
virtual void 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 override {}
|
||||
virtual void 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 override {}
|
||||
|
||||
virtual RID create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) override { return RID(); }
|
||||
virtual void shaped_text_clear(const RID &p_shaped) override {}
|
||||
virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) override { return false; }
|
||||
virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) override { return false; }
|
||||
virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) override { return false; }
|
||||
virtual int64_t shaped_get_span_count(const RID &p_shaped) const override { return 0; }
|
||||
virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override { return Variant(); }
|
||||
virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) override {}
|
||||
virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override { return RID(); }
|
||||
virtual RID shaped_text_get_parent(const RID &p_shaped) const override { return RID(); }
|
||||
virtual bool shaped_text_shape(const RID &p_shaped) override { return false; }
|
||||
virtual bool shaped_text_is_ready(const RID &p_shaped) const override { return false; }
|
||||
virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override { return nullptr; }
|
||||
virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override { return nullptr; }
|
||||
virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override { return 0; }
|
||||
virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override { return Vector2i(); }
|
||||
virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override { return -1; }
|
||||
virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override { return -1; }
|
||||
virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override { return nullptr; }
|
||||
virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override { return -1; }
|
||||
virtual Array shaped_text_get_objects(const RID &p_shaped) const override { return Array(); }
|
||||
virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override { return Rect2(); }
|
||||
virtual Vector2i shaped_text_get_object_range(const RID &p_shaped, const Variant &p_key) const override { return Vector2i(); }
|
||||
virtual int64_t shaped_text_get_object_glyph(const RID &p_shaped, const Variant &p_key) const override { return -1; }
|
||||
virtual Size2 shaped_text_get_size(const RID &p_shaped) const override { return Size2(); }
|
||||
virtual double shaped_text_get_ascent(const RID &p_shaped) const override { return 0; }
|
||||
virtual double shaped_text_get_descent(const RID &p_shaped) const override { return 0; }
|
||||
virtual double shaped_text_get_width(const RID &p_shaped) const override { return 0; }
|
||||
virtual double shaped_text_get_underline_position(const RID &p_shaped) const override { return 0; }
|
||||
virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override { return 0; }
|
||||
};
|
||||
|
||||
#endif // TEXT_SERVER_DUMMY_H
|
||||
|
@ -326,8 +326,8 @@ void TextServerExtension::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_shaped_text_prev_character_pos, "shaped", "pos");
|
||||
GDVIRTUAL_BIND(_shaped_text_closest_character_pos, "shaped", "pos");
|
||||
|
||||
GDVIRTUAL_BIND(_format_number, "string", "language");
|
||||
GDVIRTUAL_BIND(_parse_number, "string", "language");
|
||||
GDVIRTUAL_BIND(_format_number, "number", "language");
|
||||
GDVIRTUAL_BIND(_parse_number, "number", "language");
|
||||
GDVIRTUAL_BIND(_percent_sign, "language");
|
||||
|
||||
GDVIRTUAL_BIND(_strip_diacritics, "string");
|
||||
@ -349,29 +349,29 @@ void TextServerExtension::_bind_methods() {
|
||||
|
||||
bool TextServerExtension::has_feature(Feature p_feature) const {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_has_feature, p_feature, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_has_feature, p_feature, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String TextServerExtension::get_name() const {
|
||||
String ret = "Unknown";
|
||||
GDVIRTUAL_CALL(_get_name, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_get_name, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::get_features() const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_get_features, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_get_features, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::free_rid(const RID &p_rid) {
|
||||
GDVIRTUAL_CALL(_free_rid, p_rid);
|
||||
GDVIRTUAL_REQUIRED_CALL(_free_rid, p_rid);
|
||||
}
|
||||
|
||||
bool TextServerExtension::has(const RID &p_rid) {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_has, p_rid, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_has, p_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -407,14 +407,18 @@ bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const
|
||||
|
||||
int64_t TextServerExtension::name_to_tag(const String &p_name) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_name_to_tag, p_name, ret);
|
||||
return ret;
|
||||
if (GDVIRTUAL_CALL(_name_to_tag, p_name, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::name_to_tag(p_name);
|
||||
}
|
||||
|
||||
String TextServerExtension::tag_to_name(int64_t p_tag) const {
|
||||
String ret;
|
||||
GDVIRTUAL_CALL(_tag_to_name, p_tag, ret);
|
||||
return ret;
|
||||
if (GDVIRTUAL_CALL(_tag_to_name, p_tag, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::tag_to_name(p_tag);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@ -423,7 +427,7 @@ String TextServerExtension::tag_to_name(int64_t p_tag) const {
|
||||
|
||||
RID TextServerExtension::create_font() {
|
||||
RID ret;
|
||||
GDVIRTUAL_CALL(_create_font, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_create_font, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -452,7 +456,7 @@ int64_t TextServerExtension::font_get_face_index(const RID &p_font_rid) const {
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const {
|
||||
int64_t ret = 0;
|
||||
int64_t ret = 1;
|
||||
GDVIRTUAL_CALL(_font_get_face_count, p_font_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -574,22 +578,22 @@ int64_t TextServerExtension::font_get_msdf_size(const RID &p_font_rid) const {
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_fixed_size, p_font_rid, p_fixed_size);
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_fixed_size, p_font_rid, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_fixed_size, p_font_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::font_set_fixed_size_scale_mode(const RID &p_font_rid, TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) {
|
||||
GDVIRTUAL_CALL(_font_set_fixed_size_scale_mode, p_font_rid, p_fixed_size_scale_mode);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_fixed_size_scale_mode, p_font_rid, p_fixed_size_scale_mode);
|
||||
}
|
||||
|
||||
TextServer::FixedSizeScaleMode TextServerExtension::font_get_fixed_size_scale_mode(const RID &p_font_rid) const {
|
||||
FixedSizeScaleMode ret = FIXED_SIZE_SCALE_DISABLE;
|
||||
GDVIRTUAL_CALL(_font_get_fixed_size_scale_mode, p_font_rid, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_fixed_size_scale_mode, p_font_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -695,89 +699,89 @@ double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const {
|
||||
|
||||
TypedArray<Vector2i> TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const {
|
||||
TypedArray<Vector2i> ret;
|
||||
GDVIRTUAL_CALL(_font_get_size_cache_list, p_font_rid, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_size_cache_list, p_font_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) {
|
||||
GDVIRTUAL_CALL(_font_clear_size_cache, p_font_rid);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_clear_size_cache, p_font_rid);
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_remove_size_cache, p_font_rid, p_size);
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_ascent, p_font_rid, p_size, p_ascent);
|
||||
}
|
||||
|
||||
double TextServerExtension::font_get_ascent(const RID &p_font_rid, int64_t p_size) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_ascent, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_ascent, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_descent, p_font_rid, p_size, p_descent);
|
||||
}
|
||||
|
||||
double TextServerExtension::font_get_descent(const RID &p_font_rid, int64_t p_size) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_descent, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_descent, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_underline_position, p_font_rid, p_size, p_underline_position);
|
||||
}
|
||||
|
||||
double TextServerExtension::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_underline_position, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_underline_position, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness);
|
||||
}
|
||||
|
||||
double TextServerExtension::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_scale, p_font_rid, p_size, p_scale);
|
||||
}
|
||||
|
||||
double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_scale, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_scale, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_texture_count, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_texture_count, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) {
|
||||
GDVIRTUAL_CALL(_font_clear_textures, p_font_rid, p_size);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_clear_textures, p_font_rid, p_size);
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_remove_texture, p_font_rid, p_size, p_texture_index);
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image);
|
||||
}
|
||||
|
||||
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;
|
||||
GDVIRTUAL_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -793,77 +797,77 @@ PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font
|
||||
|
||||
PackedInt32Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const {
|
||||
PackedInt32Array ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_list, p_font_rid, p_size, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_list, p_font_rid, p_size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) {
|
||||
GDVIRTUAL_CALL(_font_clear_glyphs, p_font_rid, p_size);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_clear_glyphs, p_font_rid, p_size);
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_remove_glyph, p_font_rid, p_size, p_glyph);
|
||||
}
|
||||
|
||||
Vector2 TextServerExtension::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const {
|
||||
Vector2 ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance);
|
||||
}
|
||||
|
||||
Vector2 TextServerExtension::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
|
||||
Vector2 ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset);
|
||||
}
|
||||
|
||||
Vector2 TextServerExtension::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
|
||||
Vector2 ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size);
|
||||
}
|
||||
|
||||
Rect2 TextServerExtension::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
|
||||
Rect2 ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect);
|
||||
}
|
||||
|
||||
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 = 0;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx);
|
||||
}
|
||||
|
||||
RID TextServerExtension::font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
|
||||
RID ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Size2 TextServerExtension::font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
|
||||
Size2 ret;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -899,25 +903,25 @@ Vector2 TextServerExtension::font_get_kerning(const RID &p_font_rid, int64_t p_s
|
||||
|
||||
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 = 0;
|
||||
GDVIRTUAL_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_font_get_char_from_glyph_index, p_font_rid, p_size, p_glyph_index, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_char_from_glyph_index, p_font_rid, p_size, p_glyph_index, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool TextServerExtension::font_has_char(const RID &p_font_rid, int64_t p_char) const {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_font_has_char, p_font_rid, p_char, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_has_char, p_font_rid, p_char, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String TextServerExtension::font_get_supported_chars(const RID &p_font_rid) const {
|
||||
String ret;
|
||||
GDVIRTUAL_CALL(_font_get_supported_chars, p_font_rid, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_get_supported_chars, p_font_rid, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -930,11 +934,11 @@ void TextServerExtension::font_render_glyph(const RID &p_font_rid, const Vector2
|
||||
}
|
||||
|
||||
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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_font_draw_glyph, p_font_rid, p_canvas, p_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);
|
||||
GDVIRTUAL_REQUIRED_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(const RID &p_font_rid, const String &p_language) const {
|
||||
@ -1041,12 +1045,12 @@ void TextServerExtension::draw_hex_code_box(const RID &p_canvas, int64_t p_size,
|
||||
|
||||
RID TextServerExtension::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) {
|
||||
RID ret;
|
||||
GDVIRTUAL_CALL(_create_shaped_text, p_direction, p_orientation, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_create_shaped_text, p_direction, p_orientation, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::shaped_text_clear(const RID &p_shaped) {
|
||||
GDVIRTUAL_CALL(_shaped_text_clear, p_shaped);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_clear, p_shaped);
|
||||
}
|
||||
|
||||
void TextServerExtension::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) {
|
||||
@ -1131,47 +1135,47 @@ int64_t TextServerExtension::shaped_text_get_spacing(const RID &p_shaped, TextSe
|
||||
|
||||
bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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, double p_baseline) {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, p_baseline, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, p_baseline, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, p_baseline, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, p_baseline, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_get_span_count(const RID &p_shaped) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_get_span_count, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Variant TextServerExtension::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const {
|
||||
Variant ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_get_span_meta, p_shaped, p_index, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &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);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_set_span_update_font, p_shaped, p_index, p_fonts, p_size, p_opentype_features);
|
||||
}
|
||||
|
||||
RID TextServerExtension::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const {
|
||||
RID ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const {
|
||||
RID ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_parent, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_parent, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1189,7 +1193,7 @@ double TextServerExtension::shaped_text_tab_align(const RID &p_shaped, const Pac
|
||||
|
||||
bool TextServerExtension::shaped_text_shape(const RID &p_shaped) {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_text_shape, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_shape, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1207,31 +1211,31 @@ bool TextServerExtension::shaped_text_update_justification_ops(const RID &p_shap
|
||||
|
||||
bool TextServerExtension::shaped_text_is_ready(const RID &p_shaped) const {
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_shaped_text_is_ready, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_is_ready, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Glyph *TextServerExtension::shaped_text_get_glyphs(const RID &p_shaped) const {
|
||||
GDExtensionConstPtr<const Glyph> ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_glyphs, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Glyph *TextServerExtension::shaped_text_sort_logical(const RID &p_shaped) {
|
||||
GDExtensionConstPtr<const Glyph> ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_sort_logical, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_get_glyph_count(const RID &p_shaped) const {
|
||||
int64_t ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_glyph_count, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_glyph_count, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const {
|
||||
Vector2i ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_range, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_range, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1261,25 +1265,25 @@ PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_s
|
||||
|
||||
int64_t TextServerExtension::shaped_text_get_trim_pos(const RID &p_shaped) const {
|
||||
int64_t ret = -1;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_trim_pos, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_trim_pos, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_get_ellipsis_pos(const RID &p_shaped) const {
|
||||
int64_t ret = -1;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const {
|
||||
GDExtensionConstPtr<const Glyph> ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const {
|
||||
int64_t ret = -1;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1289,61 +1293,61 @@ void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
|
||||
Array TextServerExtension::shaped_text_get_objects(const RID &p_shaped) const {
|
||||
Array ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_objects, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_objects, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Rect2 TextServerExtension::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const {
|
||||
Rect2 ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Vector2i TextServerExtension::shaped_text_get_object_range(const RID &p_shaped, const Variant &p_key) const {
|
||||
Vector2i ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_object_range, p_shaped, p_key, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_range, p_shaped, p_key, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_get_object_glyph(const RID &p_shaped, const Variant &p_key) const {
|
||||
int64_t ret = -1;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_object_glyph, p_shaped, p_key, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_glyph, p_shaped, p_key, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Size2 TextServerExtension::shaped_text_get_size(const RID &p_shaped) const {
|
||||
Size2 ret;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_size, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_size, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double TextServerExtension::shaped_text_get_ascent(const RID &p_shaped) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_ascent, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ascent, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double TextServerExtension::shaped_text_get_descent(const RID &p_shaped) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_descent, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_descent, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double TextServerExtension::shaped_text_get_width(const RID &p_shaped) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_width, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_width, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double TextServerExtension::shaped_text_get_underline_position(const RID &p_shaped) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_underline_position, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_underline_position, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double TextServerExtension::shaped_text_get_underline_thickness(const RID &p_shaped) const {
|
||||
double ret = 0;
|
||||
GDVIRTUAL_CALL(_shaped_text_get_underline_thickness, p_shaped, ret);
|
||||
GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_underline_thickness, p_shaped, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1513,8 +1517,10 @@ String TextServerExtension::string_to_lower(const String &p_string, const String
|
||||
|
||||
TypedArray<Vector3i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
|
||||
TypedArray<Vector3i> ret;
|
||||
GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret);
|
||||
return ret;
|
||||
if (GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::parse_structured_text(p_parser_type, p_args, p_text);
|
||||
}
|
||||
|
||||
PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language, int64_t p_chars_per_line) const {
|
||||
|
@ -642,6 +642,48 @@ void TextServer::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(FIXED_SIZE_SCALE_ENABLED);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int32_t ot_tag_from_string(const char *p_str, int p_len) {
|
||||
char tag[4];
|
||||
uint32_t i;
|
||||
|
||||
if (!p_str || !p_len || !*p_str) {
|
||||
return OT_TAG(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (p_len < 0 || p_len > 4) {
|
||||
p_len = 4;
|
||||
}
|
||||
for (i = 0; i < (uint32_t)p_len && p_str[i]; i++) {
|
||||
tag[i] = p_str[i];
|
||||
}
|
||||
|
||||
for (; i < 4; i++) {
|
||||
tag[i] = ' ';
|
||||
}
|
||||
|
||||
return OT_TAG(tag[0], tag[1], tag[2], tag[3]);
|
||||
}
|
||||
|
||||
int64_t TextServer::name_to_tag(const String &p_name) const {
|
||||
// No readable name, use tag string.
|
||||
return ot_tag_from_string(p_name.replace("custom_", "").ascii().get_data(), -1);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void ot_tag_to_string(int32_t p_tag, char *p_buf) {
|
||||
p_buf[0] = (char)(uint8_t)(p_tag >> 24);
|
||||
p_buf[1] = (char)(uint8_t)(p_tag >> 16);
|
||||
p_buf[2] = (char)(uint8_t)(p_tag >> 8);
|
||||
p_buf[3] = (char)(uint8_t)(p_tag >> 0);
|
||||
}
|
||||
|
||||
String TextServer::tag_to_name(int64_t p_tag) const {
|
||||
// No readable name, use tag string.
|
||||
char name[5];
|
||||
memset(name, 0, 5);
|
||||
ot_tag_to_string(p_tag, name);
|
||||
return String("custom_") + String(name);
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -43,6 +43,8 @@ class TypedArray;
|
||||
struct Glyph;
|
||||
struct CaretInfo;
|
||||
|
||||
#define OT_TAG(m_c1, m_c2, m_c3, m_c4) ((int32_t)((((uint32_t)(m_c1) & 0xff) << 24) | (((uint32_t)(m_c2) & 0xff) << 16) | (((uint32_t)(m_c3) & 0xff) << 8) | ((uint32_t)(m_c4) & 0xff)))
|
||||
|
||||
class TextServer : public RefCounted {
|
||||
GDCLASS(TextServer, RefCounted);
|
||||
|
||||
@ -239,8 +241,8 @@ public:
|
||||
|
||||
virtual bool is_locale_right_to_left(const String &p_locale) const = 0;
|
||||
|
||||
virtual int64_t name_to_tag(const String &p_name) const { return 0; };
|
||||
virtual String tag_to_name(int64_t p_tag) const { return ""; };
|
||||
virtual int64_t name_to_tag(const String &p_name) const;
|
||||
virtual String tag_to_name(int64_t p_tag) const;
|
||||
|
||||
/* Font interface */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user