From 514bd9ac87f4bb4d70f7512120b15b42f28966db Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 22 Jul 2020 16:20:33 +0300 Subject: GmDocument: Trying a first paragraph emphasis --- src/gmdocument.c | 8 ++++++++ src/ui/text.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gmdocument.c b/src/gmdocument.c index 3f3f8358..42bc7515 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c @@ -97,6 +97,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { static const char *bullet = "\u2022"; iRangecc preAltText = iNullRange; enum iGmLineType prevType = text_GmLineType; + iBool isFirstText = iTrue; while (nextSplit_Rangecc(&content, "\n", &line)) { iGmRun run; run.color = white_ColorId; @@ -150,6 +151,13 @@ static void doLayout_GmDocument_(iGmDocument *d) { run.text = (iRangecc){ bullet, bullet + strlen(bullet) }; pushBack_Array(&d->layout, &run); } + if (type == text_GmLineType && isFirstText) { + run.font = firstParagraph_FontId; + isFirstText = iFalse; + } + else if (type != header1_GmLineType) { + isFirstText = iFalse; + } iRangecc runLine = line; while (!isEmpty_Range(&runLine)) { run.bounds.pos = addX_I2(pos, indent * gap_UI); diff --git a/src/ui/text.c b/src/ui/text.c index afad778c..a24d4030 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -117,7 +117,7 @@ void init_Text(SDL_Renderer *render) { const struct { const iBlock *ttf; int size; } fontData[max_FontId] = { { &fontFiraSansRegular_Embedded, fontSize_UI }, { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.85f }, - { &fontFiraSansRegular_Embedded, fontSize_UI * 1.5f }, + { &fontFiraSansRegular_Embedded, fontSize_UI * 1.35f }, { &fontFiraSansLightItalic_Embedded, fontSize_UI }, { &fontFiraSansBold_Embedded, fontSize_UI }, { &fontFiraSansBold_Embedded, fontSize_UI * 1.35f }, -- cgit v1.2.3