summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-31 12:23:26 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-31 12:23:26 +0200
commit98f5ab5aa00f4d6b83079e6ee4e228b401356198 (patch)
tree3760877ce19431b821b66ae8b43a9fecea201460
parenta7596f683456da5274ecb33d4043a9eb47858c99 (diff)
Changed format of resources.lgr
Resources are now stored in a ZIP archive, and it comes with an explicit version number. All the old embed/bincat stuff was removed as unnecessary. resources.lgr is also a valid fontpack, for loading the built-in fonts. IssueID #363
-rw-r--r--CMakeLists.txt45
-rw-r--r--Resources.cmake27
-rw-r--r--res/Fontpack.cmake19
-rwxr-xr-xres/bincat.sh22
-rw-r--r--res/fontpack.ini (renamed from res/default.fontpack/fontpack.ini)22
-rw-r--r--res/fonts/IosevkaTerm-Extended.ttf (renamed from res/default.fontpack/IosevkaTerm-Extended.ttf)bin1503504 -> 1503504 bytes
-rw-r--r--res/fonts/LICENSE_OFL.txt (renamed from res/default.fontpack/LICENSE_OFL.txt)0
-rw-r--r--res/fonts/LICENSE_SmolEmoji.txt (renamed from res/default.fontpack/LICENSE_SmolEmoji.txt)0
-rw-r--r--res/fonts/NotoEmoji-Regular.ttf (renamed from res/default.fontpack/NotoEmoji-Regular.ttf)bin418804 -> 418804 bytes
-rw-r--r--res/fonts/NotoSansSymbols-Regular.ttf (renamed from res/default.fontpack/NotoSansSymbols-Regular.ttf)bin168520 -> 168520 bytes
-rw-r--r--res/fonts/NotoSansSymbols2-Regular.ttf (renamed from res/default.fontpack/NotoSansSymbols2-Regular.ttf)bin583072 -> 583072 bytes
-rw-r--r--res/fonts/SmolEmoji-Regular.ttf (renamed from res/default.fontpack/SmolEmoji-Regular.ttf)bin58544 -> 58544 bytes
-rw-r--r--res/fonts/SourceSans3-Bold.ttf (renamed from res/default.fontpack/SourceSans3-Bold.ttf)bin298256 -> 298256 bytes
-rw-r--r--res/fonts/SourceSans3-ExtraLight.ttf (renamed from res/default.fontpack/SourceSans3-ExtraLight.ttf)bin293932 -> 293932 bytes
-rw-r--r--res/fonts/SourceSans3-It.ttf (renamed from res/default.fontpack/SourceSans3-It.ttf)bin214992 -> 214992 bytes
-rw-r--r--res/fonts/SourceSans3-Regular.ttf (renamed from res/default.fontpack/SourceSans3-Regular.ttf)bin299252 -> 299252 bytes
-rw-r--r--res/fonts/SourceSans3-Semibold.ttf (renamed from res/default.fontpack/SourceSans3-Semibold.ttf)bin298888 -> 298888 bytes
-rw-r--r--src/app.c12
-rw-r--r--src/fontpack.c7
-rw-r--r--src/gmrequest.c16
-rw-r--r--src/lang.c56
-rw-r--r--src/resources.c121
-rw-r--r--src/resources.h (renamed from res/bincat.c)66
-rw-r--r--src/ui/root.c2
-rw-r--r--src/ui/text.c24
-rw-r--r--src/ui/window.c8
26 files changed, 277 insertions, 170 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4cafc4fa..77e25b45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@
18cmake_minimum_required (VERSION 3.9) 18cmake_minimum_required (VERSION 3.9)
19 19
20project (Lagrange 20project (Lagrange
21 VERSION 1.8.1 21 VERSION 1.9.0
22 DESCRIPTION "A Beautiful Gemini Client" 22 DESCRIPTION "A Beautiful Gemini Client"
23 LANGUAGES C 23 LANGUAGES C
24) 24)
@@ -29,7 +29,7 @@ if (IOS)
29 set (IOS_BUILD_DATE "2021-10-23") 29 set (IOS_BUILD_DATE "2021-10-23")
30endif () 30endif ()
31 31
32# Default that depend on environment. 32# Defaults that depend on environment.
33set (DEFAULT_RESIZE_DRAW ON) 33set (DEFAULT_RESIZE_DRAW ON)
34if (HAIKU) 34if (HAIKU)
35 set (DEFAULT_RESIZE_DRAW OFF) 35 set (DEFAULT_RESIZE_DRAW OFF)
@@ -52,20 +52,17 @@ option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON)
52option (ENABLE_POPUP_MENUS "Use popup windows for context menus (if OFF, menus are confined inside main window)" ON) 52option (ENABLE_POPUP_MENUS "Use popup windows for context menus (if OFF, menus are confined inside main window)" ON)
53option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF) 53option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF)
54option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW}) 54option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW})
55option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF)
56option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON) 55option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON)
57option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF) 56option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF)
58option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF) 57option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF)
59 58
60include (BuildType.cmake) 59include (BuildType.cmake)
61include (res/Embed.cmake) 60include (Resources.cmake)
62include (res/Fontpack.cmake)
63include (Depends.cmake) 61include (Depends.cmake)
64 62
65# Package resources. 63# Package resources.
66message (STATUS "Preparing resources...") 64message (STATUS "Preparing resources...")
67make_fontpack (res/default.fontpack) 65set (RESOURCES
68set (EMBED_RESOURCES
69 res/about/about.gmi 66 res/about/about.gmi
70 res/about/help.gmi 67 res/about/help.gmi
71 res/about/lagrange.gmi 68 res/about/lagrange.gmi
@@ -92,12 +89,14 @@ set (EMBED_RESOURCES
92 res/lang/zh_Hans.bin 89 res/lang/zh_Hans.bin
93 res/lang/zh_Hant.bin 90 res/lang/zh_Hant.bin
94 res/shadow.png 91 res/shadow.png
95 ${CMAKE_BINARY_DIR}/default.fontpack 92 res/fontpack.ini
96) 93)
94file (GLOB FONTS RELATIVE ${CMAKE_SOURCE_DIR} res/fonts/*)
95list (APPEND RESOURCES ${FONTS})
97if ((UNIX AND NOT APPLE) OR MSYS) 96if ((UNIX AND NOT APPLE) OR MSYS)
98 list (APPEND EMBED_RESOURCES res/lagrange-64.png) 97 list (APPEND RESOURCES res/lagrange-64.png)
99endif () 98endif ()
100embed_make (${EMBED_RESOURCES}) 99make_resources (${CMAKE_CURRENT_BINARY_DIR}/resources.lgr ${RESOURCES})
101 100
102set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr) 101set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
103set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 102set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
@@ -142,6 +141,8 @@ set (SOURCES
142 src/periodic.h 141 src/periodic.h
143 src/prefs.c 142 src/prefs.c
144 src/prefs.h 143 src/prefs.h
144 src/resources.c
145 src/resources.h
145 src/sitespec.c 146 src/sitespec.c
146 src/sitespec.h 147 src/sitespec.h
147 src/stb_image.h 148 src/stb_image.h
@@ -217,8 +218,6 @@ set (SOURCES
217 res/about/lagrange.gmi 218 res/about/lagrange.gmi
218 res/about/license.gmi 219 res/about/license.gmi
219 res/about/version.gmi 220 res/about/version.gmi
220 ${CMAKE_CURRENT_BINARY_DIR}/embedded.c
221 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h
222 ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr 221 ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr
223) 222)
224if (ENABLE_IPC) 223if (ENABLE_IPC)
@@ -417,9 +416,7 @@ if (MSYS)
417 if (TARGET PkgConfig::MPG123) 416 if (TARGET PkgConfig::MPG123)
418 install (PROGRAMS ${MPG123_LIBDIR}/../bin/msys-mpg123-0.dll DESTINATION .) 417 install (PROGRAMS ${MPG123_LIBDIR}/../bin/msys-mpg123-0.dll DESTINATION .)
419 endif () 418 endif ()
420 if (NOT ENABLE_RESOURCE_EMBED) 419 install (FILES ${EMB_BIN} DESTINATION .)
421 install (FILES ${EMB_BIN} DESTINATION .)
422 endif ()
423 install (PROGRAMS 420 install (PROGRAMS
424 ${SDL2_LIBDIR}/SDL2.dll 421 ${SDL2_LIBDIR}/SDL2.dll
425 res/urlopen.bat 422 res/urlopen.bat
@@ -430,11 +427,9 @@ if (MSYS)
430 endif () 427 endif ()
431elseif (HAIKU) 428elseif (HAIKU)
432 install (TARGETS app DESTINATION .) 429 install (TARGETS app DESTINATION .)
433 if (NOT ENABLE_RESOURCE_EMBED) 430 target_compile_definitions (app PUBLIC
434 target_compile_definitions (app PUBLIC 431 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr")
435 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr") 432 install (FILES ${EMB_BIN} DESTINATION .)
436 install (FILES ${EMB_BIN} DESTINATION .)
437 endif ()
438elseif (UNIX AND NOT APPLE) 433elseif (UNIX AND NOT APPLE)
439 set_target_properties (app PROPERTIES 434 set_target_properties (app PROPERTIES
440 INSTALL_RPATH_USE_LINK_PATH YES 435 INSTALL_RPATH_USE_LINK_PATH YES
@@ -460,11 +455,9 @@ MimeType=x-scheme-handler/gemini;x-scheme-handler/gopher
460 install (FILES res/fi.skyjake.Lagrange.appdata.xml 455 install (FILES res/fi.skyjake.Lagrange.appdata.xml
461 DESTINATION share/metainfo 456 DESTINATION share/metainfo
462 ) 457 )
463 if (NOT ENABLE_RESOURCE_EMBED) 458 if (NOT ENABLE_RELATIVE_EMBED)
464 if (NOT ENABLE_RELATIVE_EMBED) 459 target_compile_definitions (app PUBLIC
465 target_compile_definitions (app PUBLIC 460 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr")
466 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr")
467 endif ()
468 install (FILES ${EMB_BIN} DESTINATION share/lagrange)
469 endif () 461 endif ()
462 install (FILES ${EMB_BIN} DESTINATION share/lagrange)
470endif () 463endif ()
diff --git a/Resources.cmake b/Resources.cmake
new file mode 100644
index 00000000..fc5d20c6
--- /dev/null
+++ b/Resources.cmake
@@ -0,0 +1,27 @@
1find_program (ZIP_EXECUTABLE zip DOC "ZIP archiver")
2if (NOT ZIP_EXECUTABLE)
3 message (FATAL_ERROR "Please install 'zip' for packaging resources.")
4endif ()
5
6function (make_resources dst)
7 list (REMOVE_AT ARGV 0)
8 set (files)
9 foreach (arg ${ARGV})
10 get_filename_component (name ${arg} NAME)
11 if (NOT "${name}" MATCHES "^\\..*")
12 string (SUBSTRING ${arg} 4 -1 rel)
13 list (APPEND files ${rel})
14 endif ()
15 endforeach (arg)
16 file (REMOVE ${dst})
17 get_filename_component (dstName ${dst} NAME)
18 message (STATUS " ${dstName}")
19 set (versionTempPath ${CMAKE_SOURCE_DIR}/res/VERSION)
20 file (WRITE ${versionTempPath} ${PROJECT_VERSION})
21 execute_process (
22 COMMAND ${ZIP_EXECUTABLE} -1 ${dst} VERSION ${files}
23 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res
24 OUTPUT_QUIET
25 )
26 file (REMOVE ${versionTempPath})
27endfunction ()
diff --git a/res/Fontpack.cmake b/res/Fontpack.cmake
deleted file mode 100644
index 26d6df1e..00000000
--- a/res/Fontpack.cmake
+++ /dev/null
@@ -1,19 +0,0 @@
1find_program (ZIP_EXECUTABLE zip DOC "ZIP archiver")
2if (NOT ZIP_EXECUTABLE)
3 message (FATAL_ERROR "Please install 'zip' to create fontpacks.")
4endif ()
5
6function (make_fontpack src)
7 get_filename_component (dst ${src} NAME)
8 set (fn ${CMAKE_BINARY_DIR}/${dst})
9 execute_process (COMMAND ${CMAKE_COMMAND} -E remove ${fn})
10 file (GLOB files RELATIVE ${CMAKE_SOURCE_DIR}/${src}
11 ${CMAKE_SOURCE_DIR}/${src}/*
12 )
13 message (STATUS " ${src}")
14 execute_process (
15 COMMAND ${ZIP_EXECUTABLE} -0 ${fn} ${files}
16 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/${src}
17 OUTPUT_QUIET
18 )
19endfunction ()
diff --git a/res/bincat.sh b/res/bincat.sh
deleted file mode 100755
index eb46655b..00000000
--- a/res/bincat.sh
+++ /dev/null
@@ -1,22 +0,0 @@
1#!/bin/bash
2# Binary Resource Concatenator
3# Copyright: 2021 Jaakko Keränen <jaakko.keranen@iki.fi>
4# License: BSD 2-Clause
5
6OUTPUT=--
7SIZES=""
8for fn in $*; do
9 if [ "$OUTPUT" = "--" ]; then
10 OUTPUT=$fn
11 rm -f ${OUTPUT}
12 else
13 vals=(`/bin/ls -l $fn`)
14 if [ "$SIZES" = "" ]; then
15 SIZES=${vals[4]}
16 else
17 SIZES=$SIZES\;${vals[4]}
18 fi
19 cat ${fn} >> ${OUTPUT}
20 fi
21done
22echo $SIZES
diff --git a/res/default.fontpack/fontpack.ini b/res/fontpack.ini
index 68316ef6..920a4ad2 100644
--- a/res/default.fontpack/fontpack.ini
+++ b/res/fontpack.ini
@@ -19,17 +19,17 @@
19 19
20[default] 20[default]
21name = "Source Sans" 21name = "Source Sans"
22regular = "SourceSans3-Regular.ttf" 22regular = "fonts/SourceSans3-Regular.ttf"
23italic = "SourceSans3-It.ttf" 23italic = "fonts/SourceSans3-It.ttf"
24light = "SourceSans3-ExtraLight.ttf" 24light = "fonts/SourceSans3-ExtraLight.ttf"
25semibold = "SourceSans3-Semibold.ttf" 25semibold = "fonts/SourceSans3-Semibold.ttf"
26bold = "SourceSans3-Bold.ttf" 26bold = "fonts/SourceSans3-Bold.ttf"
27 27
28[iosevka] 28[iosevka]
29name = "Iosevka (compact)" 29name = "Iosevka (compact)"
30monospace = true 30monospace = true
31doc.height = 0.800 31doc.height = 0.800
32regular = "IosevkaTerm-Extended.ttf" 32regular = "fonts/IosevkaTerm-Extended.ttf"
33 33
34[iosevka-body] 34[iosevka-body]
35# Variant of Iosevka with expanded line spacing for better readability. 35# Variant of Iosevka with expanded line spacing for better readability.
@@ -38,21 +38,21 @@ name = "Iosevka"
38monospace = true 38monospace = true
39priority = -10 39priority = -10
40glyphscale = 0.800 40glyphscale = 0.800
41regular = "IosevkaTerm-Extended.ttf" 41regular = "fonts/IosevkaTerm-Extended.ttf"
42 42
43[smolemoji] 43[smolemoji]
44name = "Smol Emoji" 44name = "Smol Emoji"
45override = true # These Emoji/symbols are always preferred. 45override = true # These Emoji/symbols are always preferred.
46auxiliary = true 46auxiliary = true
47priority = 100 47priority = 100
48regular = "SmolEmoji-Regular.ttf" 48regular = "fonts/SmolEmoji-Regular.ttf"
49 49
50[notoemoji] 50[notoemoji]
51name = "Noto Emoji" 51name = "Noto Emoji"
52auxiliary = true 52auxiliary = true
53priority = 30 53priority = 30
54glyphscale = 1.1 54glyphscale = 1.1
55regular = "NotoEmoji-Regular.ttf" 55regular = "fonts/NotoEmoji-Regular.ttf"
56 56
57[notosymbols2] 57[notosymbols2]
58name = "Noto Sans Symbols 2" 58name = "Noto Sans Symbols 2"
@@ -60,7 +60,7 @@ auxiliary = true
60priority = 20 60priority = 20
61glyphscale = 1.45 61glyphscale = 1.45
62voffset = 0.5 62voffset = 0.5
63regular = "NotoSansSymbols2-Regular.ttf" 63regular = "fonts/NotoSansSymbols2-Regular.ttf"
64 64
65[notosymbols] 65[notosymbols]
66name = "Noto Sans Symbols" 66name = "Noto Sans Symbols"
@@ -68,4 +68,4 @@ auxiliary = true
68priority = 10 68priority = 10
69glyphscale = 2.0 69glyphscale = 2.0
70voffset = 1.2 70voffset = 1.2
71regular = "NotoSansSymbols-Regular.ttf" 71regular = "fonts/NotoSansSymbols-Regular.ttf"
diff --git a/res/default.fontpack/IosevkaTerm-Extended.ttf b/res/fonts/IosevkaTerm-Extended.ttf
index 16989a85..16989a85 100644
--- a/res/default.fontpack/IosevkaTerm-Extended.ttf
+++ b/res/fonts/IosevkaTerm-Extended.ttf
Binary files differ
diff --git a/res/default.fontpack/LICENSE_OFL.txt b/res/fonts/LICENSE_OFL.txt
index d952d62c..d952d62c 100644
--- a/res/default.fontpack/LICENSE_OFL.txt
+++ b/res/fonts/LICENSE_OFL.txt
diff --git a/res/default.fontpack/LICENSE_SmolEmoji.txt b/res/fonts/LICENSE_SmolEmoji.txt
index 3513b65a..3513b65a 100644
--- a/res/default.fontpack/LICENSE_SmolEmoji.txt
+++ b/res/fonts/LICENSE_SmolEmoji.txt
diff --git a/res/default.fontpack/NotoEmoji-Regular.ttf b/res/fonts/NotoEmoji-Regular.ttf
index 19b7badf..19b7badf 100644
--- a/res/default.fontpack/NotoEmoji-Regular.ttf
+++ b/res/fonts/NotoEmoji-Regular.ttf
Binary files differ
diff --git a/res/default.fontpack/NotoSansSymbols-Regular.ttf b/res/fonts/NotoSansSymbols-Regular.ttf
index 68847551..68847551 100644
--- a/res/default.fontpack/NotoSansSymbols-Regular.ttf
+++ b/res/fonts/NotoSansSymbols-Regular.ttf
Binary files differ
diff --git a/res/default.fontpack/NotoSansSymbols2-Regular.ttf b/res/fonts/NotoSansSymbols2-Regular.ttf
index 79706435..79706435 100644
--- a/res/default.fontpack/NotoSansSymbols2-Regular.ttf
+++ b/res/fonts/NotoSansSymbols2-Regular.ttf
Binary files differ
diff --git a/res/default.fontpack/SmolEmoji-Regular.ttf b/res/fonts/SmolEmoji-Regular.ttf
index 3ab9484b..3ab9484b 100644
--- a/res/default.fontpack/SmolEmoji-Regular.ttf
+++ b/res/fonts/SmolEmoji-Regular.ttf
Binary files differ
diff --git a/res/default.fontpack/SourceSans3-Bold.ttf b/res/fonts/SourceSans3-Bold.ttf
index 486ede63..486ede63 100644
--- a/res/default.fontpack/SourceSans3-Bold.ttf
+++ b/res/fonts/SourceSans3-Bold.ttf
Binary files differ
diff --git a/res/default.fontpack/SourceSans3-ExtraLight.ttf b/res/fonts/SourceSans3-ExtraLight.ttf
index 53e1541c..53e1541c 100644
--- a/res/default.fontpack/SourceSans3-ExtraLight.ttf
+++ b/res/fonts/SourceSans3-ExtraLight.ttf
Binary files differ
diff --git a/res/default.fontpack/SourceSans3-It.ttf b/res/fonts/SourceSans3-It.ttf
index 9823601c..9823601c 100644
--- a/res/default.fontpack/SourceSans3-It.ttf
+++ b/res/fonts/SourceSans3-It.ttf
Binary files differ
diff --git a/res/default.fontpack/SourceSans3-Regular.ttf b/res/fonts/SourceSans3-Regular.ttf
index f6d31e8c..f6d31e8c 100644
--- a/res/default.fontpack/SourceSans3-Regular.ttf
+++ b/res/fonts/SourceSans3-Regular.ttf
Binary files differ
diff --git a/res/default.fontpack/SourceSans3-Semibold.ttf b/res/fonts/SourceSans3-Semibold.ttf
index d4774aab..d4774aab 100644
--- a/res/default.fontpack/SourceSans3-Semibold.ttf
+++ b/res/fonts/SourceSans3-Semibold.ttf
Binary files differ
diff --git a/src/app.c b/src/app.c
index 73771609..a9ec6a26 100644
--- a/src/app.c
+++ b/src/app.c
@@ -23,7 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
23#include "app.h" 23#include "app.h"
24#include "bookmarks.h" 24#include "bookmarks.h"
25#include "defs.h" 25#include "defs.h"
26#include "embedded.h" 26#include "resources.h"
27#include "feeds.h" 27#include "feeds.h"
28#include "mimehooks.h" 28#include "mimehooks.h"
29#include "gmcerts.h" 29#include "gmcerts.h"
@@ -711,19 +711,17 @@ static void init_App_(iApp *d, int argc, char **argv) {
711 } 711 }
712 SDL_free(exec); 712 SDL_free(exec);
713 } 713 }
714#if defined (iHaveLoadEmbed)
715 /* Load the resources from a file. Check the executable directory first, then a 714 /* Load the resources from a file. Check the executable directory first, then a
716 system-wide location, and as a final fallback, the current working directory. */ { 715 system-wide location, and as a final fallback, the current working directory. */ {
717 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) { 716 if (!init_Resources(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) {
718 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) { 717 if (!init_Resources(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) {
719 if (!load_Embed("resources.lgr")) { 718 if (!init_Resources("resources.lgr")) {
720 fprintf(stderr, "failed to load resources: %s\n", strerror(errno)); 719 fprintf(stderr, "failed to load resources: %s\n", strerror(errno));
721 exit(-1); 720 exit(-1);
722 } 721 }
723 } 722 }
724 } 723 }
725 } 724 }
726#endif
727 init_Lang(); 725 init_Lang();
728 /* Configure the valid command line options. */ { 726 /* Configure the valid command line options. */ {
729 defineValues_CommandLine(&d->args, "close-tab", 0); 727 defineValues_CommandLine(&d->args, "close-tab", 0);
@@ -742,7 +740,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
742 iStringList *openCmds = new_StringList(); 740 iStringList *openCmds = new_StringList();
743 /* Handle command line options. */ { 741 /* Handle command line options. */ {
744 if (contains_CommandLine(&d->args, "help")) { 742 if (contains_CommandLine(&d->args, "help")) {
745 puts(cstr_Block(&blobArghelp_Embedded)); 743 puts(cstr_Block(&blobArghelp_Resources));
746 terminate_App_(0); 744 terminate_App_(0);
747 } 745 }
748 if (contains_CommandLine(&d->args, "version;V")) { 746 if (contains_CommandLine(&d->args, "version;V")) {
diff --git a/src/fontpack.c b/src/fontpack.c
index 40e4c96c..78181fd4 100644
--- a/src/fontpack.c
+++ b/src/fontpack.c
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "fontpack.h" 23#include "fontpack.h"
24#include "embedded.h" 24#include "resources.h"
25#include "ui/window.h" 25#include "ui/window.h"
26#include "app.h" 26#include "app.h"
27 27
@@ -564,11 +564,8 @@ void init_Fonts(const char *userDir) {
564 /* Load the required fonts. */ { 564 /* Load the required fonts. */ {
565 iFontPack *pack = new_FontPack(); 565 iFontPack *pack = new_FontPack();
566 setCStr_String(&pack->id, "default"); 566 setCStr_String(&pack->id, "default");
567 iArchive *arch = new_Archive();
568 setReadOnly_FontPack(pack, iTrue); 567 setReadOnly_FontPack(pack, iTrue);
569 openData_Archive(arch, &fontpackDefault_Embedded); 568 loadArchive_FontPack(pack, archive_Resources()); /* should never fail if we've made it this far */
570 loadArchive_FontPack(pack, arch); /* should never fail if we've made it this far */
571 iRelease(arch);
572 pushBack_PtrArray(&d->packs, pack); 569 pushBack_PtrArray(&d->packs, pack);
573 } 570 }
574 /* Find and load .fontpack files in known locations. */ { 571 /* Find and load .fontpack files in known locations. */ {
diff --git a/src/gmrequest.c b/src/gmrequest.c
index 03a6d999..23845475 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29#include "feeds.h" 29#include "feeds.h"
30#include "bookmarks.h" 30#include "bookmarks.h"
31#include "ui/text.h" 31#include "ui/text.h"
32#include "embedded.h" 32#include "resources.h"
33#include "defs.h" 33#include "defs.h"
34 34
35#include <the_Foundation/archive.h> 35#include <the_Foundation/archive.h>
@@ -344,19 +344,19 @@ static void requestFinished_GmRequest_(iGmRequest *d, iTlsRequest *req) {
344static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) { 344static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) {
345 const iBlock *src = NULL; 345 const iBlock *src = NULL;
346 if (equalCase_Rangecc(path, "about")) { 346 if (equalCase_Rangecc(path, "about")) {
347 return &blobAbout_Embedded; 347 return &blobAbout_Resources;
348 } 348 }
349 if (equalCase_Rangecc(path, "lagrange")) { 349 if (equalCase_Rangecc(path, "lagrange")) {
350 return &blobLagrange_Embedded; 350 return &blobLagrange_Resources;
351 } 351 }
352 if (equalCase_Rangecc(path, "help")) { 352 if (equalCase_Rangecc(path, "help")) {
353 return &blobHelp_Embedded; 353 return &blobHelp_Resources;
354 } 354 }
355 if (equalCase_Rangecc(path, "license")) { 355 if (equalCase_Rangecc(path, "license")) {
356 return &blobLicense_Embedded; 356 return &blobLicense_Resources;
357 } 357 }
358 if (equalCase_Rangecc(path, "version")) { 358 if (equalCase_Rangecc(path, "version")) {
359 return &blobVersion_Embedded; 359 return &blobVersion_Resources;
360 } 360 }
361 if (equalCase_Rangecc(path, "debug")) { 361 if (equalCase_Rangecc(path, "debug")) {
362 return utf8_String(debugInfo_App()); 362 return utf8_String(debugInfo_App());
@@ -396,7 +396,7 @@ static const iBlock *replaceVariables_(const iBlock *block) {
396#if 0 396#if 0
397 else if (startsWith_Rangecc(name, "BT:")) { /* block text */ 397 else if (startsWith_Rangecc(name, "BT:")) { /* block text */
398 repl = range_String(collect_String(renderBlockChars_Text( 398 repl = range_String(collect_String(renderBlockChars_Text(
399 &fontFiraSansRegular_Embedded, 399 &fontFiraSansRegular_Resources,
400 11, /* should be larger if shaded */ 400 11, /* should be larger if shaded */
401 quadrants_TextBlockMode, 401 quadrants_TextBlockMode,
402 &(iString){ iBlockLiteral( 402 &(iString){ iBlockLiteral(
@@ -404,7 +404,7 @@ static const iBlock *replaceVariables_(const iBlock *block) {
404 } 404 }
405 else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */ 405 else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */
406 repl = range_String(collect_String(renderBlockChars_Text( 406 repl = range_String(collect_String(renderBlockChars_Text(
407 &fontSmolEmojiRegular_Embedded, 407 &fontSmolEmojiRegular_Resources,
408 20, 408 20,
409 shading_TextBlockMode, 409 shading_TextBlockMode,
410 &(iString){ iBlockLiteral( 410 &(iString){ iBlockLiteral(
diff --git a/src/lang.c b/src/lang.c
index f54ab2d7..017937cf 100644
--- a/src/lang.c
+++ b/src/lang.c
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "lang.h" 23#include "lang.h"
24#include "embedded.h" 24#include "resources.h"
25 25
26#include <the_Foundation/sortedarray.h> 26#include <the_Foundation/sortedarray.h>
27#include <the_Foundation/string.h> 27#include <the_Foundation/string.h>
@@ -30,7 +30,7 @@ iDeclareType(Lang)
30iDeclareType(MsgStr) 30iDeclareType(MsgStr)
31 31
32struct Impl_MsgStr { 32struct Impl_MsgStr {
33 iRangecc id; /* these point to null-terminated strings in embedded data */ 33 iRangecc id; /* these point to null-terminated strings in resources */
34 iRangecc str; 34 iRangecc str;
35}; 35};
36 36
@@ -83,41 +83,41 @@ static void clear_Lang_(iLang *d) {
83} 83}
84 84
85static void load_Lang_(iLang *d, const char *id) { 85static void load_Lang_(iLang *d, const char *id) {
86 /* Load compiled language strings from an embedded blob. */ 86 /* Load compiled language strings from a resource blob. */
87 iUnused(id); 87 iUnused(id);
88 const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Embedded 88 const iBlock *data = equal_CStr(id, "fi") ? &blobFi_Resources
89 : equal_CStr(id, "fr") ? &blobFr_Embedded 89 : equal_CStr(id, "fr") ? &blobFr_Resources
90 : equal_CStr(id, "ru") ? &blobRu_Embedded 90 : equal_CStr(id, "ru") ? &blobRu_Resources
91 : equal_CStr(id, "eo") ? &blobEo_Embedded 91 : equal_CStr(id, "eo") ? &blobEo_Resources
92 : equal_CStr(id, "es") ? &blobEs_Embedded 92 : equal_CStr(id, "es") ? &blobEs_Resources
93 : equal_CStr(id, "es_MX") ? &blobEs_MX_Embedded 93 : equal_CStr(id, "es_MX") ? &blobEs_MX_Resources
94 : equal_CStr(id, "de") ? &blobDe_Embedded 94 : equal_CStr(id, "de") ? &blobDe_Resources
95 : equal_CStr(id, "gl") ? &blobGl_Embedded 95 : equal_CStr(id, "gl") ? &blobGl_Resources
96 : equal_CStr(id, "ia") ? &blobIa_Embedded 96 : equal_CStr(id, "ia") ? &blobIa_Resources
97 : equal_CStr(id, "ie") ? &blobIe_Embedded 97 : equal_CStr(id, "ie") ? &blobIe_Resources
98 : equal_CStr(id, "isv") ? &blobIsv_Embedded 98 : equal_CStr(id, "isv") ? &blobIsv_Resources
99 : equal_CStr(id, "pl") ? &blobPl_Embedded 99 : equal_CStr(id, "pl") ? &blobPl_Resources
100 : equal_CStr(id, "sk") ? &blobSk_Embedded 100 : equal_CStr(id, "sk") ? &blobSk_Resources
101 : equal_CStr(id, "sr") ? &blobSr_Embedded 101 : equal_CStr(id, "sr") ? &blobSr_Resources
102 : equal_CStr(id, "tok") ? &blobTok_Embedded 102 : equal_CStr(id, "tok") ? &blobTok_Resources
103 : equal_CStr(id, "uk") ? &blobUk_Embedded 103 : equal_CStr(id, "uk") ? &blobUk_Resources
104 : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Embedded 104 : equal_CStr(id, "zh_Hans") ? &blobZh_Hans_Resources
105 : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Embedded 105 : equal_CStr(id, "zh_Hant") ? &blobZh_Hant_Resources
106 : &blobEn_Embedded; 106 : &blobEn_Resources;
107 if (data == &blobRu_Embedded || data == &blobSr_Embedded || data == &blobUk_Embedded) { 107 if (data == &blobRu_Resources || data == &blobSr_Resources || data == &blobUk_Resources) {
108 d->pluralType = slavic_PluralType; 108 d->pluralType = slavic_PluralType;
109 } 109 }
110 else if (data == &blobIsv_Embedded) { 110 else if (data == &blobIsv_Resources) {
111 d->pluralType = oneTwoMany_PluralType; 111 d->pluralType = oneTwoMany_PluralType;
112 } 112 }
113 else if (data == &blobSk_Embedded) { 113 else if (data == &blobSk_Resources) {
114 d->pluralType = oneFewMany_PluralType; 114 d->pluralType = oneFewMany_PluralType;
115 } 115 }
116 else if (data == &blobPl_Embedded) { 116 else if (data == &blobPl_Resources) {
117 d->pluralType = polish_PluralType; 117 d->pluralType = polish_PluralType;
118 } 118 }
119 else if (data == &blobZh_Hans_Embedded || data == &blobZh_Hant_Embedded || 119 else if (data == &blobZh_Hans_Resources || data == &blobZh_Hant_Resources ||
120 data == &blobTok_Embedded) { 120 data == &blobTok_Resources) {
121 d->pluralType = none_PluralType; 121 d->pluralType = none_PluralType;
122 } 122 }
123 else { 123 else {
diff --git a/src/resources.c b/src/resources.c
new file mode 100644
index 00000000..da78708a
--- /dev/null
+++ b/src/resources.c
@@ -0,0 +1,121 @@
1/* Copyright 2021 Jaakko Keränen <jaakko.keranen@iki.fi>
2
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are met:
5
61. Redistributions of source code must retain the above copyright notice, this
7 list of conditions and the following disclaimer.
82. Redistributions in binary form must reproduce the above copyright notice,
9 this list of conditions and the following disclaimer in the documentation
10 and/or other materials provided with the distribution.
11
12THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
13ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
16ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22
23#include "resources.h"
24
25#include <the_Foundation/archive.h>
26#include <the_Foundation/version.h>
27
28static iArchive *archive_;
29
30iBlock blobAbout_Resources;
31iBlock blobHelp_Resources;
32iBlock blobLagrange_Resources;
33iBlock blobLicense_Resources;
34iBlock blobVersion_Resources;
35iBlock blobArghelp_Resources;
36iBlock blobDe_Resources;
37iBlock blobEn_Resources;
38iBlock blobEo_Resources;
39iBlock blobEs_Resources;
40iBlock blobEs_MX_Resources;
41iBlock blobFi_Resources;
42iBlock blobFr_Resources;
43iBlock blobGl_Resources;
44iBlock blobIa_Resources;
45iBlock blobIe_Resources;
46iBlock blobIsv_Resources;
47iBlock blobPl_Resources;
48iBlock blobRu_Resources;
49iBlock blobSk_Resources;
50iBlock blobSr_Resources;
51iBlock blobTok_Resources;
52iBlock blobUk_Resources;
53iBlock blobZh_Hans_Resources;
54iBlock blobZh_Hant_Resources;
55iBlock imageShadow_Resources;
56
57static struct {
58 iBlock *data;
59 const char *archivePath;
60} entries_[] = {
61 { &blobAbout_Resources, "about/about.gmi" },
62 { &blobHelp_Resources, "about/help.gmi" },
63 { &blobLagrange_Resources, "about/lagrange.gmi" },
64 { &blobLicense_Resources, "about/license.gmi" },
65 { &blobVersion_Resources, "about/version.gmi" },
66 { &blobArghelp_Resources, "arg-help.txt" },
67 { &blobDe_Resources, "lang/de.bin" },
68 { &blobEn_Resources, "lang/en.bin" },
69 { &blobEo_Resources, "lang/eo.bin" },
70 { &blobEs_Resources, "lang/es.bin" },
71 { &blobEs_MX_Resources, "lang/es_MX.bin" },
72 { &blobFi_Resources, "lang/fi.bin" },
73 { &blobFr_Resources, "lang/fr.bin" },
74 { &blobGl_Resources, "lang/gl.bin" },
75 { &blobIa_Resources, "lang/ia.bin" },
76 { &blobIe_Resources, "lang/ie.bin" },
77 { &blobIsv_Resources, "lang/isv.bin" },
78 { &blobPl_Resources, "lang/pl.bin" },
79 { &blobRu_Resources, "lang/ru.bin" },
80 { &blobSk_Resources, "lang/sk.bin" },
81 { &blobSr_Resources, "lang/sr.bin" },
82 { &blobTok_Resources, "lang/tok.bin" },
83 { &blobUk_Resources, "lang/uk.bin" },
84 { &blobZh_Hans_Resources, "lang/zh_Hans.bin" },
85 { &blobZh_Hant_Resources, "lang/zh_Hant.bin" },
86 { &imageShadow_Resources, "shadow.png" },
87};
88
89iBool init_Resources(const char *path) {
90 archive_ = new_Archive();
91 if (openFile_Archive(archive_, collectNewCStr_String(path))) {
92 iVersion appVer;
93 init_Version(&appVer, range_CStr(LAGRANGE_APP_VERSION));
94 iVersion resVer;
95 init_Version(&resVer, range_Block(dataCStr_Archive(archive_, "VERSION")));
96 if (!cmp_Version(&resVer, &appVer)) {
97 iForIndices(i, entries_) {
98 const iBlock *data = dataCStr_Archive(archive_, entries_[i].archivePath);
99 if (data) {
100 initCopy_Block(entries_[i].data, data);
101 }
102 }
103 return iTrue;
104 }
105 fprintf(stderr, "[Resources] %s: version mismatch (%s != " LAGRANGE_APP_VERSION ")\n",
106 path, cstr_Block(dataCStr_Archive(archive_, "VERSION")));
107 }
108 iRelease(archive_);
109 return iFalse;
110}
111
112void deinit_Resources(void) {
113 iForIndices(i, entries_) {
114 deinit_Block(entries_[i].data);
115 }
116 iRelease(archive_);
117}
118
119const iArchive *archive_Resources(void) {
120 return archive_;
121}
diff --git a/res/bincat.c b/src/resources.h
index 8fc9d831..a9a5c767 100644
--- a/res/bincat.c
+++ b/src/resources.h
@@ -1,4 +1,4 @@
1/* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi> 1/* Copyright 2021 Jaakko Keränen <jaakko.keranen@iki.fi>
2 2
3Redistribution and use in source and binary forms, with or without 3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are met: 4modification, are permitted provided that the following conditions are met:
@@ -20,29 +20,41 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 20(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23/* bincat.c: Tiny tool for concatenating binary files */ 23#pragma once
24 24
25#include <stdio.h> 25#include <the_Foundation/block.h>
26#include <stdlib.h> 26
27 27iDeclareType(Archive)
28int main(int argc, char *argv[]) { 28
29 const size_t bufSize = 1024 * 256; 29iBool init_Resources (const char *path);
30 char *buf = malloc(bufSize); 30void deinit_Resources (void);
31 FILE *out = fopen(argv[1], "wb"); 31
32 int i; 32const iArchive * archive_Resources (void);
33 for (i = 2; i < argc; ++i) { 33
34 FILE *f = fopen(argv[i], "rb"); 34extern iBlock blobAbout_Resources;
35 size_t fileSize = 0; 35extern iBlock blobHelp_Resources;
36 for (;;) { 36extern iBlock blobLagrange_Resources;
37 size_t num = fread(buf, 1, bufSize, f); 37extern iBlock blobLicense_Resources;
38 if (num <= 0) break; 38extern iBlock blobVersion_Resources;
39 fileSize += num; 39extern iBlock blobArghelp_Resources;
40 fwrite(buf, 1, num, out); 40extern iBlock blobDe_Resources;
41 } 41extern iBlock blobEn_Resources;
42 fclose(f); 42extern iBlock blobEo_Resources;
43 printf("%zu;", fileSize); 43extern iBlock blobEs_Resources;
44 } 44extern iBlock blobEs_MX_Resources;
45 fclose(out); 45extern iBlock blobFi_Resources;
46 free(buf); 46extern iBlock blobFr_Resources;
47 return 0; 47extern iBlock blobGl_Resources;
48} 48extern iBlock blobIa_Resources;
49extern iBlock blobIe_Resources;
50extern iBlock blobIsv_Resources;
51extern iBlock blobPl_Resources;
52extern iBlock blobRu_Resources;
53extern iBlock blobSk_Resources;
54extern iBlock blobSr_Resources;
55extern iBlock blobTok_Resources;
56extern iBlock blobUk_Resources;
57extern iBlock blobZh_Hans_Resources;
58extern iBlock blobZh_Hant_Resources;
59extern iBlock imageShadow_Resources;
60extern iBlock fontpackDefault_Resources;
diff --git a/src/ui/root.c b/src/ui/root.c
index d847480f..f66e0f29 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
27#include "command.h" 27#include "command.h"
28#include "defs.h" 28#include "defs.h"
29#include "documentwidget.h" 29#include "documentwidget.h"
30#include "embedded.h" 30#include "resources.h"
31#include "inputwidget.h" 31#include "inputwidget.h"
32#include "keys.h" 32#include "keys.h"
33#include "labelwidget.h" 33#include "labelwidget.h"
diff --git a/src/ui/text.c b/src/ui/text.c
index 09c01d46..e762b891 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -23,7 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
23#include "text.h" 23#include "text.h"
24#include "color.h" 24#include "color.h"
25#include "metrics.h" 25#include "metrics.h"
26#include "embedded.h" 26#include "resources.h"
27#include "window.h" 27#include "window.h"
28#include "paint.h" 28#include "paint.h"
29#include "app.h" 29#include "app.h"
@@ -180,21 +180,21 @@ static void init_Font(iFont *d, const iFontSpec *fontSpec, const iFontFile *font
180 d->data = NULL; 180 d->data = NULL;
181 d->family = undefined_TextFont; 181 d->family = undefined_TextFont;
182 /* Note: We only use `family` currently for applying a kerning fix to Nunito. */ 182 /* Note: We only use `family` currently for applying a kerning fix to Nunito. */
183 if (data == &fontNunitoRegular_Embedded || 183 if (data == &fontNunitoRegular_Resources ||
184 data == &fontNunitoBold_Embedded || 184 data == &fontNunitoBold_Resources ||
185 data == &fontNunitoExtraBold_Embedded || 185 data == &fontNunitoExtraBold_Resources ||
186 //data == &fontNunitoLightItalic_Embedded || 186 //data == &fontNunitoLightItalic_Resources ||
187 data == &fontNunitoExtraLight_Embedded) { 187 data == &fontNunitoExtraLight_Resources) {
188 d->family = nunito_TextFont; 188 d->family = nunito_TextFont;
189 } 189 }
190 else if (//data == &fontScheherazadeNewRegular_Embedded) { 190 else if (//data == &fontScheherazadeNewRegular_Resources) {
191 data == &fontNotoSansArabicUIRegular_Embedded) { 191 data == &fontNotoSansArabicUIRegular_Resources) {
192 d->family = arabic_TextFont; 192 d->family = arabic_TextFont;
193 } 193 }
194 else if (data == &fontNotoSansSymbolsRegular_Embedded || 194 else if (data == &fontNotoSansSymbolsRegular_Resources ||
195 data == &fontNotoSansSymbols2Regular_Embedded || 195 data == &fontNotoSansSymbols2Regular_Resources ||
196 data == &fontNotoEmojiRegular_Embedded || 196 data == &fontNotoEmojiRegular_Resources ||
197 data == &fontSmolEmojiRegular_Embedded) { 197 data == &fontSmolEmojiRegular_Resources) {
198 d->family = emojiAndSymbols_TextFont; 198 d->family = emojiAndSymbols_TextFont;
199 } 199 }
200#endif 200#endif
diff --git a/src/ui/window.c b/src/ui/window.c
index c63ad76a..8016e8ef 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
26#include "bookmarks.h" 26#include "bookmarks.h"
27#include "command.h" 27#include "command.h"
28#include "defs.h" 28#include "defs.h"
29#include "embedded.h" 29#include "resources.h"
30#include "keys.h" 30#include "keys.h"
31#include "labelwidget.h" 31#include "labelwidget.h"
32#include "documentwidget.h" 32#include "documentwidget.h"
@@ -583,7 +583,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {
583#if defined (iPlatformLinux) 583#if defined (iPlatformLinux)
584 SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.pixelRatio, minSize.y * d->base.pixelRatio); 584 SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.pixelRatio, minSize.y * d->base.pixelRatio);
585 /* Load the window icon. */ { 585 /* Load the window icon. */ {
586 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, 0); 586 SDL_Surface *surf = loadImage_(&imageLagrange64_Resources, 0);
587 SDL_SetWindowIcon(d->base.win, surf); 587 SDL_SetWindowIcon(d->base.win, surf);
588 free(surf->pixels); 588 free(surf->pixels);
589 SDL_FreeSurface(surf); 589 SDL_FreeSurface(surf);
@@ -597,7 +597,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {
597 setupUserInterface_MainWindow(d); 597 setupUserInterface_MainWindow(d);
598 postCommand_App("~bindings.changed"); /* update from bindings */ 598 postCommand_App("~bindings.changed"); /* update from bindings */
599 /* Load the border shadow texture. */ { 599 /* Load the border shadow texture. */ {
600 SDL_Surface *surf = loadImage_(&imageShadow_Embedded, 0); 600 SDL_Surface *surf = loadImage_(&imageShadow_Resources, 0);
601 d->base.borderShadow = SDL_CreateTextureFromSurface(d->base.render, surf); 601 d->base.borderShadow = SDL_CreateTextureFromSurface(d->base.render, surf);
602 SDL_SetTextureBlendMode(d->base.borderShadow, SDL_BLENDMODE_BLEND); 602 SDL_SetTextureBlendMode(d->base.borderShadow, SDL_BLENDMODE_BLEND);
603 free(surf->pixels); 603 free(surf->pixels);
@@ -607,7 +607,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {
607#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 607#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
608 /* Load the app icon for drawing in the title bar. */ 608 /* Load the app icon for drawing in the title bar. */
609 if (prefs_App()->customFrame) { 609 if (prefs_App()->customFrame) {
610 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_Root()); 610 SDL_Surface *surf = loadImage_(&imageLagrange64_Resources, appIconSize_Root());
611 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); 611 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
612 d->appIcon = SDL_CreateTextureFromSurface(d->base.render, surf); 612 d->appIcon = SDL_CreateTextureFromSurface(d->base.render, surf);
613 free(surf->pixels); 613 free(surf->pixels);