summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fontpack.c19
-rw-r--r--src/fontpack.h2
-rw-r--r--src/ui/documentwidget.c2
3 files changed, 16 insertions, 7 deletions
diff --git a/src/fontpack.c b/src/fontpack.c
index 924d4781..96006226 100644
--- a/src/fontpack.c
+++ b/src/fontpack.c
@@ -749,7 +749,7 @@ const iPtrArray *listSpecsByPriority_Fonts(void) {
749 return &fonts_.specOrder; 749 return &fonts_.specOrder;
750} 750}
751 751
752iString *infoText_FontPack(const iFontPack *d) { 752iString *infoText_FontPack(const iFontPack *d, iBool isFull) {
753 const iFontPack *installed = pack_Fonts(cstr_String(&d->id)); 753 const iFontPack *installed = pack_Fonts(cstr_String(&d->id));
754 const iBool isInstalled = (installed != NULL); 754 const iBool isInstalled = (installed != NULL);
755 const int installedVersion = installed ? installed->version : 0; 755 const int installedVersion = installed ? installed->version : 0;
@@ -758,9 +758,17 @@ iString *infoText_FontPack(const iFontPack *d) {
758 size_t sizeInBytes = 0; 758 size_t sizeInBytes = 0;
759 iPtrSet *uniqueFiles = new_PtrSet(); 759 iPtrSet *uniqueFiles = new_PtrSet();
760 iStringList *names = new_StringList(); 760 iStringList *names = new_StringList();
761 size_t numNames = 0;
762 iBool isAbbreviated = iFalse;
761 iConstForEach(PtrArray, i, listSpecs_FontPack(d)) { 763 iConstForEach(PtrArray, i, listSpecs_FontPack(d)) {
762 const iFontSpec *spec = i.ptr; 764 const iFontSpec *spec = i.ptr;
763 pushBack_StringList(names, &spec->name); 765 numNames++;
766 if (isFull || size_StringList(names) < 20) {
767 pushBack_StringList(names, &spec->name);
768 }
769 else {
770 isAbbreviated = iTrue;
771 }
764 iForIndices(j, spec->styles) { 772 iForIndices(j, spec->styles) {
765 insert_PtrSet(uniqueFiles, spec->styles[j]->sourceData.i); 773 insert_PtrSet(uniqueFiles, spec->styles[j]->sourceData.i);
766 } 774 }
@@ -778,11 +786,12 @@ iString *infoText_FontPack(const iFontPack *d) {
778 if (!endsWith_String(str, "(")) { 786 if (!endsWith_String(str, "(")) {
779 appendCStr_String(str, ", "); 787 appendCStr_String(str, ", ");
780 } 788 }
781 appendCStr_String(str, formatCStrs_Lang("num.fonts.n", size_StringList(names))); 789 appendCStr_String(str, formatCStrs_Lang("num.fonts.n", numNames));
782 } 790 }
783 appendFormat_String(str, ")"); 791 appendFormat_String(str, ")");
784 } 792 }
785 appendFormat_String(str, " \u2014 %s\n", cstrCollect_String(joinCStr_StringList(names, ", "))); 793 appendFormat_String(str, " \u2014 %s%s\n", cstrCollect_String(joinCStr_StringList(names, ", ")),
794 isAbbreviated ? ", ..." : "");
786 if (isInstalled && installedVersion != d->version) { 795 if (isInstalled && installedVersion != d->version) {
787 appendCStr_String(str, format_Lang("${fontpack.meta.version}\n", d->version)); 796 appendCStr_String(str, format_Lang("${fontpack.meta.version}\n", d->version));
788 } 797 }
@@ -946,7 +955,7 @@ const iString *infoPage_Fonts(iRangecc query) {
946 appendFormat_String(str, "### %s\n", 955 appendFormat_String(str, "### %s\n",
947 isEmpty_String(packId) ? "fonts.ini" : 956 isEmpty_String(packId) ? "fonts.ini" :
948 cstr_String(packId)); 957 cstr_String(packId));
949 append_String(str, collect_String(infoText_FontPack(pack))); 958 append_String(str, collect_String(infoText_FontPack(pack, iFalse)));
950 appendFormat_String(str, "=> %s ${fontpack.meta.viewfile}\n", 959 appendFormat_String(str, "=> %s ${fontpack.meta.viewfile}\n",
951 cstrCollect_String(makeFileUrl_String(&spec->sourcePath))); 960 cstrCollect_String(makeFileUrl_String(&spec->sourcePath)));
952 if (pack->isStandalone) { 961 if (pack->isStandalone) {
diff --git a/src/fontpack.h b/src/fontpack.h
index 27ecd087..f6d4d483 100644
--- a/src/fontpack.h
+++ b/src/fontpack.h
@@ -160,7 +160,7 @@ const iString * loadPath_FontPack (const iFontPack *); /* may return N
160iBool isDisabled_FontPack (const iFontPack *); 160iBool isDisabled_FontPack (const iFontPack *);
161iBool isReadOnly_FontPack (const iFontPack *); 161iBool isReadOnly_FontPack (const iFontPack *);
162const iPtrArray * listSpecs_FontPack (const iFontPack *); 162const iPtrArray * listSpecs_FontPack (const iFontPack *);
163iString * infoText_FontPack (const iFontPack *); 163iString * infoText_FontPack (const iFontPack *, iBool isFull);
164const iArray * actions_FontPack (const iFontPack *, iBool showInstalled); 164const iArray * actions_FontPack (const iFontPack *, iBool showInstalled);
165 165
166const iString * idFromUrl_FontPack (const iString *url); 166const iString * idFromUrl_FontPack (const iString *url);
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index fdb55232..03119ca2 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -2659,7 +2659,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
2659 if (loadArchive_FontPack(fp, zip)) { 2659 if (loadArchive_FontPack(fp, zip)) {
2660 appendFormat_String(&str, "# " fontpack_Icon "%s\n%s", 2660 appendFormat_String(&str, "# " fontpack_Icon "%s\n%s",
2661 cstr_String(id_FontPack(fp).id), 2661 cstr_String(id_FontPack(fp).id),
2662 cstrCollect_String(infoText_FontPack(fp))); 2662 cstrCollect_String(infoText_FontPack(fp, iTrue)));
2663 } 2663 }
2664 appendCStr_String(&str, "\n"); 2664 appendCStr_String(&str, "\n");
2665 appendCStr_String(&str, cstr_Lang("fontpack.help")); 2665 appendCStr_String(&str, cstr_Lang("fontpack.help"));