From 4daff93e29fd09ac317952c2008ab933d85259d0 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 16 Aug 2014 23:20:33 +0200 Subject: [PATCH] Put bundled font into its own translation unit --- CMakeLists.txt | 1 + mkxp.pro | 3 ++- src/bundledfont.cpp | 1 + src/font.cpp | 8 ++++++-- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/bundledfont.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f38c37..95314fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,7 @@ set(MAIN_SOURCE src/alstream.cpp src/audiostream.cpp src/rgssad.cpp + src/bundledfont.cpp ) source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS}) diff --git a/mkxp.pro b/mkxp.pro index e50d5ab..3cc2454 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -176,7 +176,8 @@ SOURCES += \ src/sdlsoundsource.cpp \ src/alstream.cpp \ src/audiostream.cpp \ - src/rgssad.cpp + src/rgssad.cpp \ + src/bundledfont.cpp EMBED = \ shader/transSimple.frag \ diff --git a/src/bundledfont.cpp b/src/bundledfont.cpp new file mode 100644 index 0000000..0731a01 --- /dev/null +++ b/src/bundledfont.cpp @@ -0,0 +1 @@ +#include "../liberation.ttf.xxd" diff --git a/src/font.cpp b/src/font.cpp index 2e6528c..841eafc 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -31,12 +31,16 @@ #include #include -#include "../liberation.ttf.xxd" - #include #define BUNDLED_FONT liberation +#define BUNDLED_FONT_DECL(FONT) \ + extern unsigned char assets_##FONT##_ttf[]; \ + extern unsigned int assets_##FONT##_ttf_len; + +BUNDLED_FONT_DECL(liberation) + #define BUNDLED_FONT_D(f) assets_## f ##_ttf #define BUNDLED_FONT_L(f) assets_## f ##_ttf_len