You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-28 16:07:14 +00:00
Make FreeType optional for export templates.
This commit is contained in:
@@ -38,6 +38,7 @@ def make_icu_data(target, source, env):
|
|||||||
# Thirdparty source files
|
# Thirdparty source files
|
||||||
|
|
||||||
thirdparty_obj = []
|
thirdparty_obj = []
|
||||||
|
freetype_enabled = env.module_check_dependencies("text_server_adv", ["freetype"])
|
||||||
|
|
||||||
if env["builtin_harfbuzz"]:
|
if env["builtin_harfbuzz"]:
|
||||||
env_harfbuzz = env_modules.Clone()
|
env_harfbuzz = env_modules.Clone()
|
||||||
@@ -57,11 +58,9 @@ if env["builtin_harfbuzz"]:
|
|||||||
"src/hb-face.cc",
|
"src/hb-face.cc",
|
||||||
"src/hb-fallback-shape.cc",
|
"src/hb-fallback-shape.cc",
|
||||||
"src/hb-font.cc",
|
"src/hb-font.cc",
|
||||||
"src/hb-ft.cc",
|
|
||||||
#'src/hb-gdi.cc',
|
#'src/hb-gdi.cc',
|
||||||
#'src/hb-glib.cc',
|
#'src/hb-glib.cc',
|
||||||
#'src/hb-gobject-structs.cc',
|
#'src/hb-gobject-structs.cc',
|
||||||
"src/hb-graphite2.cc",
|
|
||||||
"src/hb-icu.cc",
|
"src/hb-icu.cc",
|
||||||
"src/hb-map.cc",
|
"src/hb-map.cc",
|
||||||
"src/hb-number.cc",
|
"src/hb-number.cc",
|
||||||
@@ -109,14 +108,26 @@ if env["builtin_harfbuzz"]:
|
|||||||
"src/hb-unicode.cc",
|
"src/hb-unicode.cc",
|
||||||
#'src/hb-uniscribe.cc'
|
#'src/hb-uniscribe.cc'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if freetype_enabled:
|
||||||
|
thirdparty_sources += [
|
||||||
|
"src/hb-ft.cc",
|
||||||
|
"src/hb-graphite2.cc",
|
||||||
|
]
|
||||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||||
|
|
||||||
env_harfbuzz.Append(
|
env_harfbuzz.Append(
|
||||||
CPPPATH=[
|
CPPPATH=[
|
||||||
"#thirdparty/harfbuzz/src",
|
"#thirdparty/harfbuzz/src",
|
||||||
|
"#thirdparty/icu4c/common/",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if freetype_enabled:
|
||||||
|
env_harfbuzz.Append(
|
||||||
|
CPPPATH=[
|
||||||
"#thirdparty/freetype/include",
|
"#thirdparty/freetype/include",
|
||||||
"#thirdparty/graphite/include",
|
"#thirdparty/graphite/include",
|
||||||
"#thirdparty/icu4c/common/",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -133,6 +144,12 @@ if env["builtin_harfbuzz"]:
|
|||||||
CCFLAGS=[
|
CCFLAGS=[
|
||||||
"-DHAVE_ICU_BUILTIN",
|
"-DHAVE_ICU_BUILTIN",
|
||||||
"-DHAVE_ICU",
|
"-DHAVE_ICU",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if freetype_enabled:
|
||||||
|
env_harfbuzz.Append(
|
||||||
|
CCFLAGS=[
|
||||||
"-DHAVE_FREETYPE",
|
"-DHAVE_FREETYPE",
|
||||||
"-DHAVE_GRAPHITE2",
|
"-DHAVE_GRAPHITE2",
|
||||||
"-DGRAPHITE2_STATIC",
|
"-DGRAPHITE2_STATIC",
|
||||||
@@ -156,7 +173,7 @@ if env["builtin_harfbuzz"]:
|
|||||||
env.Append(LIBS=[lib])
|
env.Append(LIBS=[lib])
|
||||||
|
|
||||||
|
|
||||||
if env["builtin_graphite"]:
|
if env["builtin_graphite"] and freetype_enabled:
|
||||||
env_graphite = env_modules.Clone()
|
env_graphite = env_modules.Clone()
|
||||||
env_graphite.disable_warnings()
|
env_graphite.disable_warnings()
|
||||||
|
|
||||||
@@ -488,9 +505,15 @@ if env_text_server_adv["tools"]:
|
|||||||
env_text_server_adv.Append(
|
env_text_server_adv.Append(
|
||||||
CPPPATH=[
|
CPPPATH=[
|
||||||
"#thirdparty/harfbuzz/src",
|
"#thirdparty/harfbuzz/src",
|
||||||
|
"#thirdparty/icu4c/common/",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if freetype_enabled:
|
||||||
|
env_text_server_adv.Append(
|
||||||
|
CPPPATH=[
|
||||||
"#thirdparty/freetype/include",
|
"#thirdparty/freetype/include",
|
||||||
"#thirdparty/graphite/include",
|
"#thirdparty/graphite/include",
|
||||||
"#thirdparty/icu4c/common/",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
def can_build(env, platform):
|
def can_build(env, platform):
|
||||||
return env.module_check_dependencies("text_server_adv", ["freetype"])
|
return True
|
||||||
|
|
||||||
|
|
||||||
def configure(env):
|
def configure(env):
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "dynamic_font_adv.h"
|
#include "dynamic_font_adv.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#include FT_STROKER_H
|
#include FT_STROKER_H
|
||||||
#include FT_ADVANCES_H
|
#include FT_ADVANCES_H
|
||||||
#include FT_MULTIPLE_MASTERS_H
|
#include FT_MULTIPLE_MASTERS_H
|
||||||
@@ -1001,3 +1003,5 @@ DynamicFontDataAdvanced::~DynamicFontDataAdvanced() {
|
|||||||
FT_Done_FreeType(library);
|
FT_Done_FreeType(library);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // MODULE_FREETYPE_ENABLED
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
|
|
||||||
#include "font_adv.h"
|
#include "font_adv.h"
|
||||||
|
|
||||||
|
#include "modules/modules_enabled.gen.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include FT_TRUETYPE_TABLES_H
|
#include FT_TRUETYPE_TABLES_H
|
||||||
@@ -185,4 +189,6 @@ public:
|
|||||||
virtual ~DynamicFontDataAdvanced() override;
|
virtual ~DynamicFontDataAdvanced() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#endif // DYNAMIC_FONT_ADV_H
|
#endif // DYNAMIC_FONT_ADV_H
|
||||||
|
|||||||
@@ -529,10 +529,12 @@ RID TextServerAdvanced::create_font_system(const String &p_name, int p_base_size
|
|||||||
RID TextServerAdvanced::create_font_resource(const String &p_filename, int p_base_size) {
|
RID TextServerAdvanced::create_font_resource(const String &p_filename, int p_base_size) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
FontDataAdvanced *fd = nullptr;
|
FontDataAdvanced *fd = nullptr;
|
||||||
if (p_filename.get_extension() == "ttf" || p_filename.get_extension() == "otf" || p_filename.get_extension() == "woff") {
|
if (p_filename.get_extension() == "fnt" || p_filename.get_extension() == "font") {
|
||||||
fd = memnew(DynamicFontDataAdvanced);
|
|
||||||
} else if (p_filename.get_extension() == "fnt" || p_filename.get_extension() == "font") {
|
|
||||||
fd = memnew(BitmapFontDataAdvanced);
|
fd = memnew(BitmapFontDataAdvanced);
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
} else if (p_filename.get_extension() == "ttf" || p_filename.get_extension() == "otf" || p_filename.get_extension() == "woff") {
|
||||||
|
fd = memnew(DynamicFontDataAdvanced);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return RID();
|
return RID();
|
||||||
}
|
}
|
||||||
@@ -549,10 +551,12 @@ RID TextServerAdvanced::create_font_resource(const String &p_filename, int p_bas
|
|||||||
RID TextServerAdvanced::create_font_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size) {
|
RID TextServerAdvanced::create_font_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
FontDataAdvanced *fd = nullptr;
|
FontDataAdvanced *fd = nullptr;
|
||||||
if (p_type == "ttf" || p_type == "otf" || p_type == "woff") {
|
if (p_type == "fnt" || p_type == "font") {
|
||||||
fd = memnew(DynamicFontDataAdvanced);
|
|
||||||
} else if (p_type == "fnt" || p_type == "font") {
|
|
||||||
fd = memnew(BitmapFontDataAdvanced);
|
fd = memnew(BitmapFontDataAdvanced);
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
} else if (p_type == "ttf" || p_type == "otf" || p_type == "woff") {
|
||||||
|
fd = memnew(DynamicFontDataAdvanced);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return RID();
|
return RID();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
def can_build(env, platform):
|
def can_build(env, platform):
|
||||||
return env.module_check_dependencies("text_server_fb", ["freetype"])
|
return True
|
||||||
|
|
||||||
|
|
||||||
def configure(env):
|
def configure(env):
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "dynamic_font_fb.h"
|
#include "dynamic_font_fb.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#include FT_STROKER_H
|
#include FT_STROKER_H
|
||||||
#include FT_ADVANCES_H
|
#include FT_ADVANCES_H
|
||||||
|
|
||||||
@@ -684,3 +686,5 @@ DynamicFontDataFallback::~DynamicFontDataFallback() {
|
|||||||
FT_Done_FreeType(library);
|
FT_Done_FreeType(library);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // MODULE_FREETYPE_ENABLED
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
|
|
||||||
#include "font_fb.h"
|
#include "font_fb.h"
|
||||||
|
|
||||||
|
#include "modules/modules_enabled.gen.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
@@ -163,4 +167,6 @@ public:
|
|||||||
virtual ~DynamicFontDataFallback() override;
|
virtual ~DynamicFontDataFallback() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MODULE_FREETYPE_ENABLED
|
||||||
|
|
||||||
#endif // DYNAMIC_FONT_FALLBACK_H
|
#endif // DYNAMIC_FONT_FALLBACK_H
|
||||||
|
|||||||
@@ -107,10 +107,12 @@ RID TextServerFallback::create_font_system(const String &p_name, int p_base_size
|
|||||||
RID TextServerFallback::create_font_resource(const String &p_filename, int p_base_size) {
|
RID TextServerFallback::create_font_resource(const String &p_filename, int p_base_size) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
FontDataFallback *fd = nullptr;
|
FontDataFallback *fd = nullptr;
|
||||||
if (p_filename.get_extension() == "ttf" || p_filename.get_extension() == "otf" || p_filename.get_extension() == "woff") {
|
if (p_filename.get_extension() == "fnt" || p_filename.get_extension() == "font") {
|
||||||
fd = memnew(DynamicFontDataFallback);
|
|
||||||
} else if (p_filename.get_extension() == "fnt" || p_filename.get_extension() == "font") {
|
|
||||||
fd = memnew(BitmapFontDataFallback);
|
fd = memnew(BitmapFontDataFallback);
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
} else if (p_filename.get_extension() == "ttf" || p_filename.get_extension() == "otf" || p_filename.get_extension() == "woff") {
|
||||||
|
fd = memnew(DynamicFontDataFallback);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return RID();
|
return RID();
|
||||||
}
|
}
|
||||||
@@ -127,10 +129,12 @@ RID TextServerFallback::create_font_resource(const String &p_filename, int p_bas
|
|||||||
RID TextServerFallback::create_font_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size) {
|
RID TextServerFallback::create_font_memory(const uint8_t *p_data, size_t p_size, const String &p_type, int p_base_size) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
FontDataFallback *fd = nullptr;
|
FontDataFallback *fd = nullptr;
|
||||||
if (p_type == "ttf" || p_type == "otf" || p_type == "woff") {
|
if (p_type == "fnt" || p_type == "font") {
|
||||||
fd = memnew(DynamicFontDataFallback);
|
|
||||||
} else if (p_type == "fnt" || p_type == "font") {
|
|
||||||
fd = memnew(BitmapFontDataFallback);
|
fd = memnew(BitmapFontDataFallback);
|
||||||
|
#ifdef MODULE_FREETYPE_ENABLED
|
||||||
|
} else if (p_type == "ttf" || p_type == "otf" || p_type == "woff") {
|
||||||
|
fd = memnew(DynamicFontDataFallback);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return RID();
|
return RID();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user