diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-28 06:21:46 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-28 06:21:56 +0300 |
commit | a45a7dd965d0345edffd37c04c4f264a6a368f91 (patch) | |
tree | f1a02f8add49b3f9129642fbd71af874a4fd4c5c /src | |
parent | 4506324621622c778656bc7cf7c5d6eca5386f58 (diff) |
DocumentWidget: Improved drawing of link key shortcuts
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 15 | ||||
-rw-r--r-- | src/ui/text.c | 4 | ||||
-rw-r--r-- | src/ui/text.h | 3 |
3 files changed, 15 insertions, 7 deletions
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) { | |||
3820 | if (ordChar) { | 3820 | if (ordChar) { |
3821 | const char *circle = "\u25ef"; /* Large Circle */ | 3821 | const char *circle = "\u25ef"; /* Large Circle */ |
3822 | iRect nbArea = { init_I2(d->viewPos.x - gap_UI / 3, visPos.y), | 3822 | iRect nbArea = { init_I2(d->viewPos.x - gap_UI / 3, visPos.y), |
3823 | init_I2(4 * gap_UI, lineHeight_Text(run->font)) }; | 3823 | init_I2(3.95f * gap_Text, 1.0f * lineHeight_Text(run->font)) }; |
3824 | drawRange_Text(run->font, topLeft_Rect(nbArea), tmQuote_ColorId, | 3824 | drawRange_Text( |
3825 | range_CStr(circle)); | 3825 | run->font, topLeft_Rect(nbArea), tmQuote_ColorId, range_CStr(circle)); |
3826 | drawCentered_Text(run->font, nbArea, iTrue, tmQuote_ColorId, "%lc", (int) ordChar); | 3826 | iRect circleArea = visualBounds_Text(run->font, range_CStr(circle)); |
3827 | addv_I2(&circleArea.pos, topLeft_Rect(nbArea)); | ||
3828 | drawCentered_Text(defaultContentSmall_FontId, | ||
3829 | circleArea, | ||
3830 | iTrue, | ||
3831 | tmQuote_ColorId, | ||
3832 | "%lc", | ||
3833 | (int) ordChar); | ||
3827 | goto runDrawn; | 3834 | goto runDrawn; |
3828 | } | 3835 | } |
3829 | } | 3836 | } |
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) { | |||
324 | { &fontIosevkaTermExtended_Embedded, monoSize, 1.0f, contentMono_FontSize }, | 324 | { &fontIosevkaTermExtended_Embedded, monoSize, 1.0f, contentMono_FontSize }, |
325 | /* extra content fonts */ | 325 | /* extra content fonts */ |
326 | { &fontSourceSans3Regular_Embedded, textSize, scaling, contentRegular_FontSize }, | 326 | { &fontSourceSans3Regular_Embedded, textSize, scaling, contentRegular_FontSize }, |
327 | // { &fontIosevkaTermExtended_Embedded, textSize, 0.866f, contentRegular_FontSize }, | 327 | { &fontSourceSans3Regular_Embedded, textSize * 0.80f, scaling, contentRegular_FontSize }, |
328 | /* symbols and scripts */ | 328 | /* symbols and scripts */ |
329 | #define DEFINE_FONT_SET(data, glyphScale) \ | 329 | #define DEFINE_FONT_SET(data, glyphScale) \ |
330 | { (data), uiSize, glyphScale, uiNormal_FontSize }, \ | 330 | { (data), uiSize, glyphScale, uiNormal_FontSize }, \ |
@@ -626,7 +626,7 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { | |||
626 | /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great | 626 | /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great |
627 | match to the other text, so use the UI font instead. */ | 627 | match to the other text, so use the UI font instead. */ |
628 | if ((ch == 0x2318 || ch == 0x21e7) && d == font_Text_(regular_FontId)) { | 628 | if ((ch == 0x2318 || ch == 0x21e7) && d == font_Text_(regular_FontId)) { |
629 | *glyphIndex = glyphIndex_Font_(d = font_Text_(defaultContentSized_FontId), ch); | 629 | *glyphIndex = glyphIndex_Font_(d = font_Text_(defaultContentRegular_FontId), ch); |
630 | return d; | 630 | return d; |
631 | } | 631 | } |
632 | #endif | 632 | #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 { | |||
67 | monospaceSmall_FontId, | 67 | monospaceSmall_FontId, |
68 | monospace_FontId, | 68 | monospace_FontId, |
69 | /* extra content fonts */ | 69 | /* extra content fonts */ |
70 | defaultContentSized_FontId, /* UI font but sized to regular_FontId */ | 70 | defaultContentRegular_FontId, /* UI font but sized to regular_FontId */ |
71 | defaultContentSmall_FontId, /* UI font but sized smaller */ | ||
71 | /* symbols and scripts */ | 72 | /* symbols and scripts */ |
72 | userSymbols_FontId, | 73 | userSymbols_FontId, |
73 | iosevka_FontId = userSymbols_FontId + max_FontSize, | 74 | iosevka_FontId = userSymbols_FontId + max_FontSize, |