From aa52b2610302030bc9728a5346fc0d887032480a Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 6 Feb 2022 15:07:57 +0200 Subject: Recompiled UI strings --- res/lang/eo.bin | Bin 26163 -> 26155 bytes res/lang/ie.bin | Bin 29655 -> 29705 bytes 2 files changed, 0 insertions(+), 0 deletions(-) (limited to 'res') diff --git a/res/lang/eo.bin b/res/lang/eo.bin index ace592df..61f9ea68 100644 Binary files a/res/lang/eo.bin and b/res/lang/eo.bin differ diff --git a/res/lang/ie.bin b/res/lang/ie.bin index 722ee20d..7528934d 100644 Binary files a/res/lang/ie.bin and b/res/lang/ie.bin differ -- cgit v1.2.3 From 97b10dfbf4e126d7ba01abd41f2578bdce0be200 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 7 Feb 2022 15:10:35 +0200 Subject: Updated release notes --- res/about/version.gmi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'res') diff --git a/res/about/version.gmi b/res/about/version.gmi index 15336d77..da416732 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -9,6 +9,7 @@ ## 1.10.5 * Fixed animation issue with sidebars in the right side of split view. * macOS: Fixed a sidebar clipping issue with Metal. +* Updated UI translations. ## 1.10.4 * Added missing ANSI background color codes 100-107 (high-intensity VGA). @@ -17,7 +18,6 @@ * Fixed tab/window titles containing ANSI escapes (escapes are removed). * macOS: Use Metal for drawing graphics if display refresh rate is higher than 60 Hz. * macOS: Handling scroll events meant for other windows. -* Updated UI translations. ## 1.10.3 * Unix: Added a lagrange(1) manual page. -- cgit v1.2.3 From bd83aca1b20e5583568faff0251e9d5a0c62df5b Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 8 Feb 2022 15:20:39 +0200 Subject: Updated release notes --- res/about/version.gmi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'res') diff --git a/res/about/version.gmi b/res/about/version.gmi index da416732..cc378a87 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -7,8 +7,12 @@ # Release notes ## 1.10.5 +* The "Miscellaneous Symbols and Arrows" Unicode block (U+2B00...U+2BFF) is accepted as custom link icons. * Fixed animation issue with sidebars in the right side of split view. +* Fixed a refresh issue that caused the first line of the page to be redrawn continuously, spiking CPU usage. +* Fixed link numbers showing up next to image captions. * macOS: Fixed a sidebar clipping issue with Metal. +* macOS: Possible workaround for a window refresh glitch when using SDL's Metal renderer. (Sometimes animated elements like the URL hover info would stop at being partially transparent and not complete the fade.) * Updated UI translations. ## 1.10.4 -- cgit v1.2.3 From 12a6fc81e8d11dc21db5938132818972df08e885 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 8 Feb 2022 21:24:34 +0200 Subject: Fonts: Improved fallback glyph search The fontpack documentation says that when a glyph isn't found, all available fonts are checked in priority order. However, the implementation didn't actually do this. Now there is a separate priority mapping for loaded fonts so they can be quickly scanned for any missing glyphs in the right order. "iosevka-body" was prioritized higher because it provides a number of UI icons. --- res/fontpack.ini | 2 +- src/ui/mediaui.c | 4 ++-- src/ui/text.c | 59 ++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 41 insertions(+), 24 deletions(-) (limited to 'res') diff --git a/res/fontpack.ini b/res/fontpack.ini index 920a4ad2..08c127f6 100644 --- a/res/fontpack.ini +++ b/res/fontpack.ini @@ -36,7 +36,7 @@ regular = "fonts/IosevkaTerm-Extended.ttf" # Matches the baseline and ascent of the default font. name = "Iosevka" monospace = true -priority = -10 +priority = 1 glyphscale = 0.800 regular = "fonts/IosevkaTerm-Extended.ttf" diff --git a/src/ui/mediaui.c b/src/ui/mediaui.c index f0070688..2ddebb57 100644 --- a/src/ui/mediaui.c +++ b/src/ui/mediaui.c @@ -104,7 +104,7 @@ static int drawSevenSegmentTime_(iInt2 pos, int color, int align, int seconds) { if (align == right_Alignment) { pos.x -= size.x; } - drawRange_Text(font, addY_I2(pos, gap_UI / 2), color, range_String(&num)); + drawRange_Text(font, addY_I2(pos, 0/*gap_UI / 2*/), color, range_String(&num)); deinit_String(&num); return size.x; } @@ -316,7 +316,7 @@ void draw_DownloadUI(const iDownloadUI *d, iPaint *p) { isFinished ? uiTextAction_ColorId : uiTextDim_ColorId, cstr_Lang(isFinished ? "media.download.complete" : "media.download.warnclose")); const int x2 = right_Rect(rect); - drawSevenSegmentBytes_MediaUI(uiLabel_FontId, init_I2(x2, y1), + drawSevenSegmentBytes_MediaUI(uiContent_FontId, init_I2(x2, y1), uiTextStrong_ColorId, uiTextDim_ColorId, info.numBytes); const iInt2 pos = init_I2(x2, y2); diff --git a/src/ui/text.c b/src/ui/text.c index 200108ed..e49034ca 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -246,12 +246,24 @@ struct Impl_CacheRow { iInt2 pos; }; +iDeclareType(PrioMapItem) +struct Impl_PrioMapItem { + int priority; + uint32_t fontIndex; +}; + +static int cmp_PrioMapItem_(const void *a, const void *b) { + const iPrioMapItem *i = a, *j = b; + return -iCmp(i->priority, j->priority); +} + struct Impl_Text { // enum iTextFont contentFont; // enum iTextFont headingFont; float contentFontSize; iArray fonts; /* fonts currently selected for use (incl. all styles/sizes) */ - int overrideFontId; /* always checked for glyphs first, regardless of which font is used */ + int overrideFontId; /* always checked for glyphs first, regardless of which font is used */ + iArray fontPriorityOrder; SDL_Renderer * render; SDL_Texture * cache; iInt2 cacheSize; @@ -284,8 +296,9 @@ static void setupFontVariants_Text_(iText *d, const iFontSpec *spec, int baseId) /* This is the highest priority override font. */ d->overrideFontId = baseId; } + pushBack_Array(&d->fontPriorityOrder, &(iPrioMapItem){ spec->priority, baseId }); for (enum iFontStyle style = 0; style < max_FontStyle; style++) { - for (enum iFontSize sizeId = 0; sizeId < max_FontSize; sizeId++) { + for (enum iFontSize sizeId = 0; sizeId < max_FontSize; sizeId++) { init_Font(font_Text_(FONT_ID(baseId, style, sizeId)), spec, spec->styles[style], @@ -322,6 +335,7 @@ static void initFonts_Text_(iText *d) { and styles for each available font. Indices to `fonts` act as font runtime IDs. */ /* First the mandatory fonts. */ d->overrideFontId = -1; + clear_Array(&d->fontPriorityOrder); resize_Array(&d->fonts, auxiliary_FontId); /* room for the built-ins */ setupFontVariants_Text_(d, tryFindSpec_(uiFont_PrefsString, "default"), default_FontId); setupFontVariants_Text_(d, tryFindSpec_(monospaceFont_PrefsString, "iosevka"), monospace_FontId); @@ -331,12 +345,14 @@ static void initFonts_Text_(iText *d) { /* Check if there are auxiliary fonts available and set those up, too. */ iConstForEach(PtrArray, s, listSpecsByPriority_Fonts()) { const iFontSpec *spec = s.ptr; +// printf("spec '%s': prio=%d\n", cstr_String(&spec->name), spec->priority); if (spec->flags & (auxiliary_FontSpecFlag | user_FontSpecFlag)) { const int fontId = size_Array(&d->fonts); resize_Array(&d->fonts, fontId + maxVariants_Fonts); setupFontVariants_Text_(d, spec, fontId); } } + sort_Array(&d->fontPriorityOrder, cmp_PrioMapItem_); #if !defined (NDEBUG) printf("[Text] %zu font variants ready\n", size_Array(&d->fonts)); #endif @@ -402,6 +418,7 @@ void init_Text(iText *d, SDL_Renderer *render) { iText *oldActive = activeText_; activeText_ = d; init_Array(&d->fonts, sizeof(iFont)); + init_Array(&d->fontPriorityOrder, sizeof(iPrioMapItem)); d->contentFontSize = contentScale_Text_; d->ansiEscape = makeAnsiEscapePattern_Text(iFalse /* no ESC */); d->baseFontId = -1; @@ -436,6 +453,7 @@ void deinit_Text(iText *d) { deinitCache_Text_(d); d->render = NULL; iRelease(d->ansiEscape); + deinit_Array(&d->fontPriorityOrder); deinit_Array(&d->fonts); } @@ -571,25 +589,24 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { if ((*glyphIndex = glyphIndex_Font_(d, ch)) != 0) { return d; } - /* As a fallback, check all other available fonts of this size. */ - for (int aux = 0; aux < 2; aux++) { - for (iFont *font = font_Text_(FONT_ID(0, styleId, sizeId)); - font < (iFont *) end_Array(&activeText_->fonts); - font += maxVariants_Fonts) { - const iBool isAuxiliary = (font->fontSpec->flags & auxiliary_FontSpecFlag) ? 1 : 0; - if (aux == isAuxiliary) { - /* First try auxiliary fonts, then other remaining fonts. */ - continue; - } - if (font == d || font == overrideFont) { - continue; /* already checked this one */ - } - if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) { -// printf("using %s[%f] for %lc (%x) => %d\n", -// cstr_String(&font->fontSpec->name), font->fontSpec->scaling, -// (int) ch, ch, glyphIndex_Font_(font, ch)); - return font; - } + /* As a fallback, check all other available fonts of this size in priority order. */ + iConstForEach(Array, i, &activeText_->fontPriorityOrder) { + iFont *font = font_Text_(FONT_ID(((const iPrioMapItem *) i.value)->fontIndex, + styleId, sizeId)); + if (font == d || font == overrideFont) { + continue; /* already checked this one */ + } + if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) { +#if 0 + printf("using '%s' (pr:%d) for %lc (%x) => %d [missing in '%s']\n", + cstr_String(&font->fontSpec->id), + font->fontSpec->priority, + (int) ch, + ch, + glyphIndex_Font_(font, ch), + cstr_String(&d->fontSpec->id)); +#endif + return font; } } if (!*glyphIndex) { -- cgit v1.2.3 From 5f8b5693607e2bd65a99e7c589c69cee37925a33 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 9 Feb 2022 06:06:20 +0200 Subject: Updated release notes --- res/about/version.gmi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'res') diff --git a/res/about/version.gmi b/res/about/version.gmi index cc378a87..7c2a5bb6 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -8,6 +8,8 @@ ## 1.10.5 * The "Miscellaneous Symbols and Arrows" Unicode block (U+2B00...U+2BFF) is accepted as custom link icons. +* Faster hover-scrolling of long popup menus. +* Fixed lookup of missing glyphs. Fontpack priorities are now applied as documented. * Fixed animation issue with sidebars in the right side of split view. * Fixed a refresh issue that caused the first line of the page to be redrawn continuously, spiking CPU usage. * Fixed link numbers showing up next to image captions. -- cgit v1.2.3 From 3701cdcdc96beaf8dd0aa5c6fd82db5ea760652f Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 9 Feb 2022 06:57:47 +0200 Subject: Updated release notes --- res/about/version.gmi | 1 + 1 file changed, 1 insertion(+) (limited to 'res') diff --git a/res/about/version.gmi b/res/about/version.gmi index 7c2a5bb6..41b4fed7 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -8,6 +8,7 @@ ## 1.10.5 * The "Miscellaneous Symbols and Arrows" Unicode block (U+2B00...U+2BFF) is accepted as custom link icons. +* When mixing Emoji into preformatted text (glyphs are from different fonts), lay out the Emoji as double-wide characters to avoid overlapping. * Faster hover-scrolling of long popup menus. * Fixed lookup of missing glyphs. Fontpack priorities are now applied as documented. * Fixed animation issue with sidebars in the right side of split view. -- cgit v1.2.3 From 4ae755de3ff4a37763aacc22ea119edab2099e84 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 9 Feb 2022 10:40:08 +0200 Subject: DocumentWidget: "Paste Preceding Line" should be undoable --- res/about/version.gmi | 1 + src/ui/inputwidget.c | 17 ++++++++++++++++- src/ui/inputwidget.h | 2 ++ src/ui/util.c | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) (limited to 'res') diff --git a/res/about/version.gmi b/res/about/version.gmi index 41b4fed7..905b0221 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi @@ -10,6 +10,7 @@ * The "Miscellaneous Symbols and Arrows" Unicode block (U+2B00...U+2BFF) is accepted as custom link icons. * When mixing Emoji into preformatted text (glyphs are from different fonts), lay out the Emoji as double-wide characters to avoid overlapping. * Faster hover-scrolling of long popup menus. +* Fixed "Paste Preceding Line" not being undoable. * Fixed lookup of missing glyphs. Fontpack priorities are now applied as documented. * Fixed animation issue with sidebars in the right side of split view. * Fixed a refresh issue that caused the first line of the page to be redrawn continuously, spiking CPU usage. diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index aa55f3f0..6a8d428a 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c @@ -1115,7 +1115,14 @@ static void updateBuffered_InputWidget_(iInputWidget *d) { } void setText_InputWidget(iInputWidget *d, const iString *text) { + setTextUndoable_InputWidget(d, text, iFalse); +} + +void setTextUndoable_InputWidget(iInputWidget *d, const iString *text, iBool isUndoable) { if (!d) return; + if (isUndoable) { + pushUndo_InputWidget_(d); + } if (d->inFlags & isUrl_InputWidgetFlag) { if (prefs_App()->decodeUserVisibleURLs) { iString *enc = collect_String(copy_String(text)); @@ -1139,7 +1146,9 @@ void setText_InputWidget(iInputWidget *d, const iString *text) { iString *nfcText = collect_String(copy_String(text)); normalize_String(nfcText); #if !LAGRANGE_USE_SYSTEM_TEXT_INPUT - clearUndo_InputWidget_(d); + if (!isUndoable) { + clearUndo_InputWidget_(d); + } splitToLines_(nfcText, &d->lines); iAssert(!isEmpty_Array(&d->lines)); iForEach(Array, i, &d->lines) { @@ -1175,6 +1184,12 @@ void setTextCStr_InputWidget(iInputWidget *d, const char *cstr) { delete_String(str); } +void setTextUndoableCStr_InputWidget(iInputWidget *d, const char *cstr, iBool isUndoable) { + iString *str = newCStr_String(cstr); + setTextUndoable_InputWidget(d, str, isUndoable); + delete_String(str); +} + void selectAll_InputWidget(iInputWidget *d) { #if LAGRANGE_USE_SYSTEM_TEXT_INPUT if (d->sysCtrl) { diff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h index 5a61ec22..000fa4b7 100644 --- a/src/ui/inputwidget.h +++ b/src/ui/inputwidget.h @@ -46,6 +46,8 @@ void setMode_InputWidget (iInputWidget *, enum iInputMode mode); void setMaxLen_InputWidget (iInputWidget *, size_t maxLen); void setText_InputWidget (iInputWidget *, const iString *text); void setTextCStr_InputWidget (iInputWidget *, const char *cstr); +void setTextUndoable_InputWidget (iInputWidget *, const iString *text, iBool isUndoable); +void setTextUndoableCStr_InputWidget (iInputWidget *, const char *cstr, iBool isUndoable); void setFont_InputWidget (iInputWidget *, int fontId); void setContentPadding_InputWidget (iInputWidget *, int left, int right); /* only affects the text entry */ void setLineLimits_InputWidget (iInputWidget *, int minLines, int maxLines); diff --git a/src/ui/util.c b/src/ui/util.c index 31907721..5dd8a0bd 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -1778,7 +1778,7 @@ iBool valueInputHandler_(iWidget *dlg, const char *cmd) { } else if (equal_Command(cmd, "valueinput.set")) { iInputWidget *input = findChild_Widget(dlg, "input"); - setTextCStr_InputWidget(input, suffixPtr_Command(cmd, "text")); + setTextUndoableCStr_InputWidget(input, suffixPtr_Command(cmd, "text"), iTrue); validate_InputWidget(input); return iTrue; } -- cgit v1.2.3