improved baseline support

This commit is contained in:
daboe01 committed 2015-06-28 17:16:24 +02:00
1 parent f81ddc60ec
commit d566642c98
2 files changed
+11 -4

No files matched your search

+7 -3
View File
@@ -1059,6 +1059,7 @@ var _objectsInRange = function(aList, aRange)
@implementation _CPLineFragment : CPObject
{
CPArray _glyphsFrames @accessors(getter=glyphFrames);
CPArray _glyphsOffsets;
BOOL _isInvalid;
BOOL _isLast;
@@ -1147,13 +1148,16 @@ var _objectsInRange = function(aList, aRange)
- (void)setAdvancements:(CPArray)someAdvancements
{
var count = someAdvancements.length,
origin = CGPointMake(_fragmentRect.origin.x + _location.x, _fragmentRect.origin.y);
origin = CGPointMake(_fragmentRect.origin.x + _location.x, _fragmentRect.origin.y),
height = _usedRect.size.height;
_glyphsFrames = new Array(count);
_glyphsOffsets = new Array(count);
for (var i = 0; i < count; i++)
{
_glyphsFrames[i] = CGRectMake(origin.x, origin.y, someAdvancements[i].width, _usedRect.size.height); // FIXME: origin.y+(height-someAdvancements[i].height) for baseline alignment
_glyphsFrames[i] = CGRectMake(origin.x, origin.y - someAdvancements[i].descent, someAdvancements[i].width, height);
_glyphsOffsets[i] = height-someAdvancements[i].height + someAdvancements[i].descent;
origin.x += someAdvancements[i].width;
}
}
@@ -1227,7 +1231,7 @@ var _objectsInRange = function(aList, aRange)
var loc = run._range.location - _runs[0]._range.location;
orig.x = _glyphsFrames[loc].origin.x + aPoint.x;
orig.y = _glyphsFrames[loc].origin.y + aPoint.y;
orig.y = _glyphsFrames[loc].origin.y + aPoint.y + _glyphsOffsets[loc];
run.elem.style.left = (orig.x) + "px";
run.elem.style.top = (orig.y) + "px";
+4 -1
View File
@@ -319,7 +319,10 @@ var CPSystemTypesetterFactory;
isNewline = YES;
}
advancements.push(CPMakeSize(rangeWidth - prevRangeWidth, ascent));
var advancement = CPMakeSize(rangeWidth - prevRangeWidth, ascent);
advancement.descent=descent;
advancements.push(advancement);
prevRangeWidth = _lineWidth = rangeWidth;
if (lineOrigin.x + rangeWidth > containerSize.width)