axis title/labels not using Arial font

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
xandre
Newbie
Newbie
Posts: 3
Joined: Fri Sep 07, 2012 12:00 am

axis title/labels not using Arial font

Post by xandre » Mon Oct 22, 2012 2:58 pm

I just upgraded to TChart 2012 for RAD Studio 2009. The problem is the chart's left/right/bottom axis title and labels now display in a font that is not Arial font. The text is drawn with a very thin line (you can clearly see individual pixels) - thus hard to read.

At run time, my debug environment says the axis LabelsFont is Arial. Version 8 that came with RAD Studio displays in Arial as expected.

To see at design time:
Create a new form, add a standard TChart. Bring up the chart editor and add a FastLineSeries. Edit the left axis maximum or minimum so one of them starts with the number 900. Change the chart background from gray to white so you can see the text clearly.

Look at the 9 in axis label "900" (font sizes 8 and 9) - it is not Arial. Compare to a 9 in Windows Notepad formated as Arial.

Strangely, if you turn on Bold for the font, the "900" looks like Arial!

Please fix.

Thanks.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: axis title/labels not using Arial font

Post by Yeray » Tue Oct 23, 2012 9:21 am

Hi,

Try setting the labels font quality to fqDefault:

Code: Select all

uses Series, TeCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TFastLineSeries);
  Chart1.Axes.Left.SetMinMax(0, 900);

  Chart1.Gradient.Visible:=false;
  Chart1.Color:=clWhite;

  Chart1.Axes.Left.LabelsFont.Name:='Arial';
  Chart1.Axes.Left.LabelsFont.Size:=15;
  Chart1.Axes.Left.LabelsFont.Quality:=fqDefault;

  Color:=clWhite;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  Canvas.Font.Name:='Arial';
  Canvas.Font.Size:=15;
  Canvas.TextOut(Chart1.Left+20, Chart1.Top-20, '900');
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

xandre
Newbie
Newbie
Posts: 3
Joined: Fri Sep 07, 2012 12:00 am

Re: axis title/labels not using Arial font

Post by xandre » Tue Oct 23, 2012 8:04 pm

Yeray,

Setting font.Quality to fqNormal for all titles and labels fixes text drawing that TChart does. Great.

But the Arial text drawing I do in ChartAfterDraw event to the TChart canvas still looks bad. Since the TChart canvas.font does not does not have the Quality property, what do I set?

Thanks.

xandre
Newbie
Newbie
Posts: 3
Joined: Fri Sep 07, 2012 12:00 am

Re: axis title/labels not using Arial font

Post by xandre » Tue Oct 23, 2012 8:11 pm

my typo

I set the Quality to fqDefault as you suggested, not fqNormal as in my previous post.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: axis title/labels not using Arial font

Post by Yeray » Thu Oct 25, 2012 8:51 am

Hi,

The easiest will probably be using GDI+:

Code: Select all

  g:=TGDIPlusCanvas.Create;
  Chart1.Canvas:=g;
  g.AntiAliasText:=gpfDefault;
  //g.AntiAlias:=false;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply