diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 15:02:53 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 15:02:53 +0300 |
commit | 3d25f624d92668377eac1f206a77267563db7edc (patch) | |
tree | f1e98c96e8896ec474fc3fe3a4c4c6697e5b6c42 /src/ui/documentwidget.c | |
parent | c73a54f3c416eb80974385f97c76f725448153aa (diff) |
DocumentWidget: Composited link numbers/letters
Draw the circle and the number/letter separately since we don't
have a font with all the glyphs.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index f7ef6d79..ac283a21 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2908,7 +2908,7 @@ static size_t linkOrdinalFromKey_DocumentWidget_(const iDocumentWidget *d, int k | |||
2908 | static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t ord) { | 2908 | static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t ord) { |
2909 | if (d->ordinalMode == numbersAndAlphabet_DocumentLinkOrdinalMode) { | 2909 | if (d->ordinalMode == numbersAndAlphabet_DocumentLinkOrdinalMode) { |
2910 | if (ord < 9) { | 2910 | if (ord < 9) { |
2911 | return 0x278a + ord; | 2911 | return '1' + ord; |
2912 | } | 2912 | } |
2913 | #if defined (iPlatformApple) | 2913 | #if defined (iPlatformApple) |
2914 | if (ord < 9 + 22) { | 2914 | if (ord < 9 + 22) { |
@@ -2917,17 +2917,17 @@ static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t or | |||
2917 | if (key >= 'm') key++; | 2917 | if (key >= 'm') key++; |
2918 | if (key >= 'q') key++; | 2918 | if (key >= 'q') key++; |
2919 | if (key >= 'w') key++; | 2919 | if (key >= 'w') key++; |
2920 | return 0x24b6 + key - 'a'; | 2920 | return 'A' + key - 'a'; |
2921 | } | 2921 | } |
2922 | #else | 2922 | #else |
2923 | if (ord < 9 + 26) { | 2923 | if (ord < 9 + 26) { |
2924 | return 0x24b6 + ord - 9; | 2924 | return 'A' + ord - 9; |
2925 | } | 2925 | } |
2926 | #endif | 2926 | #endif |
2927 | } | 2927 | } |
2928 | else { | 2928 | else { |
2929 | if (ord < iElemCount(homeRowKeys_)) { | 2929 | if (ord < iElemCount(homeRowKeys_)) { |
2930 | return 0x24b6 + homeRowKeys_[ord] - 'a'; | 2930 | return 'A' + homeRowKeys_[ord] - 'a'; |
2931 | } | 2931 | } |
2932 | } | 2932 | } |
2933 | return 0; | 2933 | return 0; |
@@ -3818,10 +3818,12 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3818 | const iChar ordChar = | 3818 | const iChar ordChar = |
3819 | linkOrdinalChar_DocumentWidget_(d->widget, ord - d->widget->ordinalBase); | 3819 | linkOrdinalChar_DocumentWidget_(d->widget, ord - d->widget->ordinalBase); |
3820 | if (ordChar) { | 3820 | if (ordChar) { |
3821 | drawString_Text(run->font, | 3821 | const char *circle = "\u25ef"; /* Large Circle */ |
3822 | init_I2(d->viewPos.x - gap_UI / 3, visPos.y), | 3822 | iRect nbArea = { init_I2(d->viewPos.x - gap_UI / 3, visPos.y), |
3823 | tmQuote_ColorId, | 3823 | init_I2(4 * gap_UI, lineHeight_Text(run->font)) }; |
3824 | collect_String(newUnicodeN_String(&ordChar, 1))); | 3824 | drawRange_Text(run->font, topLeft_Rect(nbArea), tmQuote_ColorId, |
3825 | range_CStr(circle)); | ||
3826 | drawCentered_Text(run->font, nbArea, iTrue, tmQuote_ColorId, "%lc", (int) ordChar); | ||
3825 | goto runDrawn; | 3827 | goto runDrawn; |
3826 | } | 3828 | } |
3827 | } | 3829 | } |