mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-05 16:42:58 +00:00
improved baseline support
This commit is contained in:
1 parent
f81ddc60ec
commit
d566642c98
2 files changed
+11
-4
No files matched your search
@@ -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";
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user