mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 17:49:14 +02:00
LCL-CustomDrawn: Makes non-native ExtTextOut more resistent against the lack of a selected font
git-svn-id: trunk@35695 -
This commit is contained in:
parent
7bee287eb2
commit
fdb5d3a508
@ -2175,6 +2175,8 @@ var
|
|||||||
FTDrawer: TIntfFreeTypeDrawer;
|
FTDrawer: TIntfFreeTypeDrawer;
|
||||||
ftFont: TFreeTypeFont;
|
ftFont: TFreeTypeFont;
|
||||||
RealX, RealY: Integer;
|
RealX, RealY: Integer;
|
||||||
|
FreeFTFont: Boolean = false;
|
||||||
|
lLogFont: TLogFont;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseCDText}
|
{$ifdef VerboseCDText}
|
||||||
DebugLn(Format(':>[WinAPI ExtTextOut] DC=%x Str=%s X=%d Y=%d',
|
DebugLn(Format(':>[WinAPI ExtTextOut] DC=%x Str=%s X=%d Y=%d',
|
||||||
@ -2200,11 +2202,21 @@ begin
|
|||||||
|
|
||||||
FTDrawer := TIntfFreeTypeDrawer.Create(lDestIntfImage);
|
FTDrawer := TIntfFreeTypeDrawer.Create(lDestIntfImage);
|
||||||
ftFont := TFreeTypeFont(lDestCanvas.ExtraFontData);
|
ftFont := TFreeTypeFont(lDestCanvas.ExtraFontData);
|
||||||
|
if ftFont = nil then
|
||||||
|
begin
|
||||||
|
ftFont := TFreeTypeFont.Create;
|
||||||
|
ftFont.Name := BackendGetFontPath(lLogFont, '');
|
||||||
|
ftFont.Hinted := true;
|
||||||
|
ftFont.ClearType := true;
|
||||||
|
ftFont.Quality := grqHighQuality;
|
||||||
|
FreeFTFont := True;
|
||||||
|
end;
|
||||||
try
|
try
|
||||||
RealX := X + lDestCanvas.WindowOrg.X + lDestCanvas.BaseWindowOrg.X;
|
RealX := X + lDestCanvas.WindowOrg.X + lDestCanvas.BaseWindowOrg.X;
|
||||||
RealY := Y + lDestCanvas.WindowOrg.Y + lDestCanvas.BaseWindowOrg.Y + lFontSize;
|
RealY := Y + lDestCanvas.WindowOrg.Y + lDestCanvas.BaseWindowOrg.Y + lFontSize;
|
||||||
FTDrawer.DrawText(Str, ftFont, RealX, RealY, colBlack, 255);
|
FTDrawer.DrawText(Str, ftFont, RealX, RealY, colBlack, 255);
|
||||||
finally
|
finally
|
||||||
|
if FreeFTFont then ftFont.Free;
|
||||||
FTDrawer.Free;
|
FTDrawer.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user