From 4389d49e9772a4ddbe2a211b921749b0977ea1a2 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 28 May 2021 06:19:10 +0300 Subject: GmDocument: Tuning link icon alignment Keep it separated from the label text. --- src/gmdocument.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/gmdocument.c') 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) { int xAdjust = 0; if (!isCentered) { /* Keep the icon aligned to the left edge. */ + const int alignWidth = width_Rect(run->visBounds) * 3 / 4; xAdjust -= left_Rect(visBounds); - if (visWidth > width_Rect(run->visBounds)) { + if (visWidth > alignWidth) { /* ...unless it's a wide icon, in which case move it to the left. */ - xAdjust -= visWidth - width_Rect(run->visBounds); + xAdjust -= visWidth - alignWidth; } - else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { + else if (visWidth < alignWidth) { /* ...or a narrow icon, which needs to be centered but leave a gap. */ - xAdjust += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; + xAdjust += (alignWidth - visWidth) / 2; } } else { @@ -613,7 +614,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { iGmRun bulRun = run; if (prefs->font == literata_TextFont) { /* Something wrong this the glyph in Literata, looks cropped. */ - bulRun.font = defaultContentSized_FontId; + bulRun.font = defaultContentRegular_FontId; } bulRun.color = tmQuote_ColorId; bulRun.visBounds.pos = addX_I2(pos, (indents[text_GmLineType] - 0.55f) * gap_Text); -- cgit v1.2.3