diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-09 10:05:08 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-09 10:05:08 +0200 |
commit | 1f5add513316b9f7544fe61631f76d4a61cf586e (patch) | |
tree | 075daa316ab72aa24a60fdaee0a0f6e95c96608d /src | |
parent | 749e3811ddffc17cf406854b117573bf71485fdf (diff) |
GmDocument: Adjusted link list spacing
Blank lines in link lists need a bit of extra space.
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 3c3c0d4f..3e7da995 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -326,10 +326,10 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
326 | tmLinkText_ColorId, | 326 | tmLinkText_ColorId, |
327 | }; | 327 | }; |
328 | const float indents[max_GmLineType] = { | 328 | const float indents[max_GmLineType] = { |
329 | 5, 10, 5, isNarrow ? 5 : 10, 0, 0, 2.5f, 5 | 329 | 5, 10, 5, isNarrow ? 5 : 10, 0, 0, 0, 5 |
330 | }; | 330 | }; |
331 | static const float topMargin[max_GmLineType] = { | 331 | static const float topMargin[max_GmLineType] = { |
332 | 0.0f, 0.333f, 1.0f, 0.5f, 2.0f, 1.5f, 1.0f, 0.25f | 332 | 0.0f, 0.333f, 1.0f, 0.5f, 2.0f, 1.5f, 1.25f, 0.25f |
333 | }; | 333 | }; |
334 | static const float bottomMargin[max_GmLineType] = { | 334 | static const float bottomMargin[max_GmLineType] = { |
335 | 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.25f | 335 | 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.25f |
@@ -364,6 +364,8 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
364 | iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; | 364 | iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; |
365 | const iBool isNormalized = isNormalized_GmDocument_(d); | 365 | const iBool isNormalized = isNormalized_GmDocument_(d); |
366 | enum iGmLineType prevType = text_GmLineType; | 366 | enum iGmLineType prevType = text_GmLineType; |
367 | enum iGmLineType prevNonBlankType = text_GmLineType; | ||
368 | iBool followsBlank = iFalse; | ||
367 | if (d->format == plainText_GmDocumentFormat) { | 369 | if (d->format == plainText_GmDocumentFormat) { |
368 | isPreformat = iTrue; | 370 | isPreformat = iTrue; |
369 | isFirstText = iFalse; | 371 | isFirstText = iFalse; |
@@ -463,7 +465,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
463 | if (type != quote_GmLineType) { | 465 | if (type != quote_GmLineType) { |
464 | addQuoteIcon = prefs->quoteIcon; | 466 | addQuoteIcon = prefs->quoteIcon; |
465 | } | 467 | } |
466 | /* TODO: Extra skip needed here? */ | 468 | followsBlank = iTrue; |
467 | continue; | 469 | continue; |
468 | } | 470 | } |
469 | /* Begin indenting after the first preformatted block. */ | 471 | /* Begin indenting after the first preformatted block. */ |
@@ -477,6 +479,9 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
477 | if (!isPreformat || (prevType != preformatted_GmLineType)) { | 479 | if (!isPreformat || (prevType != preformatted_GmLineType)) { |
478 | int required = | 480 | int required = |
479 | iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId); | 481 | iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId); |
482 | if (type == link_GmLineType && prevNonBlankType == link_GmLineType && followsBlank) { | ||
483 | required = 1.25f * lineHeight_Text(paragraph_FontId); | ||
484 | } | ||
480 | if (type == quote_GmLineType && prevType == quote_GmLineType) { | 485 | if (type == quote_GmLineType && prevType == quote_GmLineType) { |
481 | /* No margin between consecutive quote lines. */ | 486 | /* No margin between consecutive quote lines. */ |
482 | required = 0; | 487 | required = 0; |
@@ -497,6 +502,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
497 | /* List bullet. */ | 502 | /* List bullet. */ |
498 | run.color = colors[type]; | 503 | run.color = colors[type]; |
499 | if (type == bullet_GmLineType) { | 504 | if (type == bullet_GmLineType) { |
505 | /* TODO: Literata bullet is broken? */ | ||
500 | iGmRun bulRun = run; | 506 | iGmRun bulRun = run; |
501 | bulRun.color = tmQuote_ColorId; | 507 | bulRun.color = tmQuote_ColorId; |
502 | bulRun.visBounds.pos = addX_I2(pos, indent * gap_Text); | 508 | bulRun.visBounds.pos = addX_I2(pos, indent * gap_Text); |
@@ -686,6 +692,8 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
686 | } | 692 | } |
687 | } | 693 | } |
688 | prevType = type; | 694 | prevType = type; |
695 | prevNonBlankType = type; | ||
696 | followsBlank = iFalse; | ||
689 | } | 697 | } |
690 | d->size.y = pos.y; | 698 | d->size.y = pos.y; |
691 | /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ { | 699 | /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ { |