Make it easier to change the bundled font.

This makes it easier to play CJK games, since the embedded font must have
the glyphs necessary to display the game text.

The qmake portion is untested, but should hopefully not break the build.

See also #135
This commit is contained in:
Mook 2015-10-25 21:27:20 -07:00
parent 7bf6eca362
commit 8d5c841648
4 changed files with 16 additions and 10 deletions

View file

@ -1 +1,4 @@
#include "liberation.ttf.xxd"
#define BUNDLED_FONT_NAME BUNDLED_FONT.ttf.xxd
#define STRINGIFY(x) #x
#define INCLUDE_FILE(x) STRINGIFY(x)
#include INCLUDE_FILE(BUNDLED_FONT_NAME)

View file

@ -33,17 +33,15 @@
#include <SDL_ttf.h>
#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
#define BUNDLED_FONT_DECL(FONT) \
extern unsigned char BUNDLED_FONT_D(FONT)[]; \
extern unsigned int BUNDLED_FONT_L(FONT);
BUNDLED_FONT_DECL(BUNDLED_FONT)
// Go fuck yourself CPP
#define BNDL_F_D(f) BUNDLED_FONT_D(f)
#define BNDL_F_L(f) BUNDLED_FONT_L(f)