summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-01-19 15:51:07 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-01-19 15:51:07 +0200
commita6146ac91c90a4003efd489ee3ada175203995cc (patch)
tree0ec4545734f49441c2638530ae0c5d617a763399 /src/app.c
parentea1b72af1b43c846ada3380ba422fffd400ed5b4 (diff)
Fontpack lookup via missing glyphs
IssueID #435
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/app.c b/src/app.c
index 4045610e..31f506b5 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2245,6 +2245,13 @@ void resetFonts_App(void) {
2245 } 2245 }
2246} 2246}
2247 2247
2248void availableFontsChanged_App(void) {
2249 iApp *d = &app_;
2250 iConstForEach(PtrArray, win, listWindows_App_(d, collectNew_PtrArray())) {
2251 resetMissing_Text(text_Window(win.ptr));
2252 }
2253}
2254
2248static void invalidateCachedDocuments_App_(void) { 2255static void invalidateCachedDocuments_App_(void) {
2249 iForEach(ObjectList, i, iClob(listDocuments_App(NULL))) { 2256 iForEach(ObjectList, i, iClob(listDocuments_App(NULL))) {
2250 invalidateCachedLayout_History(history_DocumentWidget(i.object)); 2257 invalidateCachedLayout_History(history_DocumentWidget(i.object));
@@ -2371,24 +2378,42 @@ iBool handleCommand_App(const char *cmd) {
2371 reload_Fonts(); /* also does font cache reset, window invalidation */ 2378 reload_Fonts(); /* also does font cache reset, window invalidation */
2372 return iTrue; 2379 return iTrue;
2373 } 2380 }
2374#if 0 2381 else if (equal_Command(cmd, "font.find")) {
2375 else if (equal_Command(cmd, "font.user")) { 2382 searchOnlineLibraryForCharacters_Fonts(string_Command(cmd, "chars"));
2376 const char *path = suffixPtr_Command(cmd, "path"); 2383 return iTrue;
2377 if (cmp_String(&d->prefs.symbolFontPath, path)) { 2384 }
2378 if (!isFrozen) { 2385 else if (equal_Command(cmd, "font.found")) {
2379 setFreezeDraw_MainWindow(get_MainWindow(), iTrue); 2386 if (hasLabel_Command(cmd, "error")) {
2380 } 2387 makeSimpleMessage_Widget("${heading.glyphfinder}",
2381 setCStr_String(&d->prefs.symbolFontPath, path); 2388 format_CStr("%d %s",
2382 loadUserFonts_Text(); 2389 argLabel_Command(cmd, "error"),
2383 resetFonts_App(d); 2390 suffixPtr_Command(cmd, "msg")));
2384 if (!isFrozen) { 2391 return iTrue;
2385 postCommand_App("font.changed"); 2392 }
2386 postCommand_App("window.unfreeze"); 2393 iString *src = collectNew_String();
2394 setCStr_String(src, "# ${heading.glyphfinder.results}\n\n");
2395 iRangecc path = iNullRange;
2396 iBool isFirst = iTrue;
2397 while (nextSplit_Rangecc(range_Command(cmd, "packs"), ";", &path)) {
2398 if (isFirst) {
2399 appendCStr_String(src, "${glyphfinder.results}\n\n");
2387 } 2400 }
2401 const char *fp = cstr_Rangecc(path);
2402 appendFormat_String(src, "=> gemini://skyjake.fi/fonts/%s %s\n", fp, fp);
2403 isFirst = iFalse;
2404 }
2405 if (isFirst) {
2406 appendFormat_String(src, "${glyphfinder.results.empty}\n");
2388 } 2407 }
2408 appendCStr_String(src, "\n=> about:fonts ${menu.fonts}");
2409 iDocumentWidget *page = newTab_App(NULL, iTrue);
2410 translate_Lang(src);
2411 setUrlAndSource_DocumentWidget(page,
2412 collectNewCStr_String(""),
2413 collectNewCStr_String("text/gemini"),
2414 utf8_String(src));
2389 return iTrue; 2415 return iTrue;
2390 } 2416 }
2391#endif
2392 else if (equal_Command(cmd, "font.set")) { 2417 else if (equal_Command(cmd, "font.set")) {
2393 if (!isFrozen) { 2418 if (!isFrozen) {
2394 setFreezeDraw_MainWindow(get_MainWindow(), iTrue); 2419 setFreezeDraw_MainWindow(get_MainWindow(), iTrue);