From cf75cbcad215520813ef314f31454b0da3e5726a Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 17 Mar 2020 21:14:15 +0000 Subject: [PATCH] Don't embed font in executable Creating a Japanese build would require 4GB+ of RAM because of this. It's about time it got removed. It was a silly idea anyway. --- CMakeLists.txt | 4 ++-- Makefile | 2 -- .../data/Font}/LICENSE-LiberationMono.txt | 0 .../data/Font/font | Bin .../data/Font}/LICENSE-NotoSansMonoCJKjp.txt | 0 .../data/Font/font | Bin src/Draw.cpp | 6 +++--- src/Resource.cpp | 10 ---------- 8 files changed, 5 insertions(+), 17 deletions(-) rename {assets/resources/FONT => game_english/data/Font}/LICENSE-LiberationMono.txt (100%) rename assets/resources/FONT/LiberationMono.ttf => game_english/data/Font/font (100%) rename {assets/resources/FONT => game_japanese/data/Font}/LICENSE-NotoSansMonoCJKjp.txt (100%) rename assets/resources/FONT/NotoSansMonoCJKjp.otf => game_japanese/data/Font/font (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb743173..580142ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,11 +243,11 @@ list(APPEND CMAKE_MODULE_PATH if(JAPANESE) set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/game_japanese") - list(APPEND RESOURCES "BITMAP/pixel_jp.bmp" "FONT/NotoSansMonoCJKjp.otf") + list(APPEND RESOURCES "BITMAP/pixel_jp.bmp") target_compile_definitions(CSE2 PRIVATE JAPANESE) else() set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/game_english") - list(APPEND RESOURCES "BITMAP/pixel.bmp" "FONT/LiberationMono.ttf") + list(APPEND RESOURCES "BITMAP/pixel.bmp") endif() if(FIX_BUGS) diff --git a/Makefile b/Makefile index 4186f7ef..4fa98fd0 100644 --- a/Makefile +++ b/Makefile @@ -206,10 +206,8 @@ RESOURCES = \ ifeq ($(JAPANESE), 1) RESOURCES += BITMAP/pixel_jp.bmp - RESOURCES += FONT/NotoSansMonoCJKjp.otf else RESOURCES += BITMAP/pixel.bmp - RESOURCES += FONT/LiberationMono.ttf endif ifneq ($(WINDOWS), 1) diff --git a/assets/resources/FONT/LICENSE-LiberationMono.txt b/game_english/data/Font/LICENSE-LiberationMono.txt similarity index 100% rename from assets/resources/FONT/LICENSE-LiberationMono.txt rename to game_english/data/Font/LICENSE-LiberationMono.txt diff --git a/assets/resources/FONT/LiberationMono.ttf b/game_english/data/Font/font similarity index 100% rename from assets/resources/FONT/LiberationMono.ttf rename to game_english/data/Font/font diff --git a/assets/resources/FONT/LICENSE-NotoSansMonoCJKjp.txt b/game_japanese/data/Font/LICENSE-NotoSansMonoCJKjp.txt similarity index 100% rename from assets/resources/FONT/LICENSE-NotoSansMonoCJKjp.txt rename to game_japanese/data/Font/LICENSE-NotoSansMonoCJKjp.txt diff --git a/assets/resources/FONT/NotoSansMonoCJKjp.otf b/game_japanese/data/Font/font similarity index 100% rename from assets/resources/FONT/NotoSansMonoCJKjp.otf rename to game_japanese/data/Font/font diff --git a/src/Draw.cpp b/src/Draw.cpp index a20ddd9a..03db0a19 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -618,10 +618,10 @@ void InitTextObject(const char *name) { (void)name; // Unused in this branch - size_t size; - const unsigned char *data = FindResource("FONT", "FONT", &size); + char path[MAX_PATH]; + sprintf(path, "%s/Font/font", gDataPath); - font = LoadFontFromData(data, size, 8 * magnification, 9 * magnification); + font = LoadFont(path, 8 * magnification, 9 * magnification); } void PutText(int x, int y, const char *text, unsigned long color) diff --git a/src/Resource.cpp b/src/Resource.cpp index 134c04e0..3e2ac9a9 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -27,11 +27,6 @@ #endif #include "Resource/CURSOR/CURSOR_IKA.bmp.h" #include "Resource/CURSOR/CURSOR_NORMAL.bmp.h" -#ifdef JAPANESE -#include "Resource/FONT/NotoSansMonoCJKjp.otf.h" -#else -#include "Resource/FONT/LiberationMono.ttf.h" -#endif #ifndef _WIN32 #include "Resource/ICON/ICON_MINI.bmp.h" #endif @@ -110,11 +105,6 @@ static const struct #endif {"CURSOR", "CURSOR_IKA", rCURSOR_IKA, sizeof(rCURSOR_IKA)}, {"CURSOR", "CURSOR_NORMAL", rCURSOR_NORMAL, sizeof(rCURSOR_NORMAL)}, -#ifdef JAPANESE - {"FONT", "FONT", rNotoSansMonoCJKjp, sizeof(rNotoSansMonoCJKjp)}, -#else - {"FONT", "FONT", rLiberationMono, sizeof(rLiberationMono)}, -#endif #ifndef _WIN32 {"ICON", "ICON_MINI", rICON_MINI, sizeof(rICON_MINI)}, #endif