Make GSHorizontalTypesetter use defaultTabInterval if it has run out of defined tabstops

This commit is contained in:
anthonyc 2020-10-15 17:57:20 +01:00
parent 2858654976
commit 186f2da812

View file

@ -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
{