mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-26 16:35:52 +00:00
fixed: lineheight and base wrap issue
This commit is contained in:
1 parent
a25bd03566
commit
2dbfbe36c3
1 file changed
+12
-13
@@ -298,6 +298,14 @@ var CPSystemTypesetterFactory,
|
||||
descent = [currentFont descender]
|
||||
leading = (ascent - descent) * 0.2; // FAKE leading
|
||||
|
||||
currentFontLineHeight = ascent - descent + leading;
|
||||
|
||||
if (currentFontLineHeight > _lineHeight)
|
||||
_lineHeight = currentFontLineHeight;
|
||||
|
||||
if (ascent > _lineBase)
|
||||
_lineBase = ascent;
|
||||
|
||||
if (previousFont !== currentFont)
|
||||
{
|
||||
measuringRange = CPMakeRange(glyphIndex, 0);
|
||||
@@ -357,15 +365,6 @@ var CPSystemTypesetterFactory,
|
||||
glyphIndex = CPMaxRange(lineRange) - 1; // start the line starts directly at current character
|
||||
}
|
||||
|
||||
currentFontLineHeight = ascent - descent + leading;
|
||||
|
||||
if (currentFontLineHeight > _lineHeight)
|
||||
_lineHeight = currentFontLineHeight;
|
||||
|
||||
if (ascent > _lineBase)
|
||||
_lineBase = ascent;
|
||||
|
||||
|
||||
if (isNewline || isTabStop)
|
||||
{
|
||||
if ([self _flushRange:lineRange lineOrigin:lineOrigin currentContainer:_currentTextContainer advancements:advancements lineCount:numLines sameLine:!isNewline])
|
||||
@@ -392,8 +391,7 @@ var CPSystemTypesetterFactory,
|
||||
|
||||
if (lineOrigin.y > containerSizeHeight && _indexOfCurrentContainer < textContainersCount - 1)
|
||||
{
|
||||
_indexOfCurrentContainer++;
|
||||
_currentTextContainer = [textContainers objectAtIndex:_indexOfCurrentContainer];
|
||||
_currentTextContainer = textContainers[++_indexOfCurrentContainer];
|
||||
containerSize = [_currentTextContainer containerSize];
|
||||
containerSizeWidth = containerSize.width;
|
||||
containerSizeHeight = containerSize.height;
|
||||
@@ -409,8 +407,8 @@ var CPSystemTypesetterFactory,
|
||||
advancements = [];
|
||||
currentAnchor = 0;
|
||||
prevRangeWidth = 0;
|
||||
_lineHeight = 0;
|
||||
_lineBase = 0;
|
||||
_lineHeight = currentFontLineHeight;
|
||||
_lineBase = ascent;
|
||||
lineRange = CPMakeRange(glyphIndex + 1, 0);
|
||||
measuringRange = CPMakeRange(glyphIndex + 1, 0);
|
||||
wrapRange = CPMakeRange(0, 0);
|
||||
@@ -426,6 +424,7 @@ var CPSystemTypesetterFactory,
|
||||
}
|
||||
|
||||
var rect = CGRectMake(0, lineOrigin.y, containerSizeWidth, [_layoutManager._lineFragments lastObject]._usedRect.size.height - descent);
|
||||
document.title= [_layoutManager._lineFragments lastObject]._usedRect.size.height - descent
|
||||
[_layoutManager setExtraLineFragmentRect:rect usedRect:rect textContainer:_currentTextContainer];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user