diff options
Diffstat (limited to 'src/fontpack.c')
-rw-r--r-- | src/fontpack.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/fontpack.c b/src/fontpack.c index bbf1833e..79f35526 100644 --- a/src/fontpack.c +++ b/src/fontpack.c | |||
@@ -21,7 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | 21 | SOFTWARE, 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 | ||
@@ -79,6 +79,15 @@ void init_FontFile(iFontFile *d) { | |||
79 | 79 | ||
80 | static void load_FontFile_(iFontFile *d, const iBlock *data) { | 80 | static void load_FontFile_(iFontFile *d, const iBlock *data) { |
81 | set_Block(&d->sourceData, data); | 81 | set_Block(&d->sourceData, data); |
82 | #if 0 | ||
83 | /* Count the number of available fonts. */ | ||
84 | for (int i = 0; ; i++) { | ||
85 | if (stbtt_GetFontOffsetForIndex(constData_Block(&d->sourceData), i) < 0) { | ||
86 | printf("%s: contains %d fonts\n", cstr_String(&d->id), i); | ||
87 | break; | ||
88 | } | ||
89 | } | ||
90 | #endif | ||
82 | const size_t offset = stbtt_GetFontOffsetForIndex(constData_Block(&d->sourceData), | 91 | const size_t offset = stbtt_GetFontOffsetForIndex(constData_Block(&d->sourceData), |
83 | d->colIndex); | 92 | d->colIndex); |
84 | stbtt_InitFont(&d->stbInfo, constData_Block(data), offset); | 93 | stbtt_InitFont(&d->stbInfo, constData_Block(data), offset); |
@@ -581,11 +590,8 @@ void init_Fonts(const char *userDir) { | |||
581 | /* Load the required fonts. */ { | 590 | /* Load the required fonts. */ { |
582 | iFontPack *pack = new_FontPack(); | 591 | iFontPack *pack = new_FontPack(); |
583 | setCStr_String(&pack->id, "default"); | 592 | setCStr_String(&pack->id, "default"); |
584 | iArchive *arch = new_Archive(); | ||
585 | setReadOnly_FontPack(pack, iTrue); | 593 | setReadOnly_FontPack(pack, iTrue); |
586 | openData_Archive(arch, &fontpackDefault_Embedded); | 594 | loadArchive_FontPack(pack, archive_Resources()); /* should never fail if we've made it this far */ |
587 | loadArchive_FontPack(pack, arch); /* should never fail if we've made it this far */ | ||
588 | iRelease(arch); | ||
589 | pushBack_PtrArray(&d->packs, pack); | 595 | pushBack_PtrArray(&d->packs, pack); |
590 | } | 596 | } |
591 | /* Find and load .fontpack files in known locations. */ { | 597 | /* Find and load .fontpack files in known locations. */ { |