=> 12a6fc81e8d11dc21db5938132818972df08e885
[1mdiff --git a/res/fontpack.ini b/res/fontpack.ini[m [1mindex 920a4ad2..08c127f6 100644[m [1m--- a/res/fontpack.ini[m [1m+++ b/res/fontpack.ini[m [36m@@ -36,7 +36,7 @@[m [mregular = "fonts/IosevkaTerm-Extended.ttf"[m # Matches the baseline and ascent of the default font.[m name = "Iosevka"[m monospace = true[m [31m-priority = -10[m [32m+[m[32mpriority = 1[m glyphscale = 0.800[m regular = "fonts/IosevkaTerm-Extended.ttf"[m [m [1mdiff --git a/src/ui/mediaui.c b/src/ui/mediaui.c[m [1mindex f0070688..2ddebb57 100644[m [1m--- a/src/ui/mediaui.c[m [1m+++ b/src/ui/mediaui.c[m [36m@@ -104,7 +104,7 @@[m [mstatic int drawSevenSegmentTime_(iInt2 pos, int color, int align, int seconds) {[m if (align == right_Alignment) {[m pos.x -= size.x;[m }[m [31m- drawRange_Text(font, addY_I2(pos, gap_UI / 2), color, range_String(&num));[m [32m+[m[32m drawRange_Text(font, addY_I2(pos, 0/*gap_UI / 2*/), color, range_String(&num));[m deinit_String(&num);[m return size.x;[m }[m [36m@@ -316,7 +316,7 @@[m [mvoid draw_DownloadUI(const iDownloadUI *d, iPaint *p) {[m isFinished ? uiTextAction_ColorId : uiTextDim_ColorId,[m cstr_Lang(isFinished ? "media.download.complete" : "media.download.warnclose"));[m const int x2 = right_Rect(rect);[m [31m- drawSevenSegmentBytes_MediaUI(uiLabel_FontId, init_I2(x2, y1),[m [32m+[m[32m drawSevenSegmentBytes_MediaUI(uiContent_FontId, init_I2(x2, y1),[m uiTextStrong_ColorId, uiTextDim_ColorId,[m info.numBytes);[m const iInt2 pos = init_I2(x2, y2);[m [1mdiff --git a/src/ui/text.c b/src/ui/text.c[m [1mindex 200108ed..e49034ca 100644[m [1m--- a/src/ui/text.c[m [1m+++ b/src/ui/text.c[m [36m@@ -246,12 +246,24 @@[m [mstruct Impl_CacheRow {[m iInt2 pos;[m };[m [m [32m+[m[32miDeclareType(PrioMapItem)[m [32m+[m[32mstruct Impl_PrioMapItem {[m [32m+[m[32m int priority;[m [32m+[m[32m uint32_t fontIndex;[m [32m+[m[32m};[m [32m+[m [32m+[m[32mstatic int cmp_PrioMapItem_(const void *a, const void *b) {[m [32m+[m[32m const iPrioMapItem *i = a, *j = b;[m [32m+[m[32m return -iCmp(i->priority, j->priority);[m [32m+[m[32m}[m [32m+[m struct Impl_Text {[m // enum iTextFont contentFont;[m // enum iTextFont headingFont;[m float contentFontSize;[m iArray fonts; /* fonts currently selected for use (incl. all styles/sizes) */[m [31m- int overrideFontId; /* always checked for glyphs first, regardless of which font is used */[m [32m+[m[32m int overrideFontId; /* always checked for glyphs first, regardless of which font is used */[m[41m [m [32m+[m[32m iArray fontPriorityOrder;[m SDL_Renderer * render;[m SDL_Texture * cache;[m iInt2 cacheSize;[m [36m@@ -284,8 +296,9 @@[m [mstatic void setupFontVariants_Text_(iText *d, const iFontSpec *spec, int baseId)[m /* This is the highest priority override font. */[m d->overrideFontId = baseId;[m }[m [32m+[m[32m pushBack_Array(&d->fontPriorityOrder, &(iPrioMapItem){ spec->priority, baseId });[m for (enum iFontStyle style = 0; style < max_FontStyle; style++) {[m [31m- for (enum iFontSize sizeId = 0; sizeId < max_FontSize; sizeId++) {[m [32m+[m[32m for (enum iFontSize sizeId = 0; sizeId < max_FontSize; sizeId++) {[m[41m [m init_Font(font_Text_(FONT_ID(baseId, style, sizeId)),[m spec,[m spec->styles[style],[m [36m@@ -322,6 +335,7 @@[m [mstatic void initFonts_Text_(iText *d) {[m and styles for each available font. Indices to `fonts` act as font runtime IDs. */[m /* First the mandatory fonts. */[m d->overrideFontId = -1;[m [32m+[m[32m clear_Array(&d->fontPriorityOrder);[m resize_Array(&d->fonts, auxiliary_FontId); /* room for the built-ins */[m setupFontVariants_Text_(d, tryFindSpec_(uiFont_PrefsString, "default"), default_FontId);[m setupFontVariants_Text_(d, tryFindSpec_(monospaceFont_PrefsString, "iosevka"), monospace_FontId);[m [36m@@ -331,12 +345,14 @@[m [mstatic void initFonts_Text_(iText *d) {[m /* Check if there are auxiliary fonts available and set those up, too. */[m iConstForEach(PtrArray, s, listSpecsByPriority_Fonts()) {[m const iFontSpec *spec = s.ptr;[m [32m+[m[32m// printf("spec '%s': prio=%d\n", cstr_String(&spec->name), spec->priority);[m if (spec->flags & (auxiliary_FontSpecFlag | user_FontSpecFlag)) {[m const int fontId = size_Array(&d->fonts);[m resize_Array(&d->fonts, fontId + maxVariants_Fonts);[m setupFontVariants_Text_(d, spec, fontId);[m }[m }[m [32m+[m[32m sort_Array(&d->fontPriorityOrder, cmp_PrioMapItem_);[m #if !defined (NDEBUG)[m printf("[Text] %zu font variants ready\n", size_Array(&d->fonts));[m #endif[m [36m@@ -402,6 +418,7 @@[m [mvoid init_Text(iText *d, SDL_Renderer *render) {[m iText *oldActive = activeText_;[m activeText_ = d;[m init_Array(&d->fonts, sizeof(iFont));[m [32m+[m[32m init_Array(&d->fontPriorityOrder, sizeof(iPrioMapItem));[m d->contentFontSize = contentScale_Text_;[m d->ansiEscape = makeAnsiEscapePattern_Text(iFalse /* no ESC */);[m d->baseFontId = -1;[m [36m@@ -436,6 +453,7 @@[m [mvoid deinit_Text(iText *d) {[m deinitCache_Text_(d);[m d->render = NULL;[m iRelease(d->ansiEscape);[m [32m+[m[32m deinit_Array(&d->fontPriorityOrder);[m deinit_Array(&d->fonts);[m }[m [m [36m@@ -571,25 +589,24 @@[m [miLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) {[m if ((*glyphIndex = glyphIndex_Font_(d, ch)) != 0) {[m return d;[m }[m [31m- /* As a fallback, check all other available fonts of this size. */[m [31m- for (int aux = 0; aux < 2; aux++) {[m [31m- for (iFont *font = font_Text_(FONT_ID(0, styleId, sizeId));[m [31m- font < (iFont *) end_Array(&activeText_->fonts);[m [31m- font += maxVariants_Fonts) {[m [31m- const iBool isAuxiliary = (font->fontSpec->flags & auxiliary_FontSpecFlag) ? 1 : 0;[m [31m- if (aux == isAuxiliary) {[m [31m- /* First try auxiliary fonts, then other remaining fonts. */[m [31m- continue;[m [31m- }[m [31m- if (font == d || font == overrideFont) {[m [31m- continue; /* already checked this one */[m [31m- }[m [31m- if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) {[m [31m-// printf("using %s[%f] for %lc (%x) => %d\n",[m [31m-// cstr_String(&font->fontSpec->name), font->fontSpec->scaling,[m [31m-// (int) ch, ch, glyphIndex_Font_(font, ch));[m [31m- return font;[m [31m- }[m [32m+[m[32m /* As a fallback, check all other available fonts of this size in priority order. */[m [32m+[m[32m iConstForEach(Array, i, &activeText_->fontPriorityOrder) {[m [32m+[m[32m iFont *font = font_Text_(FONT_ID(((const iPrioMapItem *) i.value)->fontIndex,[m [32m+[m[32m styleId, sizeId));[m [32m+[m[32m if (font == d || font == overrideFont) {[m [32m+[m[32m continue; /* already checked this one */[m [32m+[m[32m }[m [32m+[m[32m if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) {[m [32m+[m[32m#if 0[m [32m+[m[32m printf("using '%s' (pr:%d) for %lc (%x) => %d [missing in '%s']\n",[m [32m+[m[32m cstr_String(&font->fontSpec->id),[m [32m+[m[32m font->fontSpec->priority,[m [32m+[m[32m (int) ch,[m [32m+[m[32m ch,[m [32m+[m[32m glyphIndex_Font_(font, ch),[m [32m+[m[32m cstr_String(&d->fontSpec->id));[m [32m+[m[32m#endif[m [32m+[m[32m return font;[m }[m }[m if (!*glyphIndex) {[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).