Merge pull request #78266 from Faolan-Rad/master
Move registration of `fallbacks` property in the base Font class
This commit is contained in:
commit
5fc0d71ecd
|
@ -149,12 +149,6 @@
|
||||||
Returns number of faces in the TrueType / OpenType collection.
|
Returns number of faces in the TrueType / OpenType collection.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_fallbacks" qualifiers="const">
|
|
||||||
<return type="Font[]" />
|
|
||||||
<description>
|
|
||||||
Returns array of fallback [Font]s.
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
<method name="get_font_name" qualifiers="const">
|
<method name="get_font_name" qualifiers="const">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
@ -335,12 +329,11 @@
|
||||||
Sets LRU cache capacity for [code]draw_*[/code] methods.
|
Sets LRU cache capacity for [code]draw_*[/code] methods.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_fallbacks">
|
|
||||||
<return type="void" />
|
|
||||||
<param index="0" name="fallbacks" type="Font[]" />
|
|
||||||
<description>
|
|
||||||
Sets array of fallback [Font]s.
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
</methods>
|
</methods>
|
||||||
|
<members>
|
||||||
|
<member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]">
|
||||||
|
Array of fallback [Font]s to use as a substitute if a glyph is not found in this current [Font].
|
||||||
|
If this array is empty in a [FontVariation], the [member FontVariation.base_font]'s fallbacks are used instead.
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
</class>
|
</class>
|
||||||
|
|
|
@ -568,9 +568,6 @@
|
||||||
<member name="data" type="PackedByteArray" setter="set_data" getter="get_data" default="PackedByteArray()">
|
<member name="data" type="PackedByteArray" setter="set_data" getter="get_data" default="PackedByteArray()">
|
||||||
Contents of the dynamic font source file.
|
Contents of the dynamic font source file.
|
||||||
</member>
|
</member>
|
||||||
<member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]">
|
|
||||||
Array of fallback [Font]s.
|
|
||||||
</member>
|
|
||||||
<member name="fixed_size" type="int" setter="set_fixed_size" getter="get_fixed_size" default="0">
|
<member name="fixed_size" type="int" setter="set_fixed_size" getter="get_fixed_size" default="0">
|
||||||
Font size, used only for the bitmap fonts.
|
Font size, used only for the bitmap fonts.
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -46,9 +46,6 @@
|
||||||
<member name="base_font" type="Font" setter="set_base_font" getter="get_base_font">
|
<member name="base_font" type="Font" setter="set_base_font" getter="get_base_font">
|
||||||
Base font used to create a variation. If not set, default [Theme] font is used.
|
Base font used to create a variation. If not set, default [Theme] font is used.
|
||||||
</member>
|
</member>
|
||||||
<member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]">
|
|
||||||
Array of fallback [Font]s to use as a substitute if a glyph is not found in this [FontVariation]. If not set, [member base_font]'s fallbacks are used instead.
|
|
||||||
</member>
|
|
||||||
<member name="opentype_features" type="Dictionary" setter="set_opentype_features" getter="get_opentype_features" default="{}">
|
<member name="opentype_features" type="Dictionary" setter="set_opentype_features" getter="get_opentype_features" default="{}">
|
||||||
A set of OpenType feature tags. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
|
A set of OpenType feature tags. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
<member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1">
|
<member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1">
|
||||||
Font anti-aliasing mode.
|
Font anti-aliasing mode.
|
||||||
</member>
|
</member>
|
||||||
<member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]">
|
|
||||||
Array of fallback [Font]s.
|
|
||||||
</member>
|
|
||||||
<member name="font_italic" type="bool" setter="set_font_italic" getter="get_font_italic" default="false">
|
<member name="font_italic" type="bool" setter="set_font_italic" getter="get_font_italic" default="false">
|
||||||
If set to [code]true[/code], italic or oblique font is preferred.
|
If set to [code]true[/code], italic or oblique font is preferred.
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -97,6 +97,8 @@ void Font::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_supported_feature_list"), &Font::get_supported_feature_list);
|
ClassDB::bind_method(D_METHOD("get_supported_feature_list"), &Font::get_supported_feature_list);
|
||||||
ClassDB::bind_method(D_METHOD("get_supported_variation_list"), &Font::get_supported_variation_list);
|
ClassDB::bind_method(D_METHOD("get_supported_variation_list"), &Font::get_supported_variation_list);
|
||||||
ClassDB::bind_method(D_METHOD("get_face_count"), &Font::get_face_count);
|
ClassDB::bind_method(D_METHOD("get_face_count"), &Font::get_face_count);
|
||||||
|
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")), "set_fallbacks", "get_fallbacks");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::_update_rids_fb(const Ref<Font> &p_f, int p_depth) const {
|
void Font::_update_rids_fb(const Ref<Font> &p_f, int p_depth) const {
|
||||||
|
@ -1006,7 +1008,12 @@ void FontFile::_bind_methods() {
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_oversampling", "get_oversampling");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_oversampling", "get_oversampling");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_fixed_size", "get_fixed_size");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_fixed_size", "get_fixed_size");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "opentype_feature_overrides", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_opentype_feature_overrides", "get_opentype_feature_overrides");
|
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "opentype_feature_overrides", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_opentype_feature_overrides", "get_opentype_feature_overrides");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font"), PROPERTY_USAGE_STORAGE), "set_fallbacks", "get_fallbacks");
|
}
|
||||||
|
|
||||||
|
void FontFile::_validate_property(PropertyInfo &p_property) const {
|
||||||
|
if (p_property.name == "fallbacks") {
|
||||||
|
p_property.usage &= ~PROPERTY_USAGE_EDITOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
|
bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
|
||||||
|
@ -2634,7 +2641,6 @@ void FontVariation::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_spacing", "spacing", "value"), &FontVariation::set_spacing);
|
ClassDB::bind_method(D_METHOD("set_spacing", "spacing", "value"), &FontVariation::set_spacing);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "base_font", PROPERTY_HINT_RESOURCE_TYPE, "Font"), "set_base_font", "get_base_font");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "base_font", PROPERTY_HINT_RESOURCE_TYPE, "Font"), "set_base_font", "get_base_font");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")), "set_fallbacks", "get_fallbacks");
|
|
||||||
|
|
||||||
ADD_GROUP("Variation", "variation_");
|
ADD_GROUP("Variation", "variation_");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "variation_opentype"), "set_variation_opentype", "get_variation_opentype");
|
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "variation_opentype"), "set_variation_opentype", "get_variation_opentype");
|
||||||
|
@ -2924,7 +2930,6 @@ void SystemFont::_bind_methods() {
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_pixel_range"), "set_msdf_pixel_range", "get_msdf_pixel_range");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_pixel_range"), "set_msdf_pixel_range", "get_msdf_pixel_range");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size"), "set_msdf_size", "get_msdf_size");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size"), "set_msdf_size", "get_msdf_size");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), "set_oversampling", "get_oversampling");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), "set_oversampling", "get_oversampling");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")), "set_fallbacks", "get_fallbacks");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemFont::_update_rids() const {
|
void SystemFont::_update_rids() const {
|
||||||
|
|
|
@ -210,6 +210,7 @@ class FontFile : public Font {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
void _validate_property(PropertyInfo &p_property) const;
|
||||||
|
|
||||||
bool _set(const StringName &p_name, const Variant &p_value);
|
bool _set(const StringName &p_name, const Variant &p_value);
|
||||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||||
|
|
Loading…
Reference in New Issue