LazMapViewer: Fix default font height in BGRADrawingEngine
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9683 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
2eb97a3732
commit
8e3611f53a
@ -47,6 +47,8 @@ type
|
|||||||
FFontColor: TColor;
|
FFontColor: TColor;
|
||||||
FFontSize: Integer;
|
FFontSize: Integer;
|
||||||
FFontStyle: TFontStyles;
|
FFontStyle: TFontStyles;
|
||||||
|
procedure ApplyFont;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
function GetBrushColor: TColor; override;
|
function GetBrushColor: TColor; override;
|
||||||
function GetBrushStyle: TBrushStyle; override;
|
function GetBrushStyle: TBrushStyle; override;
|
||||||
@ -387,8 +389,21 @@ begin
|
|||||||
FBuffer.CanvasBGRA.Pen.Width := AValue;
|
FBuffer.CanvasBGRA.Pen.Width := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMvBGRADrawingEngine.ApplyFont;
|
||||||
|
var
|
||||||
|
fntSize: Integer;
|
||||||
|
begin
|
||||||
|
FBuffer.CanvasBGRA.Font.Name := FFontName;
|
||||||
|
if FFontSize = 0 then fntSize := 10 else fntSize := FFontSize;
|
||||||
|
FBuffer.CanvasBGRA.Font.Height := -Round(ScreenInfo.PixelsPerInchY / 72.0 * fntSize);
|
||||||
|
FBuffer.CanvasBGRA.Font.Style := FFontStyle;
|
||||||
|
FBuffer.CanvasBGRA.Font.Color := FFontColor;
|
||||||
|
FBuffer.CanvasBGRA.Font.Antialiasing := true;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMvBGRADrawingEngine.TextExtent(const AText: String): TSize;
|
function TMvBGRADrawingEngine.TextExtent(const AText: String): TSize;
|
||||||
begin
|
begin
|
||||||
|
ApplyFont;
|
||||||
Result := FBuffer.CanvasBGRA.TextExtent(AText);
|
Result := FBuffer.CanvasBGRA.TextExtent(AText);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -396,11 +411,7 @@ procedure TMvBGRADrawingEngine.TextOut(X, Y: Integer; const AText: String);
|
|||||||
begin
|
begin
|
||||||
if (AText <> '') then
|
if (AText <> '') then
|
||||||
begin
|
begin
|
||||||
FBuffer.CanvasBGRA.Font.Name := FFontName;
|
ApplyFont;
|
||||||
FBuffer.CanvasBGRA.Font.Height := -Round(ScreenInfo.PixelsPerInchY / 72.0 * FFontSize);
|
|
||||||
FBuffer.CanvasBGRA.Font.Style := FFontStyle;
|
|
||||||
FBuffer.CanvasBGRA.Font.Color := FFontColor;
|
|
||||||
FBuffer.CanvasBGRA.Font.Antialiasing := true;
|
|
||||||
FBuffer.CanvasBGRA.TextOut(X, Y, AText);
|
FBuffer.CanvasBGRA.TextOut(X, Y, AText);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user