diff --git a/components/tachart/demo/bgra/Main.lfm b/components/tachart/demo/bgra/Main.lfm index c19186a1c4..43affe2559 100644 --- a/components/tachart/demo/bgra/Main.lfm +++ b/components/tachart/demo/bgra/Main.lfm @@ -15,6 +15,7 @@ object Form1: TForm1 Width = 300 AxisList = < item + Marks.LabelFont.Orientation = 400 Title.LabelFont.Orientation = 900 end item diff --git a/components/tachart/demo/bgra/Main.pas b/components/tachart/demo/bgra/Main.pas index 46b67f1ac4..5ebb940cda 100644 --- a/components/tachart/demo/bgra/Main.pas +++ b/components/tachart/demo/bgra/Main.pas @@ -30,21 +30,22 @@ implementation {$R *.lfm} uses - BGRABitmap, TADrawerBGRA; + BGRABitmap, TADrawerBGRA, TADrawerCanvas, TADrawUtils; { TForm1 } procedure TForm1.PaintBox1Paint(Sender: TObject); var bmp: TBGRABitmap; + id: IChartDrawer; begin bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height); Chart1.DisableRedrawing; try Chart1.Title.Text.Text := 'BGRABitmap'; - Chart1.Draw( - TBGRABitmapDrawer.Create(bmp), - Rect(0, 0, PaintBox1.Width, PaintBox1.Height)); + id := TBGRABitmapDrawer.Create(bmp); + id.DoGetFontOrientation := @CanvasGetFontOrientationFunc; + Chart1.Draw(id, Rect(0, 0, PaintBox1.Width, PaintBox1.Height)); bmp.Draw(PaintBox1.Canvas, 0, 0); Chart1.Title.Text.Text := 'Standard'; finally diff --git a/components/tachart/tadrawerbgra.pas b/components/tachart/tadrawerbgra.pas index 9354cd4c65..d9aab1018a 100644 --- a/components/tachart/tadrawerbgra.pas +++ b/components/tachart/tadrawerbgra.pas @@ -30,6 +30,7 @@ type FBrushColor: TBGRAPixel; FCanvas: TBGRABitmap; FFontColor: TBGRAPixel; + FFontOrientation: Integer; FPenColor: TBGRAPixel; FPenWidth: Integer; FPrevPoint: TPoint; @@ -104,7 +105,7 @@ end; procedure TBGRABitmapDrawer.AddToFontOrientation(ADelta: Integer); begin - // NA + FFontOrientation += ADelta; end; procedure TBGRABitmapDrawer.ClippingStart(const AClipRect: TRect); @@ -234,6 +235,7 @@ procedure TBGRABitmapDrawer.SetFont(AFont: TFPCustomFont); begin FCanvas.FontName := AFont.Name; FCanvas.FontHeight := AFont.Size * 96 div 72; + FFontOrientation := FGetFontOrientationFunc(AFont); with AFont.FPColor do FFontColor := BGRA(red shr 8, green shr 8, blue shr 8, alpha shr 8); // TODO: FontStyle @@ -262,7 +264,8 @@ end; procedure TBGRABitmapDrawer.SimpleTextOut(AX, AY: Integer; const AText: String); begin - FCanvas.TextOut(AX, AY, AText, FFontColor); + FCanvas.TextOutAngle( + AX, AY, FFontOrientation, AText, FFontColor, taLeftJustify); end; end.