Moved DynamicFont to the freetype module.

This commit is contained in:
Relintai 2023-12-16 14:17:36 +01:00
parent 422144f7f3
commit 3aeb11b230
5 changed files with 31 additions and 37 deletions

View File

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "modules/modules_enabled.gen.h" // For freetype.
#ifdef MODULE_FREETYPE_ENABLED
#include "dynamic_font.h"
@ -1462,5 +1460,3 @@ String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path)
}
return "";
}
#endif

View File

@ -30,9 +30,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "modules/modules_enabled.gen.h" // For freetype.
#ifdef MODULE_FREETYPE_ENABLED
#include "core/io/resource_loader.h"
#include "core/os/mutex.h"
#include "core/os/thread_safe.h"
@ -397,6 +394,4 @@ public:
virtual String get_resource_type(const String &p_path) const;
};
#endif // MODULE_FREETYPE_ENABLED
#endif // DYNAMIC_FONT_H

View File

@ -30,6 +30,29 @@
#include "register_types.h"
void register_freetype_types(ModuleRegistrationLevel p_level) {}
#include "dynamic_font.h"
void unregister_freetype_types(ModuleRegistrationLevel p_level) {}
static Ref<ResourceFormatLoaderDynamicFont> resource_loader_dynamic_font;
void register_freetype_types(ModuleRegistrationLevel p_level) {
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
resource_loader_dynamic_font.instance();
ResourceLoader::add_resource_format_loader(resource_loader_dynamic_font);
}
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
ClassDB::register_class<DynamicFontData>();
ClassDB::register_class<DynamicFont>();
DynamicFont::initialize_dynamic_fonts();
}
}
void unregister_freetype_types(ModuleRegistrationLevel p_level) {
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
ResourceLoader::remove_resource_format_loader(resource_loader_dynamic_font);
resource_loader_dynamic_font.unref();
DynamicFont::finish_dynamic_fonts();
}
}

View File

@ -41,13 +41,11 @@
#include "core/string/print_string.h"
#include "core/variant/variant_parser.h"
#include "main/input_default.h"
#include "modules/modules_enabled.gen.h" // For freetype.
#include "node.h"
#include "scene/animation/scene_tree_tween.h"
#include "scene/debugger/script_debugger_remote.h"
#include "scene/main/control.h"
#include "scene/main/scene_string_names.h"
#include "scene/resources/font/dynamic_font.h"
#include "scene/resources/material/material.h"
#include "scene/resources/material/shader_material.h"
#include "scene/resources/mesh/mesh.h"
@ -57,6 +55,12 @@
#include "servers/physics_2d_server.h"
#include "viewport.h"
#include "modules/modules_enabled.gen.h" // For freetype.
#ifdef MODULE_FREETYPE_ENABLED
#include "modules/freetype/dynamic_font.h"
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@ -129,7 +129,6 @@
#include "scene/resources/shapes_2d/concave_polygon_shape_2d.h"
#include "scene/resources/shapes_2d/convex_polygon_shape_2d.h"
#include "scene/resources/default_theme/default_theme.h"
#include "scene/resources/font/dynamic_font.h"
#include "scene/resources/gradient.h"
#include "scene/resources/mesh/immediate_mesh.h"
#include "scene/resources/shapes_2d/line_shape_2d.h"
@ -158,10 +157,6 @@
static Ref<ResourceFormatSaverText> resource_saver_text;
static Ref<ResourceFormatLoaderText> resource_loader_text;
#ifdef MODULE_FREETYPE_ENABLED
static Ref<ResourceFormatLoaderDynamicFont> resource_loader_dynamic_font;
#endif // MODULE_FREETYPE_ENABLED
static Ref<ResourceFormatLoaderStreamTexture> resource_loader_stream_texture;
static Ref<ResourceFormatLoaderTextureLayered> resource_loader_texture_layered;
@ -177,11 +172,6 @@ void register_scene_types() {
Node::init_node_hrcr();
#ifdef MODULE_FREETYPE_ENABLED
resource_loader_dynamic_font.instance();
ResourceLoader::add_resource_format_loader(resource_loader_dynamic_font);
#endif // MODULE_FREETYPE_ENABLED
resource_loader_stream_texture.instance();
ResourceLoader::add_resource_format_loader(resource_loader_stream_texture);
@ -441,13 +431,6 @@ void register_scene_types() {
ClassDB::register_class<TextFile>();
#ifdef MODULE_FREETYPE_ENABLED
ClassDB::register_class<DynamicFontData>();
ClassDB::register_class<DynamicFont>();
DynamicFont::initialize_dynamic_fonts();
#endif // MODULE_FREETYPE_ENABLED
ClassDB::register_virtual_class<StyleBox>();
ClassDB::register_class<StyleBoxEmpty>();
ClassDB::register_class<StyleBoxTexture>();
@ -535,13 +518,6 @@ void initialize_theme() {
void unregister_scene_types() {
clear_default_theme();
#ifdef MODULE_FREETYPE_ENABLED
ResourceLoader::remove_resource_format_loader(resource_loader_dynamic_font);
resource_loader_dynamic_font.unref();
DynamicFont::finish_dynamic_fonts();
#endif // MODULE_FREETYPE_ENABLED
ResourceLoader::remove_resource_format_loader(resource_loader_texture_layered);
resource_loader_texture_layered.unref();