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/text.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ui/text.c') diff --git a/src/ui/text.c b/src/ui/text.c index 25c79e23..8adfa019 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -1882,6 +1882,11 @@ int lineHeight_Text(int fontId) { return font_Text_(fontId)->height; } +float emRatio_Text(int fontId) { + const iFont *font = font_Text_(fontId); + return font->emAdvance / font->height; +} + iTextMetrics measureRange_Text(int fontId, iRangecc text) { if (isEmpty_Range(&text)) { return (iTextMetrics){ init_Rect(0, 0, 0, lineHeight_Text(fontId)), zero_I2() }; -- cgit v1.2.3