summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-30 13:24:11 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-30 13:25:44 +0300
commitdc2ebbc8faaa8b487a7a498874ee83554b234151 (patch)
treef8809c8d405293014b5d46d1de60ad5fed789f29 /src
parent18c39ae5569d01a5ceff0ed18692983a555b0501 (diff)
Windows: Fixed path handling issues during font loading
Diffstat (limited to 'src')
-rw-r--r--src/fontpack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fontpack.c b/src/fontpack.c
index ec62702f..40e4c96c 100644
--- a/src/fontpack.c
+++ b/src/fontpack.c
@@ -389,6 +389,7 @@ void handleIniKeyValue_FontPack_(void *context, const iString *table, const iStr
389 } 389 }
390 } 390 }
391 iString *fontFileId = concat_Path(d->loadPath, cleanPath); 391 iString *fontFileId = concat_Path(d->loadPath, cleanPath);
392 iAssert(!isEmpty_String(fontFileId));
392 /* FontFiles share source data blocks. The entire FontFiles can be reused, too, 393 /* FontFiles share source data blocks. The entire FontFiles can be reused, too,
393 if have the same collection index is in use. */ 394 if have the same collection index is in use. */
394 iBlock *data = NULL; 395 iBlock *data = NULL;
@@ -466,6 +467,7 @@ iBool loadArchive_FontPack(iFontPack *d, const iArchive *zip) {
466} 467}
467 468
468void setLoadPath_FontPack(iFontPack *d, const iString *path) { 469void setLoadPath_FontPack(iFontPack *d, const iString *path) {
470 /* Note: `path` is for the local file system. */
469 if (!d->loadPath) { 471 if (!d->loadPath) {
470 d->loadPath = new_String(); 472 d->loadPath = new_String();
471 } 473 }
@@ -480,7 +482,8 @@ const iString *idFromUrl_FontPack(const iString *url) {
480 iString *id = new_String(); 482 iString *id = new_String();
481 iUrl parts; 483 iUrl parts;
482 init_Url(&parts, url); 484 init_Url(&parts, url);
483 setRange_String(id, baseName_Path(collectNewRange_String(parts.path))); 485 /* URLs always use slash as separator. */
486 setRange_String(id, baseNameSep_Path(collectNewRange_String(parts.path), "/"));
484 setRange_String(id, withoutExtension_Path(id)); 487 setRange_String(id, withoutExtension_Path(id));
485 replace_String(id, " ", "-"); 488 replace_String(id, " ", "-");
486 return collect_String(id); 489 return collect_String(id);