summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-07-11 08:45:12 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-07-11 08:45:12 +0300
commit2f60372f8ea9ee6f6bad04d817a79e2b03c91e3b (patch)
treeb6a7edc3d41884695e0523d85521ea6b56c51247 /src/gmdocument.c
parent1214aecd71df48164a7591b75fd48720f5b930f3 (diff)
Preferences: Added setting for line spacing
IssueID #229
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index a46e71cf..3d91fb34 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -147,7 +147,7 @@ static int lastVisibleRunBottom_GmDocument_(const iGmDocument *d) {
147 if (isEmpty_Range(&run->text)) { 147 if (isEmpty_Range(&run->text)) {
148 continue; 148 continue;
149 } 149 }
150 return bottom_Rect(run->bounds); 150 return top_Rect(run->bounds) + height_Rect(run->bounds) * prefs_App()->lineSpacing;
151 } 151 }
152 return 0; 152 return 0;
153} 153}
@@ -546,7 +546,8 @@ static void doLayout_GmDocument_(iGmDocument *d) {
546 banner.text = bannerText; 546 banner.text = bannerText;
547 banner.color = tmBannerTitle_ColorId; 547 banner.color = tmBannerTitle_ColorId;
548 pushBack_Array(&d->layout, &banner); 548 pushBack_Array(&d->layout, &banner);
549 pos.y += height_Rect(banner.visBounds) + lineHeight_Text(paragraph_FontId); 549 pos.y += height_Rect(banner.visBounds) +
550 lineHeight_Text(paragraph_FontId) * prefs->lineSpacing;
550 } 551 }
551 } 552 }
552 /* Empty lines don't produce text runs. */ 553 /* Empty lines don't produce text runs. */
@@ -560,7 +561,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
560 run.text = iNullRange; 561 run.text = iNullRange;
561 pushBack_Array(&d->layout, &run); 562 pushBack_Array(&d->layout, &run);
562 } 563 }
563 pos.y += lineHeight_Text(run.font); 564 pos.y += lineHeight_Text(run.font) * prefs->lineSpacing;
564 prevType = type; 565 prevType = type;
565 if (type != quote_GmLineType) { 566 if (type != quote_GmLineType) {
566 addQuoteIcon = prefs->quoteIcon; 567 addQuoteIcon = prefs->quoteIcon;
@@ -586,11 +587,6 @@ static void doLayout_GmDocument_(iGmDocument *d) {
586 if (type == link_GmLineType && prevNonBlankType == link_GmLineType && followsBlank) { 587 if (type == link_GmLineType && prevNonBlankType == link_GmLineType && followsBlank) {
587 required = 1.25f * lineHeight_Text(paragraph_FontId); 588 required = 1.25f * lineHeight_Text(paragraph_FontId);
588 } 589 }
589 else if (type == link_GmLineType && prevType == link_GmLineType) {
590 /* Balance space between the link icons and the labels, both vertically
591 between icons and between the icon and the label. */
592 //required *= 0.75f;
593 }
594 if (type == quote_GmLineType && prevType == quote_GmLineType) { 590 if (type == quote_GmLineType && prevType == quote_GmLineType) {
595 /* No margin between consecutive quote lines. */ 591 /* No margin between consecutive quote lines. */
596 required = 0; 592 required = 0;
@@ -598,9 +594,10 @@ static void doLayout_GmDocument_(iGmDocument *d) {
598 if (isEmpty_Array(&d->layout)) { 594 if (isEmpty_Array(&d->layout)) {
599 required = 0; /* top of document */ 595 required = 0; /* top of document */
600 } 596 }
597 required *= prefs->lineSpacing;
601 int delta = pos.y - lastVisibleRunBottom_GmDocument_(d); 598 int delta = pos.y - lastVisibleRunBottom_GmDocument_(d);
602 if (delta < required) { 599 if (delta < required) {
603 pos.y += required - delta; 600 pos.y += (required - delta);
604 } 601 }
605 } 602 }
606 /* Folded blocks are represented by a single run with the alt text. */ 603 /* Folded blocks are represented by a single run with the alt text. */
@@ -778,7 +775,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
778 run.flags &= ~startOfLine_GmRunFlag; 775 run.flags &= ~startOfLine_GmRunFlag;
779 runLine.start = contPos; 776 runLine.start = contPos;
780 trimStart_Rangecc(&runLine); 777 trimStart_Rangecc(&runLine);
781 pos.y += lineHeight_Text(run.font); 778 pos.y += lineHeight_Text(run.font) * prefs->lineSpacing;
782 if (--bigCount == 0) { 779 if (--bigCount == 0) {
783 run.font = fonts[text_GmLineType]; 780 run.font = fonts[text_GmLineType];
784 run.color = colors[text_GmLineType]; 781 run.color = colors[text_GmLineType];