[TextServer] Remove GDExtension build support.
This commit is contained in:
parent
c646b57c27
commit
b83ca97659
19 changed files with 0 additions and 1564 deletions
|
|
@ -1,769 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# ruff: noqa: F821
|
||||
|
||||
import methods
|
||||
|
||||
# For the reference:
|
||||
# - CCFLAGS are compilation flags shared between C and C++
|
||||
# - CFLAGS are for C-specific compilation flags
|
||||
# - CXXFLAGS are for C++-specific compilation flags
|
||||
# - CPPFLAGS are for pre-processor flags
|
||||
# - CPPDEFINES are for pre-processor defines
|
||||
# - LINKFLAGS are for linking flags
|
||||
|
||||
env = SConscript("./godot-cpp/SConstruct")
|
||||
env.__class__.disable_warnings = methods.disable_warnings
|
||||
|
||||
opts = Variables([], ARGUMENTS)
|
||||
opts.Add(BoolVariable("brotli_enabled", "Use Brotli library", True))
|
||||
opts.Add(BoolVariable("freetype_enabled", "Use FreeType library", True))
|
||||
opts.Add(BoolVariable("msdfgen_enabled", "Use MSDFgen library (require FreeType)", True))
|
||||
opts.Add(BoolVariable("graphite_enabled", "Use Graphite library (require FreeType)", True))
|
||||
opts.Add(BoolVariable("thorvg_enabled", "Use ThorVG library (require FreeType)", True))
|
||||
opts.Add(BoolVariable("static_icu_data", "Use built-in ICU data", True))
|
||||
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
|
||||
|
||||
opts.Update(env)
|
||||
|
||||
if env["platform"] == "windows" and not env["use_mingw"]:
|
||||
env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding.
|
||||
|
||||
# ThorVG
|
||||
if env["thorvg_enabled"] and env["freetype_enabled"]:
|
||||
env_tvg = env.Clone()
|
||||
env_tvg.disable_warnings()
|
||||
|
||||
thirdparty_tvg_dir = "../../../thirdparty/thorvg/"
|
||||
thirdparty_tvg_sources = [
|
||||
# common
|
||||
"src/common/tvgCompressor.cpp",
|
||||
"src/common/tvgLines.cpp",
|
||||
"src/common/tvgMath.cpp",
|
||||
"src/common/tvgStr.cpp",
|
||||
# SVG parser
|
||||
"src/loaders/svg/tvgSvgCssStyle.cpp",
|
||||
"src/loaders/svg/tvgSvgLoader.cpp",
|
||||
"src/loaders/svg/tvgSvgPath.cpp",
|
||||
"src/loaders/svg/tvgSvgSceneBuilder.cpp",
|
||||
"src/loaders/svg/tvgSvgUtil.cpp",
|
||||
"src/loaders/svg/tvgXmlParser.cpp",
|
||||
"src/loaders/raw/tvgRawLoader.cpp",
|
||||
# image loaders
|
||||
"src/loaders/external_png/tvgPngLoader.cpp",
|
||||
"src/loaders/jpg/tvgJpgd.cpp",
|
||||
"src/loaders/jpg/tvgJpgLoader.cpp",
|
||||
# renderer common
|
||||
"src/renderer/tvgAccessor.cpp",
|
||||
# "src/renderer/tvgAnimation.cpp",
|
||||
"src/renderer/tvgCanvas.cpp",
|
||||
"src/renderer/tvgFill.cpp",
|
||||
# "src/renderer/tvgGlCanvas.cpp",
|
||||
"src/renderer/tvgInitializer.cpp",
|
||||
"src/renderer/tvgLoader.cpp",
|
||||
"src/renderer/tvgPaint.cpp",
|
||||
"src/renderer/tvgPicture.cpp",
|
||||
"src/renderer/tvgRender.cpp",
|
||||
# "src/renderer/tvgSaver.cpp",
|
||||
"src/renderer/tvgScene.cpp",
|
||||
"src/renderer/tvgShape.cpp",
|
||||
"src/renderer/tvgSwCanvas.cpp",
|
||||
"src/renderer/tvgTaskScheduler.cpp",
|
||||
"src/renderer/tvgText.cpp",
|
||||
# "src/renderer/tvgWgCanvas.cpp",
|
||||
# renderer sw_engine
|
||||
"src/renderer/sw_engine/tvgSwFill.cpp",
|
||||
"src/renderer/sw_engine/tvgSwImage.cpp",
|
||||
"src/renderer/sw_engine/tvgSwMath.cpp",
|
||||
"src/renderer/sw_engine/tvgSwMemPool.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRaster.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRenderer.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRle.cpp",
|
||||
"src/renderer/sw_engine/tvgSwShape.cpp",
|
||||
"src/renderer/sw_engine/tvgSwStroke.cpp",
|
||||
]
|
||||
thirdparty_tvg_sources = [thirdparty_tvg_dir + file for file in thirdparty_tvg_sources]
|
||||
|
||||
env_tvg.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/thorvg/inc",
|
||||
"../../../thirdparty/thorvg/src/common",
|
||||
"../../../thirdparty/thorvg/src/renderer",
|
||||
"../../../thirdparty/thorvg/src/renderer/sw_engine",
|
||||
"../../../thirdparty/thorvg/src/loaders/svg",
|
||||
"../../../thirdparty/thorvg/src/loaders/raw",
|
||||
"../../../thirdparty/thorvg/src/loaders/external_png",
|
||||
"../../../thirdparty/thorvg/src/loaders/jpg",
|
||||
"../../../thirdparty/libpng",
|
||||
]
|
||||
)
|
||||
|
||||
# Enable ThorVG static object linking.
|
||||
env_tvg.Append(CPPDEFINES=["TVG_STATIC"])
|
||||
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/thorvg/inc",
|
||||
"../../../thirdparty/thorvg/src/common",
|
||||
"../../../thirdparty/thorvg/src/renderer",
|
||||
]
|
||||
)
|
||||
env.Append(CPPDEFINES=["MODULE_SVG_ENABLED"])
|
||||
|
||||
lib = env_tvg.Library(
|
||||
f"tvg_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_tvg_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# MSDFGEN
|
||||
if env["msdfgen_enabled"] and env["freetype_enabled"]:
|
||||
env_msdfgen = env.Clone()
|
||||
env_msdfgen.disable_warnings()
|
||||
|
||||
thirdparty_msdfgen_dir = "../../../thirdparty/msdfgen/"
|
||||
thirdparty_msdfgen_sources = [
|
||||
"core/Contour.cpp",
|
||||
"core/DistanceMapping.cpp",
|
||||
"core/EdgeHolder.cpp",
|
||||
"core/MSDFErrorCorrection.cpp",
|
||||
"core/Projection.cpp",
|
||||
"core/Scanline.cpp",
|
||||
"core/Shape.cpp",
|
||||
"core/contour-combiners.cpp",
|
||||
"core/convergent-curve-ordering.cpp",
|
||||
"core/edge-coloring.cpp",
|
||||
"core/edge-segments.cpp",
|
||||
"core/edge-selectors.cpp",
|
||||
"core/equation-solver.cpp",
|
||||
# "core/export-svg.cpp",
|
||||
"core/msdf-error-correction.cpp",
|
||||
"core/msdfgen.cpp",
|
||||
"core/rasterization.cpp",
|
||||
"core/render-sdf.cpp",
|
||||
# "core/save-bmp.cpp",
|
||||
# "core/save-fl32.cpp",
|
||||
# "core/save-rgba.cpp",
|
||||
# "core/save-tiff.cpp",
|
||||
"core/sdf-error-estimation.cpp",
|
||||
"core/shape-description.cpp",
|
||||
]
|
||||
thirdparty_msdfgen_sources = [thirdparty_msdfgen_dir + file for file in thirdparty_msdfgen_sources]
|
||||
|
||||
env_msdfgen.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")])
|
||||
env_msdfgen.Append(CPPPATH=["../../../thirdparty/freetype/include", "../../../thirdparty/msdfgen"])
|
||||
env.Append(CPPPATH=["../../../thirdparty/msdfgen"])
|
||||
env.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")])
|
||||
env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"])
|
||||
|
||||
lib = env_msdfgen.Library(
|
||||
f"msdfgen_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_msdfgen_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# FreeType
|
||||
if env["freetype_enabled"]:
|
||||
env_freetype = env.Clone()
|
||||
env_freetype.disable_warnings()
|
||||
|
||||
thirdparty_freetype_dir = "../../../thirdparty/freetype/"
|
||||
thirdparty_freetype_sources = [
|
||||
"src/autofit/autofit.c",
|
||||
"src/base/ftbase.c",
|
||||
"src/base/ftbbox.c",
|
||||
"src/base/ftbdf.c",
|
||||
"src/base/ftbitmap.c",
|
||||
"src/base/ftcid.c",
|
||||
"src/base/ftdebug.c",
|
||||
"src/base/ftfstype.c",
|
||||
"src/base/ftgasp.c",
|
||||
"src/base/ftglyph.c",
|
||||
"src/base/ftgxval.c",
|
||||
"src/base/ftinit.c",
|
||||
"src/base/ftmm.c",
|
||||
"src/base/ftotval.c",
|
||||
"src/base/ftpatent.c",
|
||||
"src/base/ftpfr.c",
|
||||
"src/base/ftstroke.c",
|
||||
"src/base/ftsynth.c",
|
||||
"src/base/ftsystem.c",
|
||||
"src/base/fttype1.c",
|
||||
"src/base/ftwinfnt.c",
|
||||
"src/bdf/bdf.c",
|
||||
"src/bzip2/ftbzip2.c",
|
||||
"src/cache/ftcache.c",
|
||||
"src/cff/cff.c",
|
||||
"src/cid/type1cid.c",
|
||||
"src/gxvalid/gxvalid.c",
|
||||
"src/gzip/ftgzip.c",
|
||||
"src/lzw/ftlzw.c",
|
||||
"src/otvalid/otvalid.c",
|
||||
"src/pcf/pcf.c",
|
||||
"src/pfr/pfr.c",
|
||||
"src/psaux/psaux.c",
|
||||
"src/pshinter/pshinter.c",
|
||||
"src/psnames/psnames.c",
|
||||
"src/raster/raster.c",
|
||||
"src/sdf/sdf.c",
|
||||
"src/svg/svg.c",
|
||||
"src/smooth/smooth.c",
|
||||
"src/truetype/truetype.c",
|
||||
"src/type1/type1.c",
|
||||
"src/type42/type42.c",
|
||||
"src/winfonts/winfnt.c",
|
||||
"src/sfnt/sfnt.c",
|
||||
]
|
||||
thirdparty_freetype_sources = [thirdparty_freetype_dir + file for file in thirdparty_freetype_sources]
|
||||
|
||||
thirdparty_png_dir = "../../../thirdparty/libpng/"
|
||||
thirdparty_png_sources = [
|
||||
"png.c",
|
||||
"pngerror.c",
|
||||
"pngget.c",
|
||||
"pngmem.c",
|
||||
"pngpread.c",
|
||||
"pngread.c",
|
||||
"pngrio.c",
|
||||
"pngrtran.c",
|
||||
"pngrutil.c",
|
||||
"pngset.c",
|
||||
"pngtrans.c",
|
||||
"pngwio.c",
|
||||
"pngwrite.c",
|
||||
"pngwtran.c",
|
||||
"pngwutil.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_png_dir + file for file in thirdparty_png_sources]
|
||||
|
||||
thirdparty_zlib_dir = "../../../thirdparty/zlib/"
|
||||
thirdparty_zlib_sources = [
|
||||
"adler32.c",
|
||||
"compress.c",
|
||||
"crc32.c",
|
||||
"deflate.c",
|
||||
"inffast.c",
|
||||
"inflate.c",
|
||||
"inftrees.c",
|
||||
"trees.c",
|
||||
"uncompr.c",
|
||||
"zutil.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
|
||||
|
||||
if env["brotli_enabled"]:
|
||||
thirdparty_brotli_dir = "../../../thirdparty/brotli/"
|
||||
thirdparty_brotli_sources = [
|
||||
"common/constants.c",
|
||||
"common/context.c",
|
||||
"common/dictionary.c",
|
||||
"common/platform.c",
|
||||
"common/shared_dictionary.c",
|
||||
"common/transform.c",
|
||||
"dec/bit_reader.c",
|
||||
"dec/decode.c",
|
||||
"dec/huffman.c",
|
||||
"dec/state.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
|
||||
env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
env.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
|
||||
env_freetype.Append(CPPPATH=[thirdparty_freetype_dir + "/include", thirdparty_zlib_dir, thirdparty_png_dir])
|
||||
env.Append(CPPPATH=[thirdparty_freetype_dir + "/include"])
|
||||
|
||||
env_freetype.Append(
|
||||
CPPDEFINES=[
|
||||
"FT2_BUILD_LIBRARY",
|
||||
"FT_CONFIG_OPTION_USE_PNG",
|
||||
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
|
||||
]
|
||||
)
|
||||
if env.dev_build:
|
||||
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
|
||||
|
||||
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
|
||||
|
||||
lib = env_freetype.Library(
|
||||
f"freetype_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_freetype_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# HarfBuzz
|
||||
env_harfbuzz = env.Clone()
|
||||
env_harfbuzz.disable_warnings()
|
||||
|
||||
thirdparty_harfbuzz_dir = "../../../thirdparty/harfbuzz/"
|
||||
thirdparty_harfbuzz_sources = [
|
||||
"src/hb-aat-layout.cc",
|
||||
"src/hb-aat-map.cc",
|
||||
"src/hb-blob.cc",
|
||||
"src/hb-buffer-serialize.cc",
|
||||
"src/hb-buffer-verify.cc",
|
||||
"src/hb-buffer.cc",
|
||||
# "src/hb-cairo-utils.cc",
|
||||
# "src/hb-cairo.cc",
|
||||
"src/hb-common.cc",
|
||||
# "src/hb-coretext-font.cc",
|
||||
# "src/hb-coretext-shape.cc",
|
||||
# "src/hb-directwrite.cc",
|
||||
"src/hb-draw.cc",
|
||||
"src/hb-face-builder.cc",
|
||||
"src/hb-face.cc",
|
||||
"src/hb-fallback-shape.cc",
|
||||
"src/hb-font.cc",
|
||||
# "src/hb-gdi.cc",
|
||||
# "src/hb-glib.cc",
|
||||
# "src/hb-gobject-structs.cc",
|
||||
"src/hb-icu.cc",
|
||||
"src/hb-map.cc",
|
||||
"src/hb-number.cc",
|
||||
"src/hb-ot-cff1-table.cc",
|
||||
"src/hb-ot-cff2-table.cc",
|
||||
"src/hb-ot-color.cc",
|
||||
"src/hb-ot-face.cc",
|
||||
"src/hb-ot-font.cc",
|
||||
"src/hb-ot-layout.cc",
|
||||
"src/hb-ot-map.cc",
|
||||
"src/hb-ot-math.cc",
|
||||
"src/hb-ot-meta.cc",
|
||||
"src/hb-ot-metrics.cc",
|
||||
"src/hb-ot-name.cc",
|
||||
"src/hb-ot-shaper-arabic.cc",
|
||||
"src/hb-ot-shaper-default.cc",
|
||||
"src/hb-ot-shaper-hangul.cc",
|
||||
"src/hb-ot-shaper-hebrew.cc",
|
||||
"src/hb-ot-shaper-indic-table.cc",
|
||||
"src/hb-ot-shaper-indic.cc",
|
||||
"src/hb-ot-shaper-khmer.cc",
|
||||
"src/hb-ot-shaper-myanmar.cc",
|
||||
"src/hb-ot-shaper-syllabic.cc",
|
||||
"src/hb-ot-shaper-thai.cc",
|
||||
"src/hb-ot-shaper-use.cc",
|
||||
"src/hb-ot-shaper-vowel-constraints.cc",
|
||||
"src/hb-ot-shape-fallback.cc",
|
||||
"src/hb-ot-shape-normalize.cc",
|
||||
"src/hb-ot-shape.cc",
|
||||
"src/hb-ot-tag.cc",
|
||||
"src/hb-ot-var.cc",
|
||||
"src/hb-outline.cc",
|
||||
"src/hb-paint-bounded.cc",
|
||||
"src/hb-paint-extents.cc",
|
||||
"src/hb-paint.cc",
|
||||
"src/hb-set.cc",
|
||||
"src/hb-shape-plan.cc",
|
||||
"src/hb-shape.cc",
|
||||
"src/hb-shaper.cc",
|
||||
"src/hb-static.cc",
|
||||
"src/hb-style.cc",
|
||||
"src/hb-subset-cff-common.cc",
|
||||
"src/hb-subset-cff1.cc",
|
||||
"src/hb-subset-cff2.cc",
|
||||
"src/hb-subset-input.cc",
|
||||
"src/hb-subset-instancer-iup.cc",
|
||||
"src/hb-subset-instancer-solver.cc",
|
||||
"src/hb-subset-plan.cc",
|
||||
"src/hb-subset-serialize.cc",
|
||||
"src/hb-subset.cc",
|
||||
"src/hb-ucd.cc",
|
||||
"src/hb-unicode.cc",
|
||||
# "src/hb-uniscribe.cc",
|
||||
"src/OT/Var/VARC/VARC.cc",
|
||||
]
|
||||
|
||||
if env["freetype_enabled"]:
|
||||
thirdparty_harfbuzz_sources += [
|
||||
"src/hb-ft.cc",
|
||||
"src/hb-graphite2.cc",
|
||||
]
|
||||
thirdparty_harfbuzz_sources = [thirdparty_harfbuzz_dir + file for file in thirdparty_harfbuzz_sources]
|
||||
|
||||
env_harfbuzz.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/harfbuzz/src",
|
||||
"../../../thirdparty/icu4c/common/",
|
||||
"../../../thirdparty/icu4c/i18n/",
|
||||
]
|
||||
)
|
||||
|
||||
if env["freetype_enabled"]:
|
||||
env_harfbuzz.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/freetype/include",
|
||||
"../../../thirdparty/graphite/include",
|
||||
]
|
||||
)
|
||||
|
||||
if env["platform"] == "android" or env["platform"] == "linuxbsd":
|
||||
env_harfbuzz.Append(CPPDEFINES=["HAVE_PTHREAD"])
|
||||
|
||||
env_harfbuzz.Append(
|
||||
CPPDEFINES=[
|
||||
"U_STATIC_IMPLEMENTATION",
|
||||
("U_HAVE_LIB_SUFFIX", 1),
|
||||
("U_LIB_SUFFIX_C_NAME", "_godot"),
|
||||
"HAVE_ICU_BUILTIN",
|
||||
"HAVE_ICU",
|
||||
]
|
||||
)
|
||||
|
||||
if env["freetype_enabled"]:
|
||||
env_harfbuzz.Append(
|
||||
CPPDEFINES=[
|
||||
"HAVE_FREETYPE",
|
||||
"HAVE_GRAPHITE2",
|
||||
"GRAPHITE2_STATIC",
|
||||
]
|
||||
)
|
||||
|
||||
env.Append(CPPPATH=["../../../thirdparty/harfbuzz/src"])
|
||||
|
||||
lib = env_harfbuzz.Library(
|
||||
f"harfbuzz_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_harfbuzz_sources,
|
||||
)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
||||
# Graphite
|
||||
if env["graphite_enabled"] and env["freetype_enabled"]:
|
||||
env_graphite = env.Clone()
|
||||
env_graphite.disable_warnings()
|
||||
|
||||
thirdparty_graphite_dir = "../../../thirdparty/graphite/"
|
||||
thirdparty_graphite_sources = [
|
||||
"src/gr_char_info.cpp",
|
||||
"src/gr_face.cpp",
|
||||
"src/gr_features.cpp",
|
||||
"src/gr_font.cpp",
|
||||
"src/gr_logging.cpp",
|
||||
"src/gr_segment.cpp",
|
||||
"src/gr_slot.cpp",
|
||||
"src/CmapCache.cpp",
|
||||
"src/Code.cpp",
|
||||
"src/Collider.cpp",
|
||||
"src/Decompressor.cpp",
|
||||
"src/Face.cpp",
|
||||
#'src/FileFace.cpp',
|
||||
"src/FeatureMap.cpp",
|
||||
"src/Font.cpp",
|
||||
"src/GlyphCache.cpp",
|
||||
"src/GlyphFace.cpp",
|
||||
"src/Intervals.cpp",
|
||||
"src/Justifier.cpp",
|
||||
"src/NameTable.cpp",
|
||||
"src/Pass.cpp",
|
||||
"src/Position.cpp",
|
||||
"src/Segment.cpp",
|
||||
"src/Silf.cpp",
|
||||
"src/Slot.cpp",
|
||||
"src/Sparse.cpp",
|
||||
"src/TtfUtil.cpp",
|
||||
"src/UtfCodec.cpp",
|
||||
"src/FileFace.cpp",
|
||||
"src/json.cpp",
|
||||
]
|
||||
if env["platform"] != "windows" or env["use_mingw"]:
|
||||
thirdparty_graphite_sources += ["src/direct_machine.cpp"]
|
||||
else:
|
||||
thirdparty_graphite_sources += ["src/call_machine.cpp"]
|
||||
|
||||
thirdparty_graphite_sources = [thirdparty_graphite_dir + file for file in thirdparty_graphite_sources]
|
||||
|
||||
env_graphite.Append(CPPPATH=["../../../thirdparty/graphite/src", "../../../thirdparty/graphite/include"])
|
||||
env_graphite.Append(
|
||||
CPPDEFINES=[
|
||||
"GRAPHITE2_STATIC",
|
||||
"GRAPHITE2_NTRACING",
|
||||
"GRAPHITE2_NFILEFACE",
|
||||
]
|
||||
)
|
||||
|
||||
lib = env_graphite.Library(
|
||||
f"graphite_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_graphite_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# ICU
|
||||
env_icu = env.Clone()
|
||||
env_icu.disable_warnings()
|
||||
|
||||
thirdparty_icu_dir = "../../../thirdparty/icu4c/"
|
||||
thirdparty_icu_sources = [
|
||||
"common/appendable.cpp",
|
||||
"common/bmpset.cpp",
|
||||
"common/brkeng.cpp",
|
||||
"common/brkiter.cpp",
|
||||
"common/bytesinkutil.cpp",
|
||||
"common/bytestream.cpp",
|
||||
"common/bytestrie.cpp",
|
||||
"common/bytestriebuilder.cpp",
|
||||
"common/bytestrieiterator.cpp",
|
||||
"common/caniter.cpp",
|
||||
"common/characterproperties.cpp",
|
||||
"common/chariter.cpp",
|
||||
"common/charstr.cpp",
|
||||
"common/cmemory.cpp",
|
||||
"common/cstr.cpp",
|
||||
"common/cstring.cpp",
|
||||
"common/cwchar.cpp",
|
||||
"common/dictbe.cpp",
|
||||
"common/dictionarydata.cpp",
|
||||
"common/dtintrv.cpp",
|
||||
"common/edits.cpp",
|
||||
"common/emojiprops.cpp",
|
||||
"common/errorcode.cpp",
|
||||
"common/filteredbrk.cpp",
|
||||
"common/filterednormalizer2.cpp",
|
||||
"common/fixedstring.cpp",
|
||||
"common/icudataver.cpp",
|
||||
"common/icuplug.cpp",
|
||||
"common/loadednormalizer2impl.cpp",
|
||||
"common/localebuilder.cpp",
|
||||
"common/localematcher.cpp",
|
||||
"common/localeprioritylist.cpp",
|
||||
"common/locavailable.cpp",
|
||||
"common/locbased.cpp",
|
||||
"common/locdispnames.cpp",
|
||||
"common/locdistance.cpp",
|
||||
"common/locdspnm.cpp",
|
||||
"common/locid.cpp",
|
||||
"common/loclikely.cpp",
|
||||
"common/loclikelysubtags.cpp",
|
||||
"common/locmap.cpp",
|
||||
"common/locresdata.cpp",
|
||||
"common/locutil.cpp",
|
||||
"common/lsr.cpp",
|
||||
"common/lstmbe.cpp",
|
||||
"common/messagepattern.cpp",
|
||||
"common/mlbe.cpp",
|
||||
"common/normalizer2.cpp",
|
||||
"common/normalizer2impl.cpp",
|
||||
"common/normlzr.cpp",
|
||||
"common/parsepos.cpp",
|
||||
"common/patternprops.cpp",
|
||||
"common/pluralmap.cpp",
|
||||
"common/propname.cpp",
|
||||
"common/propsvec.cpp",
|
||||
"common/punycode.cpp",
|
||||
"common/putil.cpp",
|
||||
"common/rbbi.cpp",
|
||||
"common/rbbi_cache.cpp",
|
||||
"common/rbbidata.cpp",
|
||||
"common/rbbinode.cpp",
|
||||
"common/rbbirb.cpp",
|
||||
"common/rbbiscan.cpp",
|
||||
"common/rbbisetb.cpp",
|
||||
"common/rbbistbl.cpp",
|
||||
"common/rbbitblb.cpp",
|
||||
"common/resbund.cpp",
|
||||
"common/resbund_cnv.cpp",
|
||||
"common/resource.cpp",
|
||||
"common/restrace.cpp",
|
||||
"common/ruleiter.cpp",
|
||||
"common/schriter.cpp",
|
||||
"common/serv.cpp",
|
||||
"common/servlk.cpp",
|
||||
"common/servlkf.cpp",
|
||||
"common/servls.cpp",
|
||||
"common/servnotf.cpp",
|
||||
"common/servrbf.cpp",
|
||||
"common/servslkf.cpp",
|
||||
"common/sharedobject.cpp",
|
||||
"common/simpleformatter.cpp",
|
||||
"common/static_unicode_sets.cpp",
|
||||
"common/stringpiece.cpp",
|
||||
"common/stringtriebuilder.cpp",
|
||||
"common/uarrsort.cpp",
|
||||
"common/ubidi.cpp",
|
||||
"common/ubidi_props.cpp",
|
||||
"common/ubidiln.cpp",
|
||||
"common/ubiditransform.cpp",
|
||||
"common/ubidiwrt.cpp",
|
||||
"common/ubrk.cpp",
|
||||
"common/ucase.cpp",
|
||||
"common/ucasemap.cpp",
|
||||
"common/ucasemap_titlecase_brkiter.cpp",
|
||||
"common/ucat.cpp",
|
||||
"common/uchar.cpp",
|
||||
"common/ucharstrie.cpp",
|
||||
"common/ucharstriebuilder.cpp",
|
||||
"common/ucharstrieiterator.cpp",
|
||||
"common/uchriter.cpp",
|
||||
"common/ucln_cmn.cpp",
|
||||
"common/ucmndata.cpp",
|
||||
"common/ucnv.cpp",
|
||||
"common/ucnv2022.cpp",
|
||||
"common/ucnv_bld.cpp",
|
||||
"common/ucnv_cb.cpp",
|
||||
"common/ucnv_cnv.cpp",
|
||||
"common/ucnv_ct.cpp",
|
||||
"common/ucnv_err.cpp",
|
||||
"common/ucnv_ext.cpp",
|
||||
"common/ucnv_io.cpp",
|
||||
"common/ucnv_lmb.cpp",
|
||||
"common/ucnv_set.cpp",
|
||||
"common/ucnv_u16.cpp",
|
||||
"common/ucnv_u32.cpp",
|
||||
"common/ucnv_u7.cpp",
|
||||
"common/ucnv_u8.cpp",
|
||||
"common/ucnvbocu.cpp",
|
||||
"common/ucnvdisp.cpp",
|
||||
"common/ucnvhz.cpp",
|
||||
"common/ucnvisci.cpp",
|
||||
"common/ucnvlat1.cpp",
|
||||
"common/ucnvmbcs.cpp",
|
||||
"common/ucnvscsu.cpp",
|
||||
"common/ucnvsel.cpp",
|
||||
"common/ucol_swp.cpp",
|
||||
"common/ucptrie.cpp",
|
||||
"common/ucurr.cpp",
|
||||
"common/udata.cpp",
|
||||
"common/udatamem.cpp",
|
||||
"common/udataswp.cpp",
|
||||
"common/uenum.cpp",
|
||||
"common/uhash.cpp",
|
||||
"common/uhash_us.cpp",
|
||||
"common/uidna.cpp",
|
||||
"common/uinit.cpp",
|
||||
"common/uinvchar.cpp",
|
||||
"common/uiter.cpp",
|
||||
"common/ulist.cpp",
|
||||
"common/uloc.cpp",
|
||||
"common/uloc_keytype.cpp",
|
||||
"common/uloc_tag.cpp",
|
||||
"common/ulocale.cpp",
|
||||
"common/ulocbuilder.cpp",
|
||||
"common/umapfile.cpp",
|
||||
"common/umath.cpp",
|
||||
"common/umutablecptrie.cpp",
|
||||
"common/umutex.cpp",
|
||||
"common/unames.cpp",
|
||||
"common/unifiedcache.cpp",
|
||||
"common/unifilt.cpp",
|
||||
"common/unifunct.cpp",
|
||||
"common/uniset.cpp",
|
||||
"common/uniset_closure.cpp",
|
||||
"common/uniset_props.cpp",
|
||||
"common/unisetspan.cpp",
|
||||
"common/unistr.cpp",
|
||||
"common/unistr_case.cpp",
|
||||
"common/unistr_case_locale.cpp",
|
||||
"common/unistr_cnv.cpp",
|
||||
"common/unistr_props.cpp",
|
||||
"common/unistr_titlecase_brkiter.cpp",
|
||||
"common/unorm.cpp",
|
||||
"common/unormcmp.cpp",
|
||||
"common/uobject.cpp",
|
||||
"common/uprops.cpp",
|
||||
"common/ures_cnv.cpp",
|
||||
"common/uresbund.cpp",
|
||||
"common/uresdata.cpp",
|
||||
"common/usc_impl.cpp",
|
||||
"common/uscript.cpp",
|
||||
"common/uscript_props.cpp",
|
||||
"common/uset.cpp",
|
||||
"common/uset_props.cpp",
|
||||
"common/usetiter.cpp",
|
||||
# "common/ushape.cpp",
|
||||
"common/usprep.cpp",
|
||||
"common/ustack.cpp",
|
||||
"common/ustr_cnv.cpp",
|
||||
"common/ustr_titlecase_brkiter.cpp",
|
||||
"common/ustr_wcs.cpp",
|
||||
"common/ustrcase.cpp",
|
||||
"common/ustrcase_locale.cpp",
|
||||
"common/ustrenum.cpp",
|
||||
"common/ustrfmt.cpp",
|
||||
"common/ustring.cpp",
|
||||
"common/ustrtrns.cpp",
|
||||
"common/utext.cpp",
|
||||
"common/utf_impl.cpp",
|
||||
"common/util.cpp",
|
||||
"common/util_props.cpp",
|
||||
"common/utrace.cpp",
|
||||
"common/utrie.cpp",
|
||||
"common/utrie2.cpp",
|
||||
"common/utrie2_builder.cpp",
|
||||
"common/utrie_swap.cpp",
|
||||
"common/uts46.cpp",
|
||||
"common/utypes.cpp",
|
||||
"common/uvector.cpp",
|
||||
"common/uvectr32.cpp",
|
||||
"common/uvectr64.cpp",
|
||||
"common/wintz.cpp",
|
||||
"i18n/scriptset.cpp",
|
||||
"i18n/ucln_in.cpp",
|
||||
"i18n/uspoof.cpp",
|
||||
"i18n/uspoof_impl.cpp",
|
||||
]
|
||||
thirdparty_icu_sources = [thirdparty_icu_dir + file for file in thirdparty_icu_sources]
|
||||
|
||||
if env["static_icu_data"]:
|
||||
env_icu.Depends("../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/icudt_godot.dat")
|
||||
env_icu.Command(
|
||||
"../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/icudt_godot.dat", methods.make_icu_data
|
||||
)
|
||||
env.Append(CPPDEFINES=["ICU_STATIC_DATA"])
|
||||
env.Append(CPPPATH=["../../../thirdparty/icu4c/"])
|
||||
else:
|
||||
thirdparty_icu_sources += ["../icu_data/icudata_stub.cpp"]
|
||||
|
||||
env_icu.Append(CPPPATH=["../../../thirdparty/icu4c/common/", "../../../thirdparty/icu4c/i18n/"])
|
||||
env_icu.Append(
|
||||
CPPDEFINES=[
|
||||
"U_STATIC_IMPLEMENTATION",
|
||||
"U_COMMON_IMPLEMENTATION",
|
||||
"UCONFIG_NO_COLLATION",
|
||||
"UCONFIG_NO_CONVERSION",
|
||||
"UCONFIG_NO_FORMATTING",
|
||||
"UCONFIG_NO_SERVICE",
|
||||
"UCONFIG_NO_IDNA",
|
||||
"UCONFIG_NO_FILE_IO",
|
||||
"UCONFIG_NO_TRANSLITERATION",
|
||||
("PKGDATA_MODE", "static"),
|
||||
("U_ENABLE_DYLOAD", 0),
|
||||
("U_HAVE_LIB_SUFFIX", 1),
|
||||
("U_LIB_SUFFIX_C_NAME", "_godot"),
|
||||
]
|
||||
)
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"U_STATIC_IMPLEMENTATION",
|
||||
("U_HAVE_LIB_SUFFIX", 1),
|
||||
("U_LIB_SUFFIX_C_NAME", "_godot"),
|
||||
]
|
||||
)
|
||||
env.Append(CPPPATH=["../../../thirdparty/icu4c/common/", "../../../thirdparty/icu4c/i18n/"])
|
||||
|
||||
if env["platform"] == "windows":
|
||||
env.Append(LIBS=["advapi32"])
|
||||
|
||||
lib = env_icu.Library(f"icu_builtin{env['suffix']}{env['LIBSUFFIX']}", thirdparty_icu_sources)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
env.Append(CPPDEFINES=["GDEXTENSION"])
|
||||
env.Append(CPPPATH=["../"])
|
||||
sources = Glob("../*.cpp")
|
||||
|
||||
if env["platform"] == "macos":
|
||||
methods.write_macos_plist(
|
||||
f"./bin/libtextserver_advanced.macos.{env['target']}.framework",
|
||||
f"libtextserver_advanced.macos.{env['target']}",
|
||||
"org.godotengine.textserver_advanced",
|
||||
"ICU / HarfBuzz / Graphite Text Server",
|
||||
)
|
||||
library = env.SharedLibrary(
|
||||
f"./bin/libtextserver_advanced.macos.{env['target']}.framework/libtextserver_advanced.macos.{env['target']}",
|
||||
source=sources,
|
||||
)
|
||||
else:
|
||||
library = env.SharedLibrary(
|
||||
f"./bin/libtextserver_advanced{env['suffix']}{env['SHLIBSUFFIX']}",
|
||||
source=sources,
|
||||
)
|
||||
|
||||
Default(library)
|
||||
|
||||
methods.prepare_timer()
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
def disable_warnings(self):
|
||||
# 'self' is the environment
|
||||
if self["platform"] == "windows" and not self["use_mingw"]:
|
||||
# We have to remove existing warning level defines before appending /w,
|
||||
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
|
||||
WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]
|
||||
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]
|
||||
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]
|
||||
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]
|
||||
self.AppendUnique(CCFLAGS=["/w"])
|
||||
else:
|
||||
self.AppendUnique(CCFLAGS=["-w"])
|
||||
|
||||
|
||||
def prepare_timer():
|
||||
import atexit
|
||||
import time
|
||||
|
||||
def print_elapsed_time(time_at_start: float):
|
||||
time_elapsed = time.time() - time_at_start
|
||||
time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))
|
||||
time_centiseconds = round((time_elapsed % 1) * 100)
|
||||
print(f"[Time elapsed: {time_formatted}.{time_centiseconds}]")
|
||||
|
||||
atexit.register(print_elapsed_time, time.time())
|
||||
|
||||
|
||||
def make_icu_data(target, source, env):
|
||||
dst = target[0].srcnode().abspath
|
||||
with open(dst, "w", encoding="utf-8", newline="\n") as g:
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
|
||||
g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n")
|
||||
g.write("#ifndef _ICU_DATA_H\n")
|
||||
g.write("#define _ICU_DATA_H\n")
|
||||
g.write('#include "unicode/utypes.h"\n')
|
||||
g.write('#include "unicode/udata.h"\n')
|
||||
g.write('#include "unicode/uversion.h"\n')
|
||||
|
||||
with open(source[0].srcnode().abspath, "rb") as f:
|
||||
buf = f.read()
|
||||
|
||||
g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n")
|
||||
g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n')
|
||||
for i in range(len(buf)):
|
||||
g.write("\t" + str(buf[i]) + ",\n")
|
||||
|
||||
g.write("};\n")
|
||||
g.write("#endif")
|
||||
|
||||
|
||||
def write_macos_plist(target, binary_name, identifier, name):
|
||||
import os
|
||||
|
||||
os.makedirs(f"{target}/Resource/", exist_ok=True)
|
||||
with open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(f"""\
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{binary_name}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{name}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.14</string>
|
||||
</dict>
|
||||
</plist>
|
||||
""")
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
[configuration]
|
||||
|
||||
entry_symbol = "textserver_advanced_init"
|
||||
compatibility_minimum = 4.1
|
||||
|
||||
[libraries]
|
||||
|
||||
linux.x86_64.debug = "bin/libtextserver_advanced.linux.template_debug.x86_64.so"
|
||||
linux.x86_64.release = "bin/libtextserver_advanced.linux.template_release.x86_64.so"
|
||||
linux.x86_32.debug = "bin/libtextserver_advanced.linux.template_debug.x86_32.so"
|
||||
linux.x86_32.release = "bin/libtextserver_advanced.linux.template_release.x86_32.so"
|
||||
linux.arm64.debug = "bin/libtextserver_advanced.linux.template_debug.arm64.so"
|
||||
linux.arm64.release = "bin/libtextserver_advanced.linux.template_release.arm64.so"
|
||||
linux.rv64.debug = "bin/libtextserver_advanced.linux.template_debug.rv64.so"
|
||||
linux.rv64.release = "bin/libtextserver_advanced.linux.template_release.rv64.so"
|
||||
|
||||
windows.x86_64.debug = "bin/libtextserver_advanced.windows.template_debug.x86_64.dll"
|
||||
windows.x86_64.release = "bin/libtextserver_advanced.windows.template_release.x86_64.dll"
|
||||
windows.x86_32.debug = "bin/libtextserver_advanced.windows.template_debug.x86_32.dll"
|
||||
windows.x86_32.release = "bin/libtextserver_advanced.windows.template_release.x86_32.dll"
|
||||
windows.arm64.debug = "bin/libtextserver_advanced.windows.template_debug.arm64.dll"
|
||||
windows.arm64.release = "bin/libtextserver_advanced.windows.template_release.arm64.dll"
|
||||
|
||||
macos.debug = "bin/libtextserver_advanced.macos.template_debug.framework"
|
||||
macos.release = "bin/libtextserver_advanced.macos.template_release.framework"
|
||||
|
|
@ -53,27 +53,3 @@ void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/core/memory.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
extern "C" {
|
||||
|
||||
GDExtensionBool GDE_EXPORT textserver_advanced_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
} // ! extern "C"
|
||||
|
||||
#endif // ! GDEXTENSION
|
||||
|
|
|
|||
|
|
@ -30,12 +30,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
using namespace godot;
|
||||
#elif defined(GODOT_MODULE)
|
||||
#include "modules/register_module_types.h"
|
||||
#endif
|
||||
|
||||
void initialize_text_server_adv_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level);
|
||||
|
|
|
|||
|
|
@ -30,23 +30,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
|
||||
// Headers for building as GDExtension plug-in.
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/templates/vector.hpp>
|
||||
#include <godot_cpp/variant/string.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
|
||||
// Headers for building as built-in module.
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/vector.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/uloc.h>
|
||||
#include <unicode/uscript.h>
|
||||
|
|
|
|||
|
|
@ -30,22 +30,6 @@
|
|||
|
||||
#include "text_server_adv.h"
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/classes/file_access.hpp>
|
||||
#include <godot_cpp/classes/os.hpp>
|
||||
#include <godot_cpp/classes/project_settings.hpp>
|
||||
#include <godot_cpp/classes/translation_server.hpp>
|
||||
#include <godot_cpp/core/error_macros.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get_setting_with_override(m_var)
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/file_access.h"
|
||||
|
|
@ -57,8 +41,6 @@ using namespace godot;
|
|||
|
||||
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
|
||||
|
||||
#endif
|
||||
|
||||
// Built-in ICU data.
|
||||
|
||||
#ifdef ICU_STATIC_DATA
|
||||
|
|
@ -380,11 +362,7 @@ bool TextServerAdvanced::_has_feature(Feature p_feature) const {
|
|||
}
|
||||
|
||||
String TextServerAdvanced::_get_name() const {
|
||||
#ifdef GDEXTENSION
|
||||
return "ICU / HarfBuzz / Graphite (GDExtension)";
|
||||
#elif defined(GODOT_MODULE)
|
||||
return "ICU / HarfBuzz / Graphite (Built-in)";
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t TextServerAdvanced::_get_features() const {
|
||||
|
|
@ -5756,12 +5734,7 @@ RID TextServerAdvanced::_find_sys_font_for_text(const RID &p_fdef, const String
|
|||
|
||||
String locale = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
|
||||
PackedStringArray fallback_font_name = OS::get_singleton()->get_system_font_path_for_text(font_name, p_text, locale, p_script_code, font_weight, font_stretch, font_style & TextServer::FONT_ITALIC);
|
||||
#ifdef GDEXTENSION
|
||||
for (int fb = 0; fb < fallback_font_name.size(); fb++) {
|
||||
const String &E = fallback_font_name[fb];
|
||||
#elif defined(GODOT_MODULE)
|
||||
for (const String &E : fallback_font_name) {
|
||||
#endif
|
||||
SystemFontKey key = SystemFontKey(E, font_style & TextServer::FONT_ITALIC, font_weight, font_stretch, p_fdef, this);
|
||||
if (system_fonts.has(key)) {
|
||||
const SystemFontCache &sysf_cache = system_fonts[key];
|
||||
|
|
@ -7680,11 +7653,7 @@ String TextServerAdvanced::_strip_diacritics(const String &p_string) const {
|
|||
String result;
|
||||
for (int i = 0; i < normalized_string.length(); i++) {
|
||||
if (u_getCombiningClass(normalized_string[i]) == 0) {
|
||||
#ifdef GDEXTENSION
|
||||
result = result + String::chr(normalized_string[i]);
|
||||
#elif defined(GODOT_MODULE)
|
||||
result = result + normalized_string[i];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -37,50 +37,6 @@
|
|||
|
||||
#include "script_iterator.h"
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/ext_wrappers.gen.inc>
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
|
||||
#include <godot_cpp/variant/array.hpp>
|
||||
#include <godot_cpp/variant/dictionary.hpp>
|
||||
#include <godot_cpp/variant/packed_int32_array.hpp>
|
||||
#include <godot_cpp/variant/packed_string_array.hpp>
|
||||
#include <godot_cpp/variant/packed_vector2_array.hpp>
|
||||
#include <godot_cpp/variant/rect2.hpp>
|
||||
#include <godot_cpp/variant/rid.hpp>
|
||||
#include <godot_cpp/variant/string.hpp>
|
||||
#include <godot_cpp/variant/typed_array.hpp>
|
||||
#include <godot_cpp/variant/vector2.hpp>
|
||||
#include <godot_cpp/variant/vector2i.hpp>
|
||||
|
||||
#include <godot_cpp/classes/text_server.hpp>
|
||||
#include <godot_cpp/classes/text_server_extension.hpp>
|
||||
#include <godot_cpp/classes/text_server_manager.hpp>
|
||||
|
||||
#include <godot_cpp/classes/caret_info.hpp>
|
||||
#include <godot_cpp/classes/global_constants_binds.hpp>
|
||||
#include <godot_cpp/classes/glyph.hpp>
|
||||
#include <godot_cpp/classes/image.hpp>
|
||||
#include <godot_cpp/classes/image_texture.hpp>
|
||||
#include <godot_cpp/classes/ref.hpp>
|
||||
#include <godot_cpp/classes/worker_thread_pool.hpp>
|
||||
|
||||
#include <godot_cpp/templates/hash_map.hpp>
|
||||
#include <godot_cpp/templates/hash_set.hpp>
|
||||
#include <godot_cpp/templates/rid_owner.hpp>
|
||||
#include <godot_cpp/templates/safe_refcount.hpp>
|
||||
#include <godot_cpp/templates/vector.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/extension/ext_wrappers.gen.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
|
|
@ -90,8 +46,6 @@ using namespace godot;
|
|||
|
||||
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
|
||||
|
||||
#endif
|
||||
|
||||
// Thirdparty headers.
|
||||
|
||||
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wshadow")
|
||||
|
|
|
|||
|
|
@ -30,19 +30,6 @@
|
|||
|
||||
#include "thorvg_svg_in_ot.h"
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/classes/xml_parser.hpp>
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/templates/vector.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "core/os/memory.h"
|
||||
|
|
@ -52,7 +39,6 @@ using namespace godot;
|
|||
#include "core/variant/variant.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For svg, freetype.
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SVG_ENABLED
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
|
|
@ -180,11 +166,7 @@ FT_Error tvg_svg_in_ot_preset_slot(FT_GlyphSlot p_slot, FT_Bool p_cache, FT_Poin
|
|||
if (!is_in_defs && parser->has_attribute("id")) {
|
||||
const String &gl_name = parser->get_named_attribute_value("id");
|
||||
if (gl_name.begins_with("glyph")) {
|
||||
#ifdef GDEXTENSION
|
||||
int dot_pos = gl_name.find(".");
|
||||
#else
|
||||
int dot_pos = gl_name.find_char('.');
|
||||
#endif // GDEXTENSION
|
||||
int64_t gl_idx = gl_name.substr(5, (dot_pos > 0) ? dot_pos - 5 : -1).to_int();
|
||||
|
||||
TVG_NodeCache node_cache = TVG_NodeCache();
|
||||
|
|
|
|||
|
|
@ -30,25 +30,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/templates/hash_map.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For svg, freetype.
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SVG_ENABLED
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
|
|
|
|||
|
|
@ -1,312 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# ruff: noqa: F821
|
||||
|
||||
import methods
|
||||
|
||||
# For the reference:
|
||||
# - CCFLAGS are compilation flags shared between C and C++
|
||||
# - CFLAGS are for C-specific compilation flags
|
||||
# - CXXFLAGS are for C++-specific compilation flags
|
||||
# - CPPFLAGS are for pre-processor flags
|
||||
# - CPPDEFINES are for pre-processor defines
|
||||
# - LINKFLAGS are for linking flags
|
||||
|
||||
env = SConscript("./godot-cpp/SConstruct")
|
||||
env.__class__.disable_warnings = methods.disable_warnings
|
||||
|
||||
opts = Variables([], ARGUMENTS)
|
||||
opts.Add(BoolVariable("brotli_enabled", "Use Brotli library", True))
|
||||
opts.Add(BoolVariable("freetype_enabled", "Use FreeType library", True))
|
||||
opts.Add(BoolVariable("msdfgen_enabled", "Use MSDFgen library (require FreeType)", True))
|
||||
opts.Add(BoolVariable("thorvg_enabled", "Use ThorVG library (require FreeType)", True))
|
||||
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
|
||||
|
||||
opts.Update(env)
|
||||
|
||||
# ThorVG
|
||||
if env["thorvg_enabled"] and env["freetype_enabled"]:
|
||||
env_tvg = env.Clone()
|
||||
env_tvg.disable_warnings()
|
||||
|
||||
thirdparty_tvg_dir = "../../../thirdparty/thorvg/"
|
||||
thirdparty_tvg_sources = [
|
||||
# common
|
||||
"src/common/tvgCompressor.cpp",
|
||||
"src/common/tvgLines.cpp",
|
||||
"src/common/tvgMath.cpp",
|
||||
"src/common/tvgStr.cpp",
|
||||
# SVG parser
|
||||
"src/loaders/svg/tvgSvgCssStyle.cpp",
|
||||
"src/loaders/svg/tvgSvgLoader.cpp",
|
||||
"src/loaders/svg/tvgSvgPath.cpp",
|
||||
"src/loaders/svg/tvgSvgSceneBuilder.cpp",
|
||||
"src/loaders/svg/tvgSvgUtil.cpp",
|
||||
"src/loaders/svg/tvgXmlParser.cpp",
|
||||
"src/loaders/raw/tvgRawLoader.cpp",
|
||||
# image loaders
|
||||
"src/loaders/external_png/tvgPngLoader.cpp",
|
||||
"src/loaders/jpg/tvgJpgd.cpp",
|
||||
"src/loaders/jpg/tvgJpgLoader.cpp",
|
||||
# renderer common
|
||||
"src/renderer/tvgAccessor.cpp",
|
||||
# "src/renderer/tvgAnimation.cpp",
|
||||
"src/renderer/tvgCanvas.cpp",
|
||||
"src/renderer/tvgFill.cpp",
|
||||
# "src/renderer/tvgGlCanvas.cpp",
|
||||
"src/renderer/tvgInitializer.cpp",
|
||||
"src/renderer/tvgLoader.cpp",
|
||||
"src/renderer/tvgPaint.cpp",
|
||||
"src/renderer/tvgPicture.cpp",
|
||||
"src/renderer/tvgRender.cpp",
|
||||
# "src/renderer/tvgSaver.cpp",
|
||||
"src/renderer/tvgScene.cpp",
|
||||
"src/renderer/tvgShape.cpp",
|
||||
"src/renderer/tvgSwCanvas.cpp",
|
||||
"src/renderer/tvgTaskScheduler.cpp",
|
||||
"src/renderer/tvgText.cpp",
|
||||
# "src/renderer/tvgWgCanvas.cpp",
|
||||
# renderer sw_engine
|
||||
"src/renderer/sw_engine/tvgSwFill.cpp",
|
||||
"src/renderer/sw_engine/tvgSwImage.cpp",
|
||||
"src/renderer/sw_engine/tvgSwMath.cpp",
|
||||
"src/renderer/sw_engine/tvgSwMemPool.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRaster.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRenderer.cpp",
|
||||
"src/renderer/sw_engine/tvgSwRle.cpp",
|
||||
"src/renderer/sw_engine/tvgSwShape.cpp",
|
||||
"src/renderer/sw_engine/tvgSwStroke.cpp",
|
||||
]
|
||||
thirdparty_tvg_sources = [thirdparty_tvg_dir + file for file in thirdparty_tvg_sources]
|
||||
|
||||
env_tvg.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/thorvg/inc",
|
||||
"../../../thirdparty/thorvg/src/common",
|
||||
"../../../thirdparty/thorvg/src/renderer",
|
||||
"../../../thirdparty/thorvg/src/renderer/sw_engine",
|
||||
"../../../thirdparty/thorvg/src/loaders/svg",
|
||||
"../../../thirdparty/thorvg/src/loaders/raw",
|
||||
"../../../thirdparty/thorvg/src/loaders/external_png",
|
||||
"../../../thirdparty/thorvg/src/loaders/jpg",
|
||||
"../../../thirdparty/libpng",
|
||||
]
|
||||
)
|
||||
|
||||
# Enable ThorVG static object linking.
|
||||
env_tvg.Append(CPPDEFINES=["TVG_STATIC"])
|
||||
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
"../../../thirdparty/thorvg/inc",
|
||||
"../../../thirdparty/thorvg/src/common",
|
||||
"../../../thirdparty/thorvg/src/renderer",
|
||||
]
|
||||
)
|
||||
env.Append(CPPDEFINES=["MODULE_SVG_ENABLED"])
|
||||
|
||||
lib = env_tvg.Library(
|
||||
f"tvg_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_tvg_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# MSDFGEN
|
||||
if env["msdfgen_enabled"] and env["freetype_enabled"]:
|
||||
env_msdfgen = env.Clone()
|
||||
env_msdfgen.disable_warnings()
|
||||
|
||||
thirdparty_msdfgen_dir = "../../../thirdparty/msdfgen/"
|
||||
thirdparty_msdfgen_sources = [
|
||||
"core/Contour.cpp",
|
||||
"core/DistanceMapping.cpp",
|
||||
"core/EdgeHolder.cpp",
|
||||
"core/MSDFErrorCorrection.cpp",
|
||||
"core/Projection.cpp",
|
||||
"core/Scanline.cpp",
|
||||
"core/Shape.cpp",
|
||||
"core/contour-combiners.cpp",
|
||||
"core/convergent-curve-ordering.cpp",
|
||||
"core/edge-coloring.cpp",
|
||||
"core/edge-segments.cpp",
|
||||
"core/edge-selectors.cpp",
|
||||
"core/equation-solver.cpp",
|
||||
# "core/export-svg.cpp",
|
||||
"core/msdf-error-correction.cpp",
|
||||
"core/msdfgen.cpp",
|
||||
"core/rasterization.cpp",
|
||||
"core/render-sdf.cpp",
|
||||
# "core/save-bmp.cpp",
|
||||
# "core/save-fl32.cpp",
|
||||
# "core/save-rgba.cpp",
|
||||
# "core/save-tiff.cpp",
|
||||
"core/sdf-error-estimation.cpp",
|
||||
"core/shape-description.cpp",
|
||||
]
|
||||
thirdparty_msdfgen_sources = [thirdparty_msdfgen_dir + file for file in thirdparty_msdfgen_sources]
|
||||
|
||||
env_msdfgen.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")])
|
||||
env_msdfgen.Append(CPPPATH=["../../../thirdparty/freetype/include", "../../../thirdparty/msdfgen"])
|
||||
env.Append(CPPPATH=["../../../thirdparty/msdfgen"])
|
||||
env.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")])
|
||||
env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"])
|
||||
|
||||
lib = env_msdfgen.Library(
|
||||
f"msdfgen_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_msdfgen_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
# FreeType
|
||||
if env["freetype_enabled"]:
|
||||
env_freetype = env.Clone()
|
||||
env_freetype.disable_warnings()
|
||||
|
||||
thirdparty_freetype_dir = "../../../thirdparty/freetype/"
|
||||
thirdparty_freetype_sources = [
|
||||
"src/autofit/autofit.c",
|
||||
"src/base/ftbase.c",
|
||||
"src/base/ftbbox.c",
|
||||
"src/base/ftbdf.c",
|
||||
"src/base/ftbitmap.c",
|
||||
"src/base/ftcid.c",
|
||||
"src/base/ftdebug.c",
|
||||
"src/base/ftfstype.c",
|
||||
"src/base/ftgasp.c",
|
||||
"src/base/ftglyph.c",
|
||||
"src/base/ftgxval.c",
|
||||
"src/base/ftinit.c",
|
||||
"src/base/ftmm.c",
|
||||
"src/base/ftotval.c",
|
||||
"src/base/ftpatent.c",
|
||||
"src/base/ftpfr.c",
|
||||
"src/base/ftstroke.c",
|
||||
"src/base/ftsynth.c",
|
||||
"src/base/ftsystem.c",
|
||||
"src/base/fttype1.c",
|
||||
"src/base/ftwinfnt.c",
|
||||
"src/bdf/bdf.c",
|
||||
"src/bzip2/ftbzip2.c",
|
||||
"src/cache/ftcache.c",
|
||||
"src/cff/cff.c",
|
||||
"src/cid/type1cid.c",
|
||||
"src/gxvalid/gxvalid.c",
|
||||
"src/gzip/ftgzip.c",
|
||||
"src/lzw/ftlzw.c",
|
||||
"src/otvalid/otvalid.c",
|
||||
"src/pcf/pcf.c",
|
||||
"src/pfr/pfr.c",
|
||||
"src/psaux/psaux.c",
|
||||
"src/pshinter/pshinter.c",
|
||||
"src/psnames/psnames.c",
|
||||
"src/raster/raster.c",
|
||||
"src/sdf/sdf.c",
|
||||
"src/svg/svg.c",
|
||||
"src/smooth/smooth.c",
|
||||
"src/truetype/truetype.c",
|
||||
"src/type1/type1.c",
|
||||
"src/type42/type42.c",
|
||||
"src/winfonts/winfnt.c",
|
||||
"src/sfnt/sfnt.c",
|
||||
]
|
||||
thirdparty_freetype_sources = [thirdparty_freetype_dir + file for file in thirdparty_freetype_sources]
|
||||
|
||||
thirdparty_png_dir = "../../../thirdparty/libpng/"
|
||||
thirdparty_png_sources = [
|
||||
"png.c",
|
||||
"pngerror.c",
|
||||
"pngget.c",
|
||||
"pngmem.c",
|
||||
"pngpread.c",
|
||||
"pngread.c",
|
||||
"pngrio.c",
|
||||
"pngrtran.c",
|
||||
"pngrutil.c",
|
||||
"pngset.c",
|
||||
"pngtrans.c",
|
||||
"pngwio.c",
|
||||
"pngwrite.c",
|
||||
"pngwtran.c",
|
||||
"pngwutil.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_png_dir + file for file in thirdparty_png_sources]
|
||||
|
||||
thirdparty_zlib_dir = "../../../thirdparty/zlib/"
|
||||
thirdparty_zlib_sources = [
|
||||
"adler32.c",
|
||||
"compress.c",
|
||||
"crc32.c",
|
||||
"deflate.c",
|
||||
"inffast.c",
|
||||
"inflate.c",
|
||||
"inftrees.c",
|
||||
"trees.c",
|
||||
"uncompr.c",
|
||||
"zutil.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
|
||||
|
||||
if env["brotli_enabled"]:
|
||||
thirdparty_brotli_dir = "../../../thirdparty/brotli/"
|
||||
thirdparty_brotli_sources = [
|
||||
"common/constants.c",
|
||||
"common/context.c",
|
||||
"common/dictionary.c",
|
||||
"common/platform.c",
|
||||
"common/shared_dictionary.c",
|
||||
"common/transform.c",
|
||||
"dec/bit_reader.c",
|
||||
"dec/decode.c",
|
||||
"dec/huffman.c",
|
||||
"dec/state.c",
|
||||
]
|
||||
thirdparty_freetype_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
|
||||
env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
env.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
|
||||
env_freetype.Append(CPPPATH=[thirdparty_freetype_dir + "/include", thirdparty_zlib_dir, thirdparty_png_dir])
|
||||
env.Append(CPPPATH=[thirdparty_freetype_dir + "/include"])
|
||||
|
||||
env_freetype.Append(
|
||||
CPPDEFINES=[
|
||||
"FT2_BUILD_LIBRARY",
|
||||
"FT_CONFIG_OPTION_USE_PNG",
|
||||
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
|
||||
]
|
||||
)
|
||||
if env.dev_build:
|
||||
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
|
||||
|
||||
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
|
||||
|
||||
lib = env_freetype.Library(
|
||||
f"freetype_builtin{env['suffix']}{env['LIBSUFFIX']}",
|
||||
thirdparty_freetype_sources,
|
||||
)
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
|
||||
env.Append(CPPDEFINES=["GDEXTENSION"])
|
||||
env.Append(CPPPATH=["../"])
|
||||
sources = Glob("../*.cpp")
|
||||
|
||||
if env["platform"] == "macos":
|
||||
methods.write_macos_plist(
|
||||
f"./bin/libtextserver_fallback.macos.{env['target']}.framework",
|
||||
f"libtextserver_fallback.macos.{env['target']}",
|
||||
"org.godotengine.textserver_fallback",
|
||||
"Fallback Text Server",
|
||||
)
|
||||
library = env.SharedLibrary(
|
||||
f"./bin/libtextserver_fallback.macos.{env['target']}.framework/libtextserver_fallback.macos.{env['target']}",
|
||||
source=sources,
|
||||
)
|
||||
else:
|
||||
library = env.SharedLibrary(
|
||||
f"./bin/libtextserver_fallback{env['suffix']}{env['SHLIBSUFFIX']}",
|
||||
source=sources,
|
||||
)
|
||||
|
||||
Default(library)
|
||||
|
||||
methods.prepare_timer()
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
def disable_warnings(self):
|
||||
# 'self' is the environment
|
||||
if self["platform"] == "windows" and not self["use_mingw"]:
|
||||
# We have to remove existing warning level defines before appending /w,
|
||||
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
|
||||
WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]
|
||||
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]
|
||||
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]
|
||||
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]
|
||||
self.AppendUnique(CCFLAGS=["/w"])
|
||||
else:
|
||||
self.AppendUnique(CCFLAGS=["-w"])
|
||||
|
||||
|
||||
def prepare_timer():
|
||||
import atexit
|
||||
import time
|
||||
|
||||
def print_elapsed_time(time_at_start: float):
|
||||
time_elapsed = time.time() - time_at_start
|
||||
time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))
|
||||
time_centiseconds = round((time_elapsed % 1) * 100)
|
||||
print(f"[Time elapsed: {time_formatted}.{time_centiseconds}]")
|
||||
|
||||
atexit.register(print_elapsed_time, time.time())
|
||||
|
||||
|
||||
def write_macos_plist(target, binary_name, identifier, name):
|
||||
import os
|
||||
|
||||
os.makedirs(f"{target}/Resource/", exist_ok=True)
|
||||
with open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(f"""\
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{binary_name}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{name}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.14</string>
|
||||
</dict>
|
||||
</plist>
|
||||
""")
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
[configuration]
|
||||
|
||||
entry_symbol = "textserver_fallback_init"
|
||||
|
||||
[libraries]
|
||||
|
||||
linux.x86_64.debug = "bin/libtextserver_fallback.linux.template_debug.x86_64.so"
|
||||
linux.x86_64.release = "bin/libtextserver_fallback.linux.template_release.x86_64.so"
|
||||
linux.x86_32.debug = "bin/libtextserver_fallback.linux.template_debug.x86_32.so"
|
||||
linux.x86_32.release = "bin/libtextserver_fallback.linux.template_release.x86_32.so"
|
||||
linux.arm64.debug = "bin/libtextserver_fallback.linux.template_debug.arm64.so"
|
||||
linux.arm64.release = "bin/libtextserver_fallback.linux.template_release.arm64.so"
|
||||
linux.rv64.debug = "bin/libtextserver_fallback.linux.template_debug.rv64.so"
|
||||
linux.rv64.release = "bin/libtextserver_fallback.linux.template_release.rv64.so"
|
||||
|
||||
windows.x86_64.debug = "bin/libtextserver_fallback.windows.template_debug.x86_64.dll"
|
||||
windows.x86_64.release = "bin/libtextserver_fallback.windows.template_release.x86_64.dll"
|
||||
windows.x86_32.debug = "bin/libtextserver_fallback.windows.template_debug.x86_32.dll"
|
||||
windows.x86_32.release = "bin/libtextserver_fallback.windows.template_release.x86_32.dll"
|
||||
windows.arm64.debug = "bin/libtextserver_fallback.windows.template_debug.arm64.dll"
|
||||
windows.arm64.release = "bin/libtextserver_fallback.windows.template_release.arm64.dll"
|
||||
|
||||
macos.debug = "bin/libtextserver_fallback.macos.template_debug.framework"
|
||||
macos.release = "bin/libtextserver_fallback.macos.template_release.framework"
|
||||
|
|
@ -53,27 +53,3 @@ void uninitialize_text_server_fb_module(ModuleInitializationLevel p_level) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/core/memory.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
extern "C" {
|
||||
|
||||
GDExtensionBool GDE_EXPORT textserver_fallback_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||
|
||||
init_obj.register_initializer(&initialize_text_server_fb_module);
|
||||
init_obj.register_terminator(&uninitialize_text_server_fb_module);
|
||||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SERVERS);
|
||||
|
||||
return init_obj.init();
|
||||
}
|
||||
|
||||
} // ! extern "C"
|
||||
|
||||
#endif // ! GDEXTENSION
|
||||
|
|
|
|||
|
|
@ -30,12 +30,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
using namespace godot;
|
||||
#elif defined(GODOT_MODULE)
|
||||
#include "modules/register_module_types.h"
|
||||
#endif
|
||||
|
||||
void initialize_text_server_fb_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_text_server_fb_module(ModuleInitializationLevel p_level);
|
||||
|
|
|
|||
|
|
@ -30,24 +30,6 @@
|
|||
|
||||
#include "text_server_fb.h"
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/classes/file_access.hpp>
|
||||
#include <godot_cpp/classes/os.hpp>
|
||||
#include <godot_cpp/classes/project_settings.hpp>
|
||||
#include <godot_cpp/classes/translation_server.hpp>
|
||||
#include <godot_cpp/core/error_macros.hpp>
|
||||
|
||||
#define OT_TAG(m_c1, m_c2, m_c3, m_c4) ((int32_t)((((uint32_t)(m_c1) & 0xff) << 24) | (((uint32_t)(m_c2) & 0xff) << 16) | (((uint32_t)(m_c3) & 0xff) << 8) | ((uint32_t)(m_c4) & 0xff)))
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get_setting_with_override(m_var)
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/file_access.h"
|
||||
|
|
@ -58,8 +40,6 @@ using namespace godot;
|
|||
|
||||
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
|
||||
|
||||
#endif
|
||||
|
||||
// Thirdparty headers.
|
||||
|
||||
#ifdef MODULE_MSDFGEN_ENABLED
|
||||
|
|
@ -104,11 +84,7 @@ bool TextServerFallback::_has_feature(Feature p_feature) const {
|
|||
}
|
||||
|
||||
String TextServerFallback::_get_name() const {
|
||||
#ifdef GDEXTENSION
|
||||
return "Fallback (GDExtension)";
|
||||
#elif defined(GODOT_MODULE)
|
||||
return "Fallback (Built-in)";
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t TextServerFallback::_get_features() const {
|
||||
|
|
@ -4442,12 +4418,7 @@ RID TextServerFallback::_find_sys_font_for_text(const RID &p_fdef, const String
|
|||
|
||||
String locale = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language;
|
||||
PackedStringArray fallback_font_name = OS::get_singleton()->get_system_font_path_for_text(font_name, p_text, locale, p_script_code, font_weight, font_stretch, font_style & TextServer::FONT_ITALIC);
|
||||
#ifdef GDEXTENSION
|
||||
for (int fb = 0; fb < fallback_font_name.size(); fb++) {
|
||||
const String &E = fallback_font_name[fb];
|
||||
#elif defined(GODOT_MODULE)
|
||||
for (const String &E : fallback_font_name) {
|
||||
#endif
|
||||
SystemFontKey key = SystemFontKey(E, font_style & TextServer::FONT_ITALIC, font_weight, font_stretch, p_fdef, this);
|
||||
if (system_fonts.has(key)) {
|
||||
const SystemFontCache &sysf_cache = system_fonts[key];
|
||||
|
|
@ -5203,11 +5174,7 @@ PackedInt32Array TextServerFallback::_shaped_text_get_character_breaks(const RID
|
|||
if (size > 0) {
|
||||
ret.resize(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
#ifdef GDEXTENSION
|
||||
ret[i] = i + 1 + sd->start;
|
||||
#else
|
||||
ret.write[i] = i + 1 + sd->start;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -35,50 +35,6 @@
|
|||
/* BiDi, shaping and advanced font features support. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/ext_wrappers.gen.inc>
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
|
||||
#include <godot_cpp/variant/array.hpp>
|
||||
#include <godot_cpp/variant/dictionary.hpp>
|
||||
#include <godot_cpp/variant/packed_int32_array.hpp>
|
||||
#include <godot_cpp/variant/packed_string_array.hpp>
|
||||
#include <godot_cpp/variant/packed_vector2_array.hpp>
|
||||
#include <godot_cpp/variant/rect2.hpp>
|
||||
#include <godot_cpp/variant/rid.hpp>
|
||||
#include <godot_cpp/variant/string.hpp>
|
||||
#include <godot_cpp/variant/typed_array.hpp>
|
||||
#include <godot_cpp/variant/vector2.hpp>
|
||||
#include <godot_cpp/variant/vector2i.hpp>
|
||||
|
||||
#include <godot_cpp/classes/text_server.hpp>
|
||||
#include <godot_cpp/classes/text_server_extension.hpp>
|
||||
#include <godot_cpp/classes/text_server_manager.hpp>
|
||||
|
||||
#include <godot_cpp/classes/caret_info.hpp>
|
||||
#include <godot_cpp/classes/global_constants_binds.hpp>
|
||||
#include <godot_cpp/classes/glyph.hpp>
|
||||
#include <godot_cpp/classes/image.hpp>
|
||||
#include <godot_cpp/classes/image_texture.hpp>
|
||||
#include <godot_cpp/classes/ref.hpp>
|
||||
#include <godot_cpp/classes/worker_thread_pool.hpp>
|
||||
|
||||
#include <godot_cpp/templates/hash_map.hpp>
|
||||
#include <godot_cpp/templates/hash_set.hpp>
|
||||
#include <godot_cpp/templates/rid_owner.hpp>
|
||||
#include <godot_cpp/templates/safe_refcount.hpp>
|
||||
#include <godot_cpp/templates/vector.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/extension/ext_wrappers.gen.h"
|
||||
#include "core/object/worker_thread_pool.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
|
|
@ -89,8 +45,6 @@ using namespace godot;
|
|||
|
||||
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
|
||||
|
||||
#endif
|
||||
|
||||
// Thirdparty headers.
|
||||
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
|
|
|
|||
|
|
@ -30,19 +30,6 @@
|
|||
|
||||
#include "thorvg_svg_in_ot.h"
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/classes/xml_parser.hpp>
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/templates/vector.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "core/os/memory.h"
|
||||
|
|
@ -51,7 +38,6 @@ using namespace godot;
|
|||
#include "core/variant/variant.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For svg, freetype.
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SVG_ENABLED
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
|
|
@ -179,11 +165,7 @@ FT_Error tvg_svg_in_ot_preset_slot(FT_GlyphSlot p_slot, FT_Bool p_cache, FT_Poin
|
|||
if (!is_in_defs && parser->has_attribute("id")) {
|
||||
const String &gl_name = parser->get_named_attribute_value("id");
|
||||
if (gl_name.begins_with("glyph")) {
|
||||
#ifdef GDEXTENSION
|
||||
int dot_pos = gl_name.find(".");
|
||||
#else
|
||||
int dot_pos = gl_name.find_char('.');
|
||||
#endif // GDEXTENSION
|
||||
int64_t gl_idx = gl_name.substr(5, (dot_pos > 0) ? dot_pos - 5 : -1).to_int();
|
||||
|
||||
TVG_NodeCache node_cache = TVG_NodeCache();
|
||||
|
|
|
|||
|
|
@ -30,25 +30,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef GDEXTENSION
|
||||
// Headers for building as GDExtension plug-in.
|
||||
|
||||
#include <godot_cpp/core/mutex_lock.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/templates/hash_map.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
#elif defined(GODOT_MODULE)
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For svg, freetype.
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SVG_ENABLED
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue