diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-28 06:19:10 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-28 06:19:10 +0300 |
commit | 4389d49e9772a4ddbe2a211b921749b0977ea1a2 (patch) | |
tree | 98c5771b8e0625d8585fe2d368e46019f130e96b /src/gmdocument.c | |
parent | 3d25f624d92668377eac1f206a77267563db7edc (diff) |
GmDocument: Tuning link icon alignment
Keep it separated from the label text.
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 61965f58..ec406a63 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -327,14 +327,15 @@ static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) { | |||
327 | int xAdjust = 0; | 327 | int xAdjust = 0; |
328 | if (!isCentered) { | 328 | if (!isCentered) { |
329 | /* Keep the icon aligned to the left edge. */ | 329 | /* Keep the icon aligned to the left edge. */ |
330 | const int alignWidth = width_Rect(run->visBounds) * 3 / 4; | ||
330 | xAdjust -= left_Rect(visBounds); | 331 | xAdjust -= left_Rect(visBounds); |
331 | if (visWidth > width_Rect(run->visBounds)) { | 332 | if (visWidth > alignWidth) { |
332 | /* ...unless it's a wide icon, in which case move it to the left. */ | 333 | /* ...unless it's a wide icon, in which case move it to the left. */ |
333 | xAdjust -= visWidth - width_Rect(run->visBounds); | 334 | xAdjust -= visWidth - alignWidth; |
334 | } | 335 | } |
335 | else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { | 336 | else if (visWidth < alignWidth) { |
336 | /* ...or a narrow icon, which needs to be centered but leave a gap. */ | 337 | /* ...or a narrow icon, which needs to be centered but leave a gap. */ |
337 | xAdjust += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; | 338 | xAdjust += (alignWidth - visWidth) / 2; |
338 | } | 339 | } |
339 | } | 340 | } |
340 | else { | 341 | else { |
@@ -613,7 +614,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
613 | iGmRun bulRun = run; | 614 | iGmRun bulRun = run; |
614 | if (prefs->font == literata_TextFont) { | 615 | if (prefs->font == literata_TextFont) { |
615 | /* Something wrong this the glyph in Literata, looks cropped. */ | 616 | /* Something wrong this the glyph in Literata, looks cropped. */ |
616 | bulRun.font = defaultContentSized_FontId; | 617 | bulRun.font = defaultContentRegular_FontId; |
617 | } | 618 | } |
618 | bulRun.color = tmQuote_ColorId; | 619 | bulRun.color = tmQuote_ColorId; |
619 | bulRun.visBounds.pos = addX_I2(pos, (indents[text_GmLineType] - 0.55f) * gap_Text); | 620 | bulRun.visBounds.pos = addX_I2(pos, (indents[text_GmLineType] - 0.55f) * gap_Text); |