From c9ded71342f4e47b48151782a48fc488a5f63e56 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 7 Oct 2021 08:49:42 +0300 Subject: DocumentWidget: Line width based on font glyph width The idea is that the amount of content should be the same per line regardless of the font. --- src/ui/documentwidget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui/documentwidget.c') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index b83490f9..2ba2fa12 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -496,7 +496,8 @@ static int documentWidth_DocumentWidget_(const iDocumentWidget *d) { -1.0f, 10.0f); /* adapt to width */ //printf("%f\n", adjust); fflush(stdout); return iMini(iMax(minWidth, bounds.size.x - gap_UI * (d->pageMargin + adjust) * 2), - fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100); + fontSize_UI * emRatio_Text(paragraph_FontId) * /* dependent on avg. glyph width */ + prefs->lineWidth * prefs->zoomPercent / 100); } static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) { -- cgit v1.2.3