From 186f2da8120f3b857c18f9ddbba1142bd7451d44 Mon Sep 17 00:00:00 2001 From: anthonyc Date: Thu, 15 Oct 2020 17:57:20 +0100 Subject: [PATCH] Make GSHorizontalTypesetter use defaultTabInterval if it has run out of defined tabstops --- Source/GSHorizontalTypesetter.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/GSHorizontalTypesetter.m b/Source/GSHorizontalTypesetter.m index 82a3411ad..7f61158a4 100644 --- a/Source/GSHorizontalTypesetter.m +++ b/Source/GSHorizontalTypesetter.m @@ -870,6 +870,11 @@ restart: ; */ NSArray *tabs = [curParagraphStyle tabStops]; NSTextTab *tab = nil; + float defaultInterval = [curParagraphStyle defaultTabInterval]; + /* Set it to something reasonable if unset */ + if (defaultInterval == 0.0) { + defaultInterval = 100.0; + } int i, c = [tabs count]; /* Find first tab beyond our current position. */ for (i = 0; i < c; i++) @@ -888,12 +893,11 @@ restart: ; } if (i == c) { - /* TODO: we're already past all the tab stops. what - should we do? - - Pretend that we have tabs every 100 points. + /* + Tabs after the last value in tabStops should use the + defaultTabInterval provided by NSParagraphStyle. */ - p.x = (floor(p.x / 100.0) + 1.0) * 100.0; + p.x = (floor(p.x / defaultInterval) + 1.0) * defaultInterval; } else {