mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 23:59:19 +02:00
carbon intf: undo change to ExtTextOut
git-svn-id: trunk@12728 -
This commit is contained in:
parent
5e807a544e
commit
6cf44713b0
@ -102,9 +102,7 @@ type
|
|||||||
function SaveDC: Integer;
|
function SaveDC: Integer;
|
||||||
function RestoreDC(ASavedDC: Integer): Boolean;
|
function RestoreDC(ASavedDC: Integer): Boolean;
|
||||||
|
|
||||||
function BeginTextRender(AStr: PChar; ACount: Integer;
|
function BeginTextRender(AStr: PChar; ACount: Integer; out ALayout: ATSUTextLayout): Boolean;
|
||||||
const ADisableFractionalPositions:Boolean;
|
|
||||||
out ALayout: ATSUTextLayout): Boolean;
|
|
||||||
procedure EndTextRender(var ALayout: ATSUTextLayout);
|
procedure EndTextRender(var ALayout: ATSUTextLayout);
|
||||||
|
|
||||||
procedure SetAntialiasing(AValue: Boolean);
|
procedure SetAntialiasing(AValue: Boolean);
|
||||||
@ -595,7 +593,6 @@ end;
|
|||||||
Method: TCarbonDeviceContext.BeginTextRender
|
Method: TCarbonDeviceContext.BeginTextRender
|
||||||
Params: AStr - UTF8 string to render
|
Params: AStr - UTF8 string to render
|
||||||
ACount - Count of chars to render
|
ACount - Count of chars to render
|
||||||
ADisableFractionalPositions - whether to disable fractional positions
|
|
||||||
ALayout - ATSU layout
|
ALayout - ATSU layout
|
||||||
Returns: If the function suceeds
|
Returns: If the function suceeds
|
||||||
|
|
||||||
@ -603,9 +600,8 @@ end;
|
|||||||
context to render the text.
|
context to render the text.
|
||||||
NOTE: Coordination system is set upside-down!
|
NOTE: Coordination system is set upside-down!
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCarbonDeviceContext.BeginTextRender(AStr: PChar; ACount: Integer;
|
function TCarbonDeviceContext.BeginTextRender(AStr: PChar; ACount: Integer; out
|
||||||
const ADisableFractionalPositions:Boolean;
|
ALayout: ATSUTextLayout): Boolean;
|
||||||
out ALayout: ATSUTextLayout): Boolean;
|
|
||||||
var
|
var
|
||||||
TextStyle: ATSUStyle;
|
TextStyle: ATSUStyle;
|
||||||
TextLength: LongWord;
|
TextLength: LongWord;
|
||||||
@ -650,16 +646,15 @@ begin
|
|||||||
Self, SName, 'ATSUSetLayoutControls', 'LineRotation') then Exit;
|
Self, SName, 'ATSUSetLayoutControls', 'LineRotation') then Exit;
|
||||||
|
|
||||||
// disable fractional positions of glyphs in layout
|
// disable fractional positions of glyphs in layout
|
||||||
if ADisableFractionalPositions then begin
|
Tag := kATSULineLayoutOptionsTag;
|
||||||
Tag := kATSULineLayoutOptionsTag;
|
DataSize := SizeOf(ATSLineLayoutOptions);
|
||||||
DataSize := SizeOf(ATSLineLayoutOptions);
|
|
||||||
|
Options := kATSLineFractDisable or kATSLineDisableAutoAdjustDisplayPos or
|
||||||
|
kATSLineDisableAllLayoutOperations or kATSLineUseDeviceMetrics;
|
||||||
|
PValue := @Options;
|
||||||
|
if OSError(ATSUSetLayoutControls(ALayout, 1, @Tag, @DataSize, @PValue),
|
||||||
|
Self, SName, 'ATSUSetLayoutControls', 'LineLayoutOptions') then Exit;
|
||||||
|
|
||||||
Options := kATSLineFractDisable or kATSLineDisableAutoAdjustDisplayPos or
|
|
||||||
kATSLineDisableAllLayoutOperations or kATSLineUseDeviceMetrics;
|
|
||||||
PValue := @Options;
|
|
||||||
if OSError(ATSUSetLayoutControls(ALayout, 1, @Tag, @DataSize, @PValue),
|
|
||||||
Self, SName, 'ATSUSetLayoutControls', 'LineLayoutOptions') then Exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// set layout context
|
// set layout context
|
||||||
Tag := kATSUCGContextTag;
|
Tag := kATSUCGContextTag;
|
||||||
@ -842,7 +837,7 @@ const
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
if not BeginTextRender(Str, Count, Dx<>nil, TextLayout) then
|
if not BeginTextRender(Str, Count, TextLayout) then
|
||||||
begin
|
begin
|
||||||
// It is possible that the background should be filled even without text;
|
// It is possible that the background should be filled even without text;
|
||||||
if (Options and ETO_OPAQUE) > 0 then
|
if (Options and ETO_OPAQUE) > 0 then
|
||||||
@ -980,7 +975,7 @@ begin
|
|||||||
Size.cx := 0;
|
Size.cx := 0;
|
||||||
Size.cy := 0;
|
Size.cy := 0;
|
||||||
|
|
||||||
if not BeginTextRender(Str, Count, false, TextLayout) then Exit;
|
if not BeginTextRender(Str, Count, TextLayout) then Exit;
|
||||||
try
|
try
|
||||||
// finally compute the text dimensions
|
// finally compute the text dimensions
|
||||||
if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
|
if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
|
||||||
@ -1023,7 +1018,7 @@ begin
|
|||||||
|
|
||||||
// According to the MSDN library, TEXTMETRIC:
|
// According to the MSDN library, TEXTMETRIC:
|
||||||
// the average char width is generally defined as the width of the letter x
|
// the average char width is generally defined as the width of the letter x
|
||||||
if not BeginTextRender('x', 1, false, TextLayout) then Exit;
|
if not BeginTextRender('x', 1, TextLayout) then Exit;
|
||||||
try
|
try
|
||||||
if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
|
if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
|
||||||
kATSUToTextEnd, TextBefore, TextAfter, Ascent, Descent),
|
kATSUToTextEnd, TextBefore, TextAfter, Ascent, Descent),
|
||||||
|
Loading…
Reference in New Issue
Block a user