revert: textTabForWidth-"fix"

This commit is contained in:
daboe01 committed 2026-05-30 08:44:43 +02:00
1 parent 3b1c1c0886
commit 4fbd50e81f
1 file changed
+13 -15
+13 -15
View File
@@ -135,36 +135,34 @@ var CPSystemTypesetterFactory,
return [_layoutManager textContainers];
}
// Retrieves correct CPTextTab stop accounting for CPArray properties
- (CPTextTab)textTabForWidth:(double)aWidth writingDirection:(CPWritingDirection)direction
{
var tabStops = [_currentParagraph tabStops];
if (!tabStops)
tabStops = [[CPParagraphStyle defaultParagraphStyle] tabStops];
tabStops = [CPParagraphStyle _defaultTabStops];
var l = [tabStops count];
var l = tabStops.length;
if (l === 0)
if (aWidth > tabStops[l - 1]._location)
return nil;
// Find the first tab stop that is strictly greater than the current width
for (var i = 0; i < l; i++)
for (var i = l - 1; i >= 0; i--)
{
var tab = [tabStops objectAtIndex:i];
if ([tab location] > aWidth)
return tab;
if (aWidth > tabStops[i]._location)
{
if (i + 1 < l)
return tabStops[i + 1];
}
}
// If aWidth exceeds the last tab stop, dynamically calculate the next
// tab location using the default tab interval.
var defaultInterval = [_currentParagraph defaultTabInterval] || 28.0;
var nextLocation = CEIL((aWidth + 1.0) / defaultInterval) * defaultInterval;
if (i === -1)
return tabStops[0];
return [[CPTextTab alloc] initWithType:CPLeftTextAlignment location:nextLocation];
return nil;
}
- (BOOL)_flushRange:(CPRange)lineRange
lineOrigin:(CGPoint)lineOrigin
currentContainer:(CPTextContainer)aContainer