1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Implement SVG in OT support.

This commit is contained in:
bruvzg
2022-06-14 10:29:58 +03:00
parent 191c8ed12f
commit d77902f33a
18 changed files with 1304 additions and 29 deletions

View File

@@ -41,6 +41,8 @@
using namespace godot;
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var)
#else
// Headers for building as built-in module.
@@ -49,7 +51,7 @@ using namespace godot;
#include "core/string/print_string.h"
#include "core/string/ucaps.h"
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen.
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
#endif
@@ -62,6 +64,10 @@ using namespace godot;
#include "msdfgen.h"
#endif
#ifdef MODULE_SVG_ENABLED
#include "thorvg_svg_in_ot.h"
#endif
/*************************************************************************/
#define OT_TAG(c1, c2, c3, c4) ((int32_t)((((uint32_t)(c1)&0xff) << 24) | (((uint32_t)(c2)&0xff) << 16) | (((uint32_t)(c3)&0xff) << 8) | ((uint32_t)(c4)&0xff)))
@@ -771,6 +777,9 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_f
memdelete(fd);
ERR_FAIL_V_MSG(false, "FreeType: Error initializing library: '" + String(FT_Error_String(error)) + "'.");
}
#ifdef MODULE_SVG_ENABLED
FT_Property_Set(ft_library, "ot-svg", "svg-hooks", get_tvg_svg_in_ot_hooks());
#endif
}
memset(&fd->stream, 0, sizeof(FT_StreamRec));
@@ -992,6 +1001,9 @@ int64_t TextServerFallback::_font_get_face_count(const RID &p_font_rid) const {
if (!ft_library) {
error = FT_Init_FreeType(&ft_library);
ERR_FAIL_COND_V_MSG(error != 0, false, "FreeType: Error initializing library: '" + String(FT_Error_String(error)) + "'.");
#ifdef MODULE_SVG_ENABLED
FT_Property_Set(ft_library, "ot-svg", "svg-hooks", get_tvg_svg_in_ot_hooks());
#endif
}
FT_StreamRec stream;