summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-27 15:30:01 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-27 15:30:01 +0300
commitd3b5fe0d8d05d8e76d3f4646f02b0fa78561b1db (patch)
treee5b04700d782565f1eb3c8fbfa58daf81e7f8df7 /src
parente19a2207ead91d8be4ff089571498285e3f6dbd3 (diff)
GmDocument: Add extra line spacing for wrapped lines
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 0a0966be..433e8dcc 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -164,6 +164,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
164 static const float bottomMargin[max_GmLineType] = { 164 static const float bottomMargin[max_GmLineType] = {
165 0.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f 165 0.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f
166 }; 166 };
167 const float midRunSkip = 0.1f; /* extra space between wrapped text/quote lines */
167 static const char *bullet = "\u2022"; 168 static const char *bullet = "\u2022";
168 clear_Array(&d->layout); 169 clear_Array(&d->layout);
169 clearLinks_GmDocument_(d); 170 clearLinks_GmDocument_(d);
@@ -270,6 +271,12 @@ static void doLayout_GmDocument_(iGmDocument *d) {
270 iRangecc runLine = line; 271 iRangecc runLine = line;
271 /* Create one or more runs for this line. */ 272 /* Create one or more runs for this line. */
272 while (!isEmpty_Range(&runLine)) { 273 while (!isEmpty_Range(&runLine)) {
274 /* Little bit of breathing space between wrapped lines. */
275 if ((type == text_GmLineType || type == quote_GmLineType ||
276 type == bullet_GmLineType) &&
277 runLine.start != line.start) {
278 pos.y += midRunSkip * lineHeight_Text(run.font);
279 }
273 run.bounds.pos = addX_I2(pos, indent * gap_UI); 280 run.bounds.pos = addX_I2(pos, indent * gap_UI);
274 const char *contPos; 281 const char *contPos;
275 const int avail = d->size.x - run.bounds.pos.x; 282 const int avail = d->size.x - run.bounds.pos.x;