summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-24 12:41:46 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-24 12:41:46 +0200
commit83e936f53d3129433edfdb229a2faf78e48687b1 (patch)
tree4af84e84b7ba5faccac71522fd665bfb63491acf /src/gmdocument.c
parent740c95a2b0eda0297865b739d780474cea13e75c (diff)
GmDocument: Media type flexibility
Allow defining new inline media types.
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index e33be932..5e762dff 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -285,7 +285,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
285 0.0f, 0.333f, 1.0f, 0.5f, 2.0f, 1.5f, 1.0f, 0.25f 285 0.0f, 0.333f, 1.0f, 0.5f, 2.0f, 1.5f, 1.0f, 0.25f
286 }; 286 };
287 static const float bottomMargin[max_GmLineType] = { 287 static const float bottomMargin[max_GmLineType] = {
288 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f 288 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.25f
289 }; 289 };
290 static const char *arrow = "\u27a4"; 290 static const char *arrow = "\u27a4";
291 static const char *envelope = "\U0001f4e7"; 291 static const char *envelope = "\U0001f4e7";
@@ -578,15 +578,17 @@ static void doLayout_GmDocument_(iGmDocument *d) {
578 const iInt2 maxSize = mulf_I2(img.size, get_Window()->pixelRatio); 578 const iInt2 maxSize = mulf_I2(img.size, get_Window()->pixelRatio);
579 if (width_Rect(run.visBounds) > maxSize.x) { 579 if (width_Rect(run.visBounds) > maxSize.x) {
580 /* Don't scale the image up. */ 580 /* Don't scale the image up. */
581 run.visBounds.size.y = run.visBounds.size.y * maxSize.x / width_Rect(run.visBounds); 581 run.visBounds.size.y =
582 run.visBounds.size.y * maxSize.x / width_Rect(run.visBounds);
582 run.visBounds.size.x = maxSize.x; 583 run.visBounds.size.x = maxSize.x;
583 run.visBounds.pos.x = run.bounds.size.x / 2 - width_Rect(run.visBounds) / 2; 584 run.visBounds.pos.x = run.bounds.size.x / 2 - width_Rect(run.visBounds) / 2;
584 run.bounds.size.y = run.visBounds.size.y; 585 run.bounds.size.y = run.visBounds.size.y;
585 } 586 }
586 run.text = iNullRange; 587 run.text = iNullRange;
587 run.font = 0; 588 run.font = 0;
588 run.color = 0; 589 run.color = 0;
589 run.imageId = imageId; 590 run.mediaType = image_GmRunMediaType;
591 run.mediaId = imageId;
590 pushBack_Array(&d->layout, &run); 592 pushBack_Array(&d->layout, &run);
591 pos.y += run.bounds.size.y + margin; 593 pos.y += run.bounds.size.y + margin;
592 } 594 }
@@ -608,7 +610,8 @@ static void doLayout_GmDocument_(iGmDocument *d) {
608 run.visBounds = run.bounds; 610 run.visBounds = run.bounds;
609 run.text = iNullRange; 611 run.text = iNullRange;
610 run.color = 0; 612 run.color = 0;
611 run.audioId = audioId; 613 run.mediaType = audio_GmRunMediaType;
614 run.mediaId = audioId;
612 pushBack_Array(&d->layout, &run); 615 pushBack_Array(&d->layout, &run);
613 pos.y += run.bounds.size.y + margin; 616 pos.y += run.bounds.size.y + margin;
614 } 617 }