prepare baseline support

This commit is contained in:
daboe01 committed 2015-06-28 16:03:23 +02:00
1 parent 0c308b38c5
commit 6e0b20c921
2 files changed
+20 -3

No files matched your search

+10
View File
@@ -1158,6 +1158,16 @@ var _objectsInRange = function(aList, aRange)
}
}
- (void)_adjustForHeight:(double)height
{
var count = _glyphsFrames.length;
for (var i = 0; i < count; i++)
_glyphsFrames[i].origin.y += (height - _fragmentRect.size.height);
_fragmentRect.size.height=height;
}
- (CPString)description
{
return [super description] +
+10 -3
View File
@@ -198,9 +198,16 @@ var CPSystemTypesetterFactory;
[_layoutManager setLocation:CPMakePoint(myX, _lineBase) forStartOfGlyphRange:lineRange];
[_layoutManager _setAdvancements:advancements forGlyphRange:lineRange];
if (!sameLine)
if (!sameLine) //fix the _lineFragments when fontsizes differ
{
//FIXME: sameLine should result in fixing the _lineFragments, e.g. when fontsizes differ
var l = _lineFragments.length,
maxHeight = 0;
for (var i = 0 ; i < l ; i++)
maxHeight = MAX(maxHeight, _lineFragments[i]._fragmentRect.size.height);
for (var i = 0 ; i < l ; i++)
[_lineFragments[i] _adjustForHeight:maxHeight];
}
if (!lineCount) // do not rescue on first line
@@ -291,7 +298,7 @@ var CPSystemTypesetterFactory;
var currentChar = theString[glyphIndex];
var rangeWidth = [theString.substr(measuringRange.location, measuringRange.length) sizeWithFont:_currentFont inWidth:NULL].width + currentAnchor;
var rangeWidth = [theString.substr(measuringRange.location, measuringRange.length) sizeWithFont:_currentFont inWidth:NULL].width + currentAnchor;
switch (currentChar) // faster than sending actionForControlCharacterAtIndex: called for each char.
{