summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-06 12:16:43 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-06 12:16:43 +0300
commit61a3dc017067be43472dadb7909094aa04d1fe9d (patch)
tree18b87895489844b4e516f79cd1588038f1d49494 /src/app.c
parentf6a54d5375aab9c41af3f7c8a5e8fcbd1e0c9287 (diff)
Revised runtime font management
The built-in fonts are loaded via FontPack, and the font table is now constructed dynamically based on available fonts. A full set of variants (style, size) are prepared for each font, but some of the data gets allocated lazily when needed. GmRun needed a larger allocation for fonts, so now all the fields are combined into a single bit field. TODO: Glyph scaling, vertical offsets, and symbol lookup are still not fully working.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/app.c b/src/app.c
index 5fc01a5b..3a96bd40 100644
--- a/src/app.c
+++ b/src/app.c
@@ -116,7 +116,7 @@ struct Impl_App {
116 iMimeHooks * mimehooks; 116 iMimeHooks * mimehooks;
117 iGmCerts * certs; 117 iGmCerts * certs;
118 iVisited * visited; 118 iVisited * visited;
119 iBookmarks * bookmarks; 119 iBookmarks * bookmarks;
120 iMainWindow *window; 120 iMainWindow *window;
121 iPtrArray popupWindows; 121 iPtrArray popupWindows;
122 iSortedArray tickers; /* per-frame callbacks, used for animations */ 122 iSortedArray tickers; /* per-frame callbacks, used for animations */
@@ -758,7 +758,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
758 listen_Ipc(); /* We'll respond to commands from other instances. */ 758 listen_Ipc(); /* We'll respond to commands from other instances. */
759 } 759 }
760#endif 760#endif
761 printf("Lagrange: A Beautiful Gemini Client\n"); 761 puts("Lagrange: A Beautiful Gemini Client");
762 const iBool isFirstRun = 762 const iBool isFirstRun =
763 !fileExistsCStr_FileInfo(cleanedPath_CStr(concatPath_CStr(dataDir_App_(), "prefs.cfg"))); 763 !fileExistsCStr_FileInfo(cleanedPath_CStr(concatPath_CStr(dataDir_App_(), "prefs.cfg")));
764 d->isFinishedLaunching = iFalse; 764 d->isFinishedLaunching = iFalse;
@@ -803,6 +803,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
803 setupApplication_iOS(); 803 setupApplication_iOS();
804#endif 804#endif
805 init_Keys(); 805 init_Keys();
806 init_Fonts(dataDir_App_());
806 loadPalette_Color(dataDir_App_()); 807 loadPalette_Color(dataDir_App_());
807 setThemePalette_Color(d->prefs.theme); /* default UI colors */ 808 setThemePalette_Color(d->prefs.theme); /* default UI colors */
808 loadPrefs_App_(d); 809 loadPrefs_App_(d);
@@ -883,6 +884,7 @@ static void deinit_App(iApp *d) {
883 deinit_Feeds(); 884 deinit_Feeds();
884 save_Keys(dataDir_App_()); 885 save_Keys(dataDir_App_());
885 deinit_Keys(); 886 deinit_Keys();
887 deinit_Fonts();
886 deinit_SiteSpec(); 888 deinit_SiteSpec();
887 savePrefs_App_(d); 889 savePrefs_App_(d);
888 deinit_Prefs(&d->prefs); 890 deinit_Prefs(&d->prefs);
@@ -2124,6 +2126,7 @@ iBool handleCommand_App(const char *cmd) {
2124 resetFonts_App_(d); 2126 resetFonts_App_(d);
2125 return iTrue; 2127 return iTrue;
2126 } 2128 }
2129#if 0
2127 else if (equal_Command(cmd, "font.user")) { 2130 else if (equal_Command(cmd, "font.user")) {
2128 const char *path = suffixPtr_Command(cmd, "path"); 2131 const char *path = suffixPtr_Command(cmd, "path");
2129 if (cmp_String(&d->prefs.symbolFontPath, path)) { 2132 if (cmp_String(&d->prefs.symbolFontPath, path)) {
@@ -2140,6 +2143,7 @@ iBool handleCommand_App(const char *cmd) {
2140 } 2143 }
2141 return iTrue; 2144 return iTrue;
2142 } 2145 }
2146#endif
2143 else if (equal_Command(cmd, "font.set")) { 2147 else if (equal_Command(cmd, "font.set")) {
2144 if (!isFrozen) { 2148 if (!isFrozen) {
2145 setFreezeDraw_MainWindow(get_MainWindow(), iTrue); 2149 setFreezeDraw_MainWindow(get_MainWindow(), iTrue);