From a45a7dd965d0345edffd37c04c4f264a6a368f91 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 28 May 2021 06:21:46 +0300 Subject: DocumentWidget: Improved drawing of link key shortcuts --- src/ui/documentwidget.c | 15 +++++++++++---- src/ui/text.c | 4 ++-- src/ui/text.h | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ac283a21..f354623e 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -3820,10 +3820,17 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { if (ordChar) { const char *circle = "\u25ef"; /* Large Circle */ iRect nbArea = { init_I2(d->viewPos.x - gap_UI / 3, visPos.y), - init_I2(4 * gap_UI, lineHeight_Text(run->font)) }; - drawRange_Text(run->font, topLeft_Rect(nbArea), tmQuote_ColorId, - range_CStr(circle)); - drawCentered_Text(run->font, nbArea, iTrue, tmQuote_ColorId, "%lc", (int) ordChar); + init_I2(3.95f * gap_Text, 1.0f * lineHeight_Text(run->font)) }; + drawRange_Text( + run->font, topLeft_Rect(nbArea), tmQuote_ColorId, range_CStr(circle)); + iRect circleArea = visualBounds_Text(run->font, range_CStr(circle)); + addv_I2(&circleArea.pos, topLeft_Rect(nbArea)); + drawCentered_Text(defaultContentSmall_FontId, + circleArea, + iTrue, + tmQuote_ColorId, + "%lc", + (int) ordChar); goto runDrawn; } } diff --git a/src/ui/text.c b/src/ui/text.c index 980f15bd..ae952df9 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -324,7 +324,7 @@ static void initFonts_Text_(iText *d) { { &fontIosevkaTermExtended_Embedded, monoSize, 1.0f, contentMono_FontSize }, /* extra content fonts */ { &fontSourceSans3Regular_Embedded, textSize, scaling, contentRegular_FontSize }, -// { &fontIosevkaTermExtended_Embedded, textSize, 0.866f, contentRegular_FontSize }, + { &fontSourceSans3Regular_Embedded, textSize * 0.80f, scaling, contentRegular_FontSize }, /* symbols and scripts */ #define DEFINE_FONT_SET(data, glyphScale) \ { (data), uiSize, glyphScale, uiNormal_FontSize }, \ @@ -626,7 +626,7 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great match to the other text, so use the UI font instead. */ if ((ch == 0x2318 || ch == 0x21e7) && d == font_Text_(regular_FontId)) { - *glyphIndex = glyphIndex_Font_(d = font_Text_(defaultContentSized_FontId), ch); + *glyphIndex = glyphIndex_Font_(d = font_Text_(defaultContentRegular_FontId), ch); return d; } #endif diff --git a/src/ui/text.h b/src/ui/text.h index 0007b264..2f2bcf3a 100644 --- a/src/ui/text.h +++ b/src/ui/text.h @@ -67,7 +67,8 @@ enum iFontId { monospaceSmall_FontId, monospace_FontId, /* extra content fonts */ - defaultContentSized_FontId, /* UI font but sized to regular_FontId */ + defaultContentRegular_FontId, /* UI font but sized to regular_FontId */ + defaultContentSmall_FontId, /* UI font but sized smaller */ /* symbols and scripts */ userSymbols_FontId, iosevka_FontId = userSymbols_FontId + max_FontSize, -- cgit v1.2.3