summaryrefslogtreecommitdiff
path: root/modules/text_server_adv
diff options
context:
space:
mode:
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r--modules/text_server_adv/register_types.cpp19
-rw-r--r--modules/text_server_adv/register_types.h12
-rw-r--r--modules/text_server_adv/text_server_adv.cpp6
3 files changed, 23 insertions, 14 deletions
diff --git a/modules/text_server_adv/register_types.cpp b/modules/text_server_adv/register_types.cpp
index ed00bdfbf9..6a26584506 100644
--- a/modules/text_server_adv/register_types.cpp
+++ b/modules/text_server_adv/register_types.cpp
@@ -32,7 +32,11 @@
#include "text_server_adv.h"
-void preregister_text_server_adv_types() {
+void initialize_text_server_adv_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
+ return;
+ }
+
GDREGISTER_CLASS(TextServerAdvanced);
TextServerManager *tsman = TextServerManager::get_singleton();
if (tsman) {
@@ -42,10 +46,10 @@ void preregister_text_server_adv_types() {
}
}
-void register_text_server_adv_types() {
-}
-
-void unregister_text_server_adv_types() {
+void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
+ return;
+ }
}
#ifdef GDEXTENSION
@@ -61,8 +65,9 @@ extern "C" {
GDNativeBool GDN_EXPORT textserver_advanced_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
- init_obj.register_server_initializer(&preregister_text_server_adv_types);
- init_obj.register_server_terminator(&unregister_text_server_adv_types);
+ init_obj.register_initializer(&initialize_text_server_adv_module);
+ init_obj.register_terminator(&uninitialize_text_server_adv_module);
+ init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SERVERS);
return init_obj.init();
}
diff --git a/modules/text_server_adv/register_types.h b/modules/text_server_adv/register_types.h
index d2b49fce6e..dfe20c860c 100644
--- a/modules/text_server_adv/register_types.h
+++ b/modules/text_server_adv/register_types.h
@@ -31,10 +31,14 @@
#ifndef TEXT_SERVER_ADV_REGISTER_TYPES_H
#define TEXT_SERVER_ADV_REGISTER_TYPES_H
-#define MODULE_TEXT_SERVER_ADV_HAS_PREREGISTER
+#ifdef GDEXTENSION
+#include <godot_cpp/core/class_db.hpp>
+using namespace godot;
+#else
+#include "modules/register_module_types.h"
+#endif
-void preregister_text_server_adv_types();
-void register_text_server_adv_types();
-void unregister_text_server_adv_types();
+void initialize_text_server_adv_module(ModuleInitializationLevel p_level);
+void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level);
#endif // TEXT_SERVER_ADV_REGISTER_TYPES_H
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 437fbe76ab..ba249aff7a 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -878,8 +878,8 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_
struct MSContext {
msdfgen::Point2 position;
- msdfgen::Shape *shape;
- msdfgen::Contour *contour;
+ msdfgen::Shape *shape = nullptr;
+ msdfgen::Contour *contour = nullptr;
};
class DistancePixelConversion {
@@ -1329,7 +1329,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontDataAdvanced
fd->underline_position = (-FT_MulFix(fd->face->underline_position, fd->face->size->metrics.y_scale) / 64.0) / fd->oversampling * fd->scale;
fd->underline_thickness = (FT_MulFix(fd->face->underline_thickness, fd->face->size->metrics.y_scale) / 64.0) / fd->oversampling * fd->scale;
- hb_font_set_synthetic_slant(fd->hb_handle, p_font_data->transform.elements[0][1]);
+ hb_font_set_synthetic_slant(fd->hb_handle, p_font_data->transform.columns[0][1]);
if (!p_font_data->face_init) {
// Get style flags and name.