summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c4
-rw-r--r--src/ui/text.c11
-rw-r--r--src/ui/text.h2
3 files changed, 9 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index eae7c00a..56726320 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -195,7 +195,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
195 d->scrollY = 0; 195 d->scrollY = 0;
196 } 196 }
197 const int scrollMax = 197 const int scrollMax =
198 size_GmDocument(d->doc).y - height_Rect(bounds_Widget(w)) + d->pageMargin * gap_UI; 198 size_GmDocument(d->doc).y - height_Rect(bounds_Widget(w)) + 2 * d->pageMargin * gap_UI;
199 if (scrollMax > 0) { 199 if (scrollMax > 0) {
200 d->scrollY = iMin(d->scrollY, scrollMax); 200 d->scrollY = iMin(d->scrollY, scrollMax);
201 } 201 }
@@ -245,7 +245,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) {
245 ctx.bounds.size.x = documentWidth_DocumentWidget_(d); 245 ctx.bounds.size.x = documentWidth_DocumentWidget_(d);
246 ctx.bounds.pos.x = bounds_Widget(w).size.x / 2 - ctx.bounds.size.x / 2; 246 ctx.bounds.pos.x = bounds_Widget(w).size.x / 2 - ctx.bounds.size.x / 2;
247 init_Paint(&ctx.paint); 247 init_Paint(&ctx.paint);
248 drawRect_Paint(&ctx.paint, ctx.bounds, teal_ColorId); 248// drawRect_Paint(&ctx.paint, ctx.bounds, teal_ColorId);
249 render_GmDocument( 249 render_GmDocument(
250 d->doc, 250 d->doc,
251 (iRangei){ d->scrollY - margin, d->scrollY + height_Rect(ctx.bounds) + margin }, 251 (iRangei){ d->scrollY - margin, d->scrollY + height_Rect(ctx.bounds) + margin },
diff --git a/src/ui/text.c b/src/ui/text.c
index e5045899..d4f46116 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -118,13 +118,13 @@ void init_Text(SDL_Renderer *render) {
118 /* Load the fonts. */ { 118 /* Load the fonts. */ {
119 const struct { const iBlock *ttf; int size; } fontData[max_FontId] = { 119 const struct { const iBlock *ttf; int size; } fontData[max_FontId] = {
120 { &fontFiraSansRegular_Embedded, fontSize_UI }, 120 { &fontFiraSansRegular_Embedded, fontSize_UI },
121 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.85f }, 121 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.866f },
122 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.65f }, 122 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.666f },
123 { &fontFiraSansRegular_Embedded, fontSize_UI * 1.35f }, 123 { &fontFiraSansRegular_Embedded, fontSize_UI * 1.333f },
124 { &fontFiraSansLightItalic_Embedded, fontSize_UI }, 124 { &fontFiraSansLightItalic_Embedded, fontSize_UI },
125 { &fontFiraSansBold_Embedded, fontSize_UI }, 125 { &fontFiraSansBold_Embedded, fontSize_UI },
126 { &fontFiraSansBold_Embedded, fontSize_UI * 1.35f }, 126 { &fontFiraSansBold_Embedded, fontSize_UI * 1.333f },
127 { &fontFiraSansBold_Embedded, fontSize_UI * 1.7f }, 127 { &fontFiraSansBold_Embedded, fontSize_UI * 1.666f },
128 { &fontFiraSansBold_Embedded, fontSize_UI * 2.0f }, 128 { &fontFiraSansBold_Embedded, fontSize_UI * 2.0f },
129 }; 129 };
130 iForIndices(i, fontData) { 130 iForIndices(i, fontData) {
@@ -366,6 +366,7 @@ static void cache_Font_(iFont *d, iGlyph *glyph, int hoff) {
366 /* Update cache cursor. */ 366 /* Update cache cursor. */
367 txt->cachePos.x += glRect->size.x; 367 txt->cachePos.x += glRect->size.x;
368 txt->cacheRowHeight = iMax(txt->cacheRowHeight, glRect->size.y); 368 txt->cacheRowHeight = iMax(txt->cacheRowHeight, glRect->size.y);
369 iAssert(txt->cachePos.y + txt->cacheRowHeight <= txt->cacheSize.y);
369} 370}
370 371
371static const iGlyph *glyph_Font_(iFont *d, iChar ch) { 372static const iGlyph *glyph_Font_(iFont *d, iChar ch) {
diff --git a/src/ui/text.h b/src/ui/text.h
index 29fc34a4..2181fa34 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -26,7 +26,7 @@ enum iFontId {
26 quote_FontId = italic_FontId, 26 quote_FontId = italic_FontId,
27 header1_FontId = hugeBold_FontId, 27 header1_FontId = hugeBold_FontId,
28 header2_FontId = largeBold_FontId, 28 header2_FontId = largeBold_FontId,
29 header3_FontId = mediumBold_FontId, 29 header3_FontId = medium_FontId,
30 uiShortcuts_FontId = default_FontId, 30 uiShortcuts_FontId = default_FontId,
31}; 31};
32 32