Merge pull request #88 from anthonyc-r/master

Make GSHorizontalTypesetter use defaultTabInterval if it has run out …
This commit is contained in:
Fred Kiefer 2021-01-16 17:33:39 +01:00 committed by GitHub
commit d28fe15d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
{