diff options
Diffstat (limited to 'scene/resources/dynamic_font.cpp')
-rw-r--r-- | scene/resources/dynamic_font.cpp | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 451029e93b..d2a90f388e 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -222,11 +222,6 @@ Error DynamicFontAtSize::_load() { ascent = (face->size->metrics.ascender / 64.0) / oversampling * scale_color_font; descent = (-face->size->metrics.descender / 64.0) / oversampling * scale_color_font; linegap = 0; - texture_flags = 0; - if (id.mipmaps) - texture_flags |= Texture::FLAG_MIPMAPS; - if (id.filter) - texture_flags |= Texture::FLAG_FILTER; valid = true; return OK; @@ -299,16 +294,6 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const V return ret; } -void DynamicFontAtSize::set_texture_flags(uint32_t p_flags) { - - texture_flags = p_flags; - for (int i = 0; i < textures.size(); i++) { - Ref<ImageTexture> &tex = textures.write[i].texture; - if (!tex.is_null()) - tex->set_flags(p_flags); - } -} - float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks, bool p_advance_only, bool p_outline) const { if (!valid) @@ -351,7 +336,7 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharT modulate.r = modulate.g = modulate.b = 1.0; } RID texture = font->textures[ch->texture_idx].texture->get_rid(); - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, RID(), false); + VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, RID(), RID(), Color(1, 1, 1, 1), false); } advance = ch->advance; @@ -536,9 +521,9 @@ DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap b if (tex.texture.is_null()) { tex.texture.instance(); - tex.texture->create_from_image(img, Texture::FLAG_VIDEO_SURFACE | texture_flags); + tex.texture->create_from_image(img); } else { - tex.texture->set_data(img); //update + tex.texture->update(img); //update } } @@ -659,7 +644,6 @@ DynamicFontAtSize::DynamicFontAtSize() { ascent = 1; descent = 1; linegap = 1; - texture_flags = 0; oversampling = font_oversampling; scale_color_font = 1; } @@ -758,34 +742,6 @@ Color DynamicFont::get_outline_color() const { return outline_color; } -bool DynamicFont::get_use_mipmaps() const { - - return cache_id.mipmaps; -} - -void DynamicFont::set_use_mipmaps(bool p_enable) { - - if (cache_id.mipmaps == p_enable) - return; - cache_id.mipmaps = p_enable; - outline_cache_id.mipmaps = p_enable; - _reload_cache(); -} - -bool DynamicFont::get_use_filter() const { - - return cache_id.filter; -} - -void DynamicFont::set_use_filter(bool p_enable) { - - if (cache_id.filter == p_enable) - return; - cache_id.filter = p_enable; - outline_cache_id.filter = p_enable; - _reload_cache(); -} - bool DynamicFontData::is_antialiased() const { return antialiased; @@ -1007,10 +963,6 @@ void DynamicFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_outline_color", "color"), &DynamicFont::set_outline_color); ClassDB::bind_method(D_METHOD("get_outline_color"), &DynamicFont::get_outline_color); - ClassDB::bind_method(D_METHOD("set_use_mipmaps", "enable"), &DynamicFont::set_use_mipmaps); - ClassDB::bind_method(D_METHOD("get_use_mipmaps"), &DynamicFont::get_use_mipmaps); - ClassDB::bind_method(D_METHOD("set_use_filter", "enable"), &DynamicFont::set_use_filter); - ClassDB::bind_method(D_METHOD("get_use_filter"), &DynamicFont::get_use_filter); ClassDB::bind_method(D_METHOD("set_spacing", "type", "value"), &DynamicFont::set_spacing); ClassDB::bind_method(D_METHOD("get_spacing", "type"), &DynamicFont::get_spacing); @@ -1024,8 +976,6 @@ void DynamicFont::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "size", PROPERTY_HINT_RANGE, "1,1024,1"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size", PROPERTY_HINT_RANGE, "0,1024,1"), "set_outline_size", "get_outline_size"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "outline_color"), "set_outline_color", "get_outline_color"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_mipmaps"), "set_use_mipmaps", "get_use_mipmaps"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_filter"), "set_use_filter", "get_use_filter"); ADD_GROUP("Extra Spacing", "extra_spacing"); ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_top"), "set_spacing", "get_spacing", SPACING_TOP); ADD_PROPERTYI(PropertyInfo(Variant::INT, "extra_spacing_bottom"), "set_spacing", "get_spacing", SPACING_BOTTOM); |