mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 05:19:25 +02:00
TAChart: Fix nogui demo showing no texts. (Fix is effective only on fpc fixes or main)
This commit is contained in:
parent
a7ee5a544d
commit
002b5cd1bc
@ -23,6 +23,12 @@ var
|
||||
d: IChartDrawer;
|
||||
begin
|
||||
chart := TChart.Create(nil);
|
||||
chart.Width := 600;
|
||||
chart.Height := 400;
|
||||
chart.Title.Text.Text := 'TAChart nogui demo';
|
||||
chart.Title.Font.Size := 16;
|
||||
chart.Title.Font.Name := FONT_NAME;
|
||||
chart.Title.Visible := true;
|
||||
chart.LeftAxis.Marks.LabelFont.Name := FONT_NAME;
|
||||
chart.LeftAxis.Marks.LabelFont.Size := 10;
|
||||
chart.LeftAxis.Marks.LabelFont.Orientation := 450;
|
||||
|
@ -36,6 +36,7 @@ type
|
||||
// in horizontal horientation. FMeasureFont is always horizontal.
|
||||
{$ENDIF}
|
||||
procedure EnsureFont;
|
||||
function GetDefaultFontName: String;
|
||||
procedure SetBrush(ABrush: TFPCustomBrush);
|
||||
procedure SetFont(AFont: TFPCustomFont);
|
||||
procedure SetPen(APen: TFPCustomPen);
|
||||
@ -152,14 +153,16 @@ begin
|
||||
{$IFDEF USE_FTFONT}
|
||||
if FFont = nil then begin
|
||||
FFont := TFreeTypeFont.Create;
|
||||
FFont.Resolution := 72;
|
||||
FFont.Size := DEFAULT_FONT_SIZE;
|
||||
FFont.Resolution := 96;
|
||||
FFont.AntiAliased := true; //false;
|
||||
FCanvas.Font := FFont;
|
||||
end;
|
||||
|
||||
if FMeasureFont = nil then begin
|
||||
FMeasureFont := TFreeTypeFont.Create;
|
||||
FMeasureFont.Resolution := 72;
|
||||
FMeasureFont.Size := DEFAULT_FONT_SIZE;
|
||||
FMeasureFont.Resolution := 96;
|
||||
FMeasureFont.AntiAliased := false;
|
||||
end;
|
||||
{$ENDIF}
|
||||
@ -176,6 +179,11 @@ begin
|
||||
Result := FPColorToChartColor(FCanvas.Brush.FPColor);
|
||||
end;
|
||||
|
||||
function TFPCanvasDrawer.GetDefaultFontName: String;
|
||||
begin
|
||||
Result := 'arial';
|
||||
end;
|
||||
|
||||
function TFPCanvasDrawer.GetFontAngle: Double;
|
||||
begin
|
||||
{$IFDEF USE_FTFONT}
|
||||
@ -318,9 +326,17 @@ begin
|
||||
AssignFPCanvasHelper(FFont, AFont);
|
||||
AssignFPCanvasHelper(FMeasureFont, AFont);
|
||||
// DoCopyProps performs direct variable assignment, so call SetName by hand.
|
||||
FFont.Name := AFont.Name;
|
||||
if AFont.Name = 'default' then
|
||||
FFont.Name := GetDefaultFontName
|
||||
else
|
||||
FFont.Name := AFont.Name;
|
||||
if AFont.Size = 0 then
|
||||
FFont.Size := DEFAULT_FONT_SIZE
|
||||
else
|
||||
FFont.Size := AFont.Size;
|
||||
FFont.Angle := OrientToRad(FGetFontOrientationFunc(AFont));
|
||||
FMeasureFont.Name := AFont.Name;
|
||||
FMeasureFont.Name := FFont.Name;
|
||||
FMeasureFont.Size := FFont.Size;
|
||||
FMeasureFont.Angle := 0;
|
||||
{$ELSE}
|
||||
Unused(AFont);
|
||||
|
Loading…
Reference in New Issue
Block a user