carbon: fix for ExtTextOut rendering, fix bug #16359

git-svn-id: trunk@25080 -
This commit is contained in:
dmitry 2010-04-30 13:25:02 +00:00
parent 5e19b2eb44
commit ca109daec8

View File

@ -972,21 +972,19 @@ var
Buffer : TCarbonTextLayoutBuffer; Buffer : TCarbonTextLayoutBuffer;
Handled : Boolean; Handled : Boolean;
begin begin
Result := noErr;
Buffer := TCarbonTextLayoutBuffer(iRefCon); Buffer := TCarbonTextLayoutBuffer(iRefCon);
if not Assigned(Buffer) then oCallbackStatus:=kATSULayoutOperationCallbackStatusHandled;
Result := noErr
else if Assigned(Buffer) then
begin begin
Handled := false; Handled := false;
Buffer.DoJustify(iLineRef, Handled); Buffer.DoJustify(iLineRef, Handled);
Result := noErr; if Handled then oCallbackStatus:=kATSULayoutOperationCallbackStatusHandled;
end; end;
end; end;
procedure TCarbonTextLayoutBuffer.DoJustify(iLineRef: ATSULineRef; var Handled: Boolean); procedure TCarbonTextLayoutBuffer.DoJustify(iLineRef: ATSULineRef; var Handled: Boolean);
type
TFixedArray = array [Word] of Fixed;
PFixedArray = ^TFixedArray;
type type
ATSLayoutRecord1 = packed record ATSLayoutRecord1 = packed record
glyphID: ATSGlyphRef; glyphID: ATSGlyphRef;
@ -999,34 +997,26 @@ type
TATSLayoutRecordArray = array [Word] of ATSLayoutRecord1; TATSLayoutRecordArray = array [Word] of ATSLayoutRecord1;
PATSLayoutRecordArray = ^TATSLayoutRecordArray; PATSLayoutRecordArray = ^TATSLayoutRecordArray;
var var
Deltas : PFixedArray;
Count : ItemCount; Count : ItemCount;
i, ofs : Integer; i, ofs : Integer;
Layouts : PATSLayoutRecordArray; Layouts : PATSLayoutRecordArray;
LayCount : ItemCount; LayCount : ItemCount;
begin begin
if not Assigned(FDX) or (FDXCount=0) then Exit; if not Assigned(FDX) or (FDXCount=0) then Exit;
{ if idx < FDXCount then
begin}
Layouts:=nil;
Laycount:=0; Laycount:=0;
ATSUDirectGetLayoutDataArrayPtrFromLineRef( iLineRef, ATSUDirectGetLayoutDataArrayPtrFromLineRef( iLineRef,
kATSUDirectDataLayoutRecordATSLayoutRecordVersion1, true, @Layouts, Laycount); kATSUDirectDataLayoutRecordATSLayoutRecordVersion1, true, @Layouts, Laycount);
ATSUDirectGetLayoutDataArrayPtrFromLineRef (iLineRef,
kATSUDirectDataAdvanceDeltaFixedArray, true, @Deltas, Count);
if Assigned(Layouts) and (Laycount>0) then if Assigned(Layouts) and (Laycount>0) then
begin begin
ofs:=0; ofs:=0;
for i:=0 to Min(FDXCount, Min(LayCount, Count))-1 do for i:=0 to Min(FDXCount, Min(LayCount, Count))-1 do
begin begin
Deltas^[i] := Layouts^[i].realPos-Long2Fix(ofs);
Layouts^[i].realPos:=Long2Fix(ofs); Layouts^[i].realPos:=Long2Fix(ofs);
inc(ofs, FDX[i]); inc(ofs, FDX[i]);
end; end;
end; end;
ATSUDirectReleaseLayoutDataArrayPtr(iLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, @Layouts ); ATSUDirectReleaseLayoutDataArrayPtr(iLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, @Layouts );
ATSUDirectReleaseLayoutDataArrayPtr(iLineRef, kATSUDirectDataAdvanceDeltaFixedArray, @Deltas); Handled:=True;
// end;
end; end;
function TCarbonTextLayoutBuffer.Draw(X, Y: Integer; Dx: PInteger; DXCount: Integer): Boolean; function TCarbonTextLayoutBuffer.Draw(X, Y: Integer; Dx: PInteger; DXCount: Integer): Boolean;