feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -298,7 +298,7 @@ void Font::set_cache_capacity(int p_single_line, int p_multi_line) {
|
|||
|
||||
Size2 Font::get_string_size(const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {
|
||||
bool fill = (p_alignment == HORIZONTAL_ALIGNMENT_FILL);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : TextServer::JUSTIFICATION_NONE, TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : BitField(TextServer::JUSTIFICATION_NONE), TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
|
||||
Ref<TextLine> buffer;
|
||||
if (cache.has(key)) {
|
||||
|
|
@ -347,7 +347,7 @@ Size2 Font::get_multiline_string_size(const String &p_text, HorizontalAlignment
|
|||
|
||||
void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, const Color &p_modulate, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {
|
||||
bool fill = (p_alignment == HORIZONTAL_ALIGNMENT_FILL);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : TextServer::JUSTIFICATION_NONE, TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : BitField(TextServer::JUSTIFICATION_NONE), TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
|
||||
Ref<TextLine> buffer;
|
||||
if (cache.has(key)) {
|
||||
|
|
@ -410,7 +410,7 @@ void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const S
|
|||
|
||||
void Font::draw_string_outline(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_size, const Color &p_modulate, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {
|
||||
bool fill = (p_alignment == HORIZONTAL_ALIGNMENT_FILL);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : TextServer::JUSTIFICATION_NONE, TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : BitField(TextServer::JUSTIFICATION_NONE), TextServer::BREAK_NONE, p_direction, p_orientation);
|
||||
|
||||
Ref<TextLine> buffer;
|
||||
if (cache.has(key)) {
|
||||
|
|
@ -602,6 +602,7 @@ _FORCE_INLINE_ void FontFile::_ensure_rid(int p_cache_index, int p_make_linked_f
|
|||
TS->font_set_fixed_size(cache[p_cache_index], fixed_size);
|
||||
TS->font_set_fixed_size_scale_mode(cache[p_cache_index], fixed_size_scale_mode);
|
||||
TS->font_set_force_autohinter(cache[p_cache_index], force_autohinter);
|
||||
TS->font_set_modulate_color_glyphs(cache[p_cache_index], modulate_color_glyphs);
|
||||
TS->font_set_allow_system_fallback(cache[p_cache_index], allow_system_fallback);
|
||||
TS->font_set_hinting(cache[p_cache_index], hinting);
|
||||
TS->font_set_subpixel_positioning(cache[p_cache_index], subpixel_positioning);
|
||||
|
|
@ -929,6 +930,9 @@ void FontFile::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_force_autohinter", "force_autohinter"), &FontFile::set_force_autohinter);
|
||||
ClassDB::bind_method(D_METHOD("is_force_autohinter"), &FontFile::is_force_autohinter);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_modulate_color_glyphs", "modulate"), &FontFile::set_modulate_color_glyphs);
|
||||
ClassDB::bind_method(D_METHOD("is_modulate_color_glyphs"), &FontFile::is_modulate_color_glyphs);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_hinting", "hinting"), &FontFile::set_hinting);
|
||||
ClassDB::bind_method(D_METHOD("get_hinting"), &FontFile::get_hinting);
|
||||
|
||||
|
|
@ -1054,6 +1058,7 @@ void FontFile::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_msdf_size", "get_msdf_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_system_fallback", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_allow_system_fallback", "is_allow_system_fallback");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_force_autohinter", "is_force_autohinter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "modulate_color_glyphs", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_modulate_color_glyphs", "is_modulate_color_glyphs");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_STORAGE), "set_hinting", "get_hinting");
|
||||
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");
|
||||
|
|
@ -1413,6 +1418,7 @@ void FontFile::reset_state() {
|
|||
disable_embedded_bitmaps = true;
|
||||
msdf = false;
|
||||
force_autohinter = false;
|
||||
modulate_color_glyphs = false;
|
||||
allow_system_fallback = true;
|
||||
hinting = TextServer::HINTING_LIGHT;
|
||||
subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_DISABLED;
|
||||
|
|
@ -1453,6 +1459,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
|||
disable_embedded_bitmaps = true;
|
||||
msdf = false;
|
||||
force_autohinter = false;
|
||||
modulate_color_glyphs = false;
|
||||
allow_system_fallback = true;
|
||||
hinting = TextServer::HINTING_NONE;
|
||||
oversampling = 1.0f;
|
||||
|
|
@ -1488,7 +1495,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
|||
switch (block_type) {
|
||||
case 1: /* info */ {
|
||||
ERR_FAIL_COND_V_MSG(block_size < 15, ERR_CANT_CREATE, "Invalid BMFont info block size.");
|
||||
base_size = ABS(static_cast<int16_t>(f->get_16()));
|
||||
base_size = Math::abs(static_cast<int16_t>(f->get_16()));
|
||||
if (base_size == 0) {
|
||||
base_size = 16;
|
||||
}
|
||||
|
|
@ -1782,7 +1789,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
|||
|
||||
if (type == "info") {
|
||||
if (keys.has("size")) {
|
||||
base_size = ABS(keys["size"].to_int());
|
||||
base_size = Math::abs(keys["size"].to_int());
|
||||
if (base_size == 0) {
|
||||
base_size = 16;
|
||||
}
|
||||
|
|
@ -2271,6 +2278,21 @@ bool FontFile::is_force_autohinter() const {
|
|||
return force_autohinter;
|
||||
}
|
||||
|
||||
void FontFile::set_modulate_color_glyphs(bool p_modulate) {
|
||||
if (modulate_color_glyphs != p_modulate) {
|
||||
modulate_color_glyphs = p_modulate;
|
||||
for (int i = 0; i < cache.size(); i++) {
|
||||
_ensure_rid(i);
|
||||
TS->font_set_modulate_color_glyphs(cache[i], modulate_color_glyphs);
|
||||
}
|
||||
emit_changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool FontFile::is_modulate_color_glyphs() const {
|
||||
return modulate_color_glyphs;
|
||||
}
|
||||
|
||||
void FontFile::set_hinting(TextServer::Hinting p_hinting) {
|
||||
if (hinting != p_hinting) {
|
||||
hinting = p_hinting;
|
||||
|
|
@ -3100,6 +3122,9 @@ void SystemFont::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_force_autohinter", "force_autohinter"), &SystemFont::set_force_autohinter);
|
||||
ClassDB::bind_method(D_METHOD("is_force_autohinter"), &SystemFont::is_force_autohinter);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_modulate_color_glyphs", "modulate"), &SystemFont::set_modulate_color_glyphs);
|
||||
ClassDB::bind_method(D_METHOD("is_modulate_color_glyphs"), &SystemFont::is_modulate_color_glyphs);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_hinting", "hinting"), &SystemFont::set_hinting);
|
||||
ClassDB::bind_method(D_METHOD("get_hinting"), &SystemFont::get_hinting);
|
||||
|
||||
|
|
@ -3138,6 +3163,7 @@ void SystemFont::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_embedded_bitmaps"), "set_disable_embedded_bitmaps", "get_disable_embedded_bitmaps");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_system_fallback"), "set_allow_system_fallback", "is_allow_system_fallback");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter"), "set_force_autohinter", "is_force_autohinter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "modulate_color_glyphs"), "set_modulate_color_glyphs", "is_modulate_color_glyphs");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), "set_subpixel_positioning", "get_subpixel_positioning");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_rounding_remainders"), "set_keep_rounding_remainders", "get_keep_rounding_remainders");
|
||||
|
|
@ -3243,6 +3269,7 @@ void SystemFont::_update_base_font() {
|
|||
file->set_generate_mipmaps(mipmaps);
|
||||
file->set_disable_embedded_bitmaps(disable_embedded_bitmaps);
|
||||
file->set_force_autohinter(force_autohinter);
|
||||
file->set_modulate_color_glyphs(modulate_color_glyphs);
|
||||
file->set_allow_system_fallback(allow_system_fallback);
|
||||
file->set_hinting(hinting);
|
||||
file->set_subpixel_positioning(subpixel_positioning);
|
||||
|
|
@ -3287,6 +3314,7 @@ void SystemFont::reset_state() {
|
|||
mipmaps = false;
|
||||
disable_embedded_bitmaps = true;
|
||||
force_autohinter = false;
|
||||
modulate_color_glyphs = false;
|
||||
allow_system_fallback = true;
|
||||
hinting = TextServer::HINTING_LIGHT;
|
||||
subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_DISABLED;
|
||||
|
|
@ -3416,6 +3444,20 @@ bool SystemFont::is_force_autohinter() const {
|
|||
return force_autohinter;
|
||||
}
|
||||
|
||||
void SystemFont::set_modulate_color_glyphs(bool p_modulate) {
|
||||
if (modulate_color_glyphs != p_modulate) {
|
||||
modulate_color_glyphs = p_modulate;
|
||||
if (base_font.is_valid()) {
|
||||
base_font->set_modulate_color_glyphs(modulate_color_glyphs);
|
||||
}
|
||||
emit_changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool SystemFont::is_modulate_color_glyphs() const {
|
||||
return modulate_color_glyphs;
|
||||
}
|
||||
|
||||
void SystemFont::set_hinting(TextServer::Hinting p_hinting) {
|
||||
if (hinting != p_hinting) {
|
||||
hinting = p_hinting;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue