Cannot change font name for numbers on TChart axes
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Cannot change font name for numbers on TChart axes
Dear TeeChart technical help,
I am using RAD Studio 10.1 Berlin and a registered version of Steema TeeChart Pro VCL FMX 2016.18, and am updating a project from BDS 2006.
I am trying to change the fonts for the numbers on the left and bottom axis from 'MS Sans Serif' to 'Arial' - and I CANNOT DO THIS! The things I have tried to do include:
1) I have tried changing in the Object Inspector:
TChart->BottomAxis->LabelsFont->Name FROM MS Sans Serif TO Arial
TChart->LeftAxis->LabelsFont->Name FROM MS Sans Serif TO Arial
- this FAILED
2) In the constructor code for a frame that contains the TChart
__fastcall TChartXFrame::TChartXFrame(TComponent* Owner : TFrame(Owner)
{
TChartX->LeftAxis->LabelsFont->Name = "Arial"; // this FAILED - doesn't work to change number font from 'MS Sans Serif' to 'Arial'
}
3) I have File->SaveAll and exited RAD Studio, then restarted RAD Studio, loaded my project in, Project->Build to compile and link it - this FAILED
4) I have deleted ALL *.obj files, then Project->Build to compile and link it - this FAILED
5) I have gone into the *.dfm code and changed every instance of 'MS Sans Serif' to 'Arial' - this FAILED
6) I have CUT out the TChart in a frame and PASTED it back in to the frame - this FAILED
Do you know how can I fix this bug?
It seems that somewhere in my project there is a hard coding of 'MS Sans Serif' that I cannot change to 'Arial'. Do you know where this is?
Alternatively, could this bug have something to do with this warning W8080 I get from most of the files in my project?
[bcc32 Warning]: W8080 'Gdiplus::FlatnessDefault' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSansSerifFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSerifFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericMonospaceFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSansSerifFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSerifFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericMonospaceFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericTypographicStringFormatBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericDefaultStringFormatBuffer' is declared but never used
Thank you,
Bill Anderson
I am using RAD Studio 10.1 Berlin and a registered version of Steema TeeChart Pro VCL FMX 2016.18, and am updating a project from BDS 2006.
I am trying to change the fonts for the numbers on the left and bottom axis from 'MS Sans Serif' to 'Arial' - and I CANNOT DO THIS! The things I have tried to do include:
1) I have tried changing in the Object Inspector:
TChart->BottomAxis->LabelsFont->Name FROM MS Sans Serif TO Arial
TChart->LeftAxis->LabelsFont->Name FROM MS Sans Serif TO Arial
- this FAILED
2) In the constructor code for a frame that contains the TChart
__fastcall TChartXFrame::TChartXFrame(TComponent* Owner : TFrame(Owner)
{
TChartX->LeftAxis->LabelsFont->Name = "Arial"; // this FAILED - doesn't work to change number font from 'MS Sans Serif' to 'Arial'
}
3) I have File->SaveAll and exited RAD Studio, then restarted RAD Studio, loaded my project in, Project->Build to compile and link it - this FAILED
4) I have deleted ALL *.obj files, then Project->Build to compile and link it - this FAILED
5) I have gone into the *.dfm code and changed every instance of 'MS Sans Serif' to 'Arial' - this FAILED
6) I have CUT out the TChart in a frame and PASTED it back in to the frame - this FAILED
Do you know how can I fix this bug?
It seems that somewhere in my project there is a hard coding of 'MS Sans Serif' that I cannot change to 'Arial'. Do you know where this is?
Alternatively, could this bug have something to do with this warning W8080 I get from most of the files in my project?
[bcc32 Warning]: W8080 'Gdiplus::FlatnessDefault' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSansSerifFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSerifFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericMonospaceFontFamily' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSansSerifFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericSerifFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericMonospaceFontFamilyBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericTypographicStringFormatBuffer' is declared but never used
[bcc32 Warning]: W8080 'Gdiplus::GenericDefaultStringFormatBuffer' is declared but never used
Thank you,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello Bill,
I've tried it both with TeeChart v2017.21 and v2016.18 in Berlin, and it seems to work fine for me both through the editor and by code.
I'd edit manually (with notepad or similar) the project files searching for any reference to any font name that may be hard-coded.
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
I've tried it both with TeeChart v2017.21 and v2016.18 in Berlin, and it seems to work fine for me both through the editor and by code.
I'd edit manually (with notepad or similar) the project files searching for any reference to any font name that may be hard-coded.
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Dear Yeray,
I made a simple sample project that shows that Ariel 9 fonts are NOT correctly printed as LeftAxis number labels. The Arial 9 fonts appear correctly in the uncompiled Form1 of Unit1.cpp (LEFT side of Anderson_TChartBUG_Arial_vs_SansSerif.png
in the attached Anderson_TChartBUG_Arial_vs_SansSerif.zip file). However, when the program is compiled and run, the numbers appear to be MS Sans Serif in the project1.exe executable (RIGHT side of Anderson_TChartBUG_Arial_vs_SansSerif.png in the attached *.zip file). These 'Sans Serif'-like fonts are block-like and do not show the complex shading of the darker Arial 9 fonts seen in Unit1.cpp.
In Anderson_TChartBUG_Arial_vs_SansSerif.zip I have included the code showing the BUG. One difference, however, is that although I own the licensed to TChart Pro v2016.18, for this project I actually didn't need to use the TChart Pro,
and the TChart code in the project I sent is just the Standard TChart code included in RAD Studio XE 10.1 Berlin, Update 1. Presumably this wont be the cause of the bug.
I have tried for TWO DAYS to upload my attachment file, but your server is NOT WORKING. Therefore, you can download my zip file from my university server:
Anderson_TChartBUG_Arial_vs_SansSerif.zip is now available for download from the following URL:
https://fluff.bris.ac.uk/fluff/u3/anwwa ... yGHyEZQcwp
and will remain there until: Wed May 10 22:59:59 2017 UTC.
Hope to hear from you soon.
Sincerely,
Bill Anderson
I made a simple sample project that shows that Ariel 9 fonts are NOT correctly printed as LeftAxis number labels. The Arial 9 fonts appear correctly in the uncompiled Form1 of Unit1.cpp (LEFT side of Anderson_TChartBUG_Arial_vs_SansSerif.png
in the attached Anderson_TChartBUG_Arial_vs_SansSerif.zip file). However, when the program is compiled and run, the numbers appear to be MS Sans Serif in the project1.exe executable (RIGHT side of Anderson_TChartBUG_Arial_vs_SansSerif.png in the attached *.zip file). These 'Sans Serif'-like fonts are block-like and do not show the complex shading of the darker Arial 9 fonts seen in Unit1.cpp.
In Anderson_TChartBUG_Arial_vs_SansSerif.zip I have included the code showing the BUG. One difference, however, is that although I own the licensed to TChart Pro v2016.18, for this project I actually didn't need to use the TChart Pro,
and the TChart code in the project I sent is just the Standard TChart code included in RAD Studio XE 10.1 Berlin, Update 1. Presumably this wont be the cause of the bug.
I have tried for TWO DAYS to upload my attachment file, but your server is NOT WORKING. Therefore, you can download my zip file from my university server:
Anderson_TChartBUG_Arial_vs_SansSerif.zip is now available for download from the following URL:
https://fluff.bris.ac.uk/fluff/u3/anwwa ... yGHyEZQcwp
and will remain there until: Wed May 10 22:59:59 2017 UTC.
Hope to hear from you soon.
Sincerely,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello,
I added "915" to all "tee" references in the cbproj, opened the project with RAD XE and this is what I get with it:
It seems as if your application was using GDI instead of GDIPlus.
If I open the dfm as text and I change this:
for this:
Then I get the same result you are getting.
I added "915" to all "tee" references in the cbproj, opened the project with RAD XE and this is what I get with it:
It seems as if your application was using GDI instead of GDIPlus.
If I open the dfm as text and I change this:
Code: Select all
DefaultCanvas = 'TGDIPlusCanvas'
Code: Select all
DefaultCanvas = 'TCanvas3D'
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Yeray,
I'm sorry to say this, but the changes you suggested didn't work - I still get SanSerif-like TChart output fonts!!!
I reinstalled my TChart Pro using TeeChartVCLFMX-2016.18.exe - so that I could use your '915' additions ( but I used my '924' rather than your '915')
Then in Project1.cbproj using Notepad, I substituted:
in <AllPackageLibs> replaced 'tee.lib' with 'tee924.lib'
in <PackageImports> replaced 'tee' with 'tee9240'' and then 'DclTeePro924', replaced 'teeDB' with 'teeDB9240', replaced 'teeUI' with 'teeUI9240', replaced 'FMXtee' with 'FMXtee924', and replaced 'FmxTeeUI' with 'FmxTeeUI924'
in <LinkPackageImports> replaced 'tee.bpi' with 'tee924.bpi'
I made sure that in Unit1.dfm, the
Font.name = 'Arial'
This did not fix the problem.
I also tried adding to the Unit1.dfm file
LeftAxis.LabelsFont.Name = 'Arial'
This did not fix the problem.
I also checked that in Unit1.dfm:
DefaultCanvas = 'TGDIPlusCanvas'
(and in fact I rechecked the code I sent you, and in Unit1.dfm, the DefaultCanvas = 'TGDIPlusCanvas')
I have no idea why your code works and mine doesn't.
As a step forward, would you please send me the code you changed to that worked - in particular the *.cbproj file? Thank you.
Sincerely,
Bill Anderson
I'm sorry to say this, but the changes you suggested didn't work - I still get SanSerif-like TChart output fonts!!!
I reinstalled my TChart Pro using TeeChartVCLFMX-2016.18.exe - so that I could use your '915' additions ( but I used my '924' rather than your '915')
Then in Project1.cbproj using Notepad, I substituted:
in <AllPackageLibs> replaced 'tee.lib' with 'tee924.lib'
in <PackageImports> replaced 'tee' with 'tee9240'' and then 'DclTeePro924', replaced 'teeDB' with 'teeDB9240', replaced 'teeUI' with 'teeUI9240', replaced 'FMXtee' with 'FMXtee924', and replaced 'FmxTeeUI' with 'FmxTeeUI924'
in <LinkPackageImports> replaced 'tee.bpi' with 'tee924.bpi'
I made sure that in Unit1.dfm, the
Font.name = 'Arial'
This did not fix the problem.
I also tried adding to the Unit1.dfm file
LeftAxis.LabelsFont.Name = 'Arial'
This did not fix the problem.
I also checked that in Unit1.dfm:
DefaultCanvas = 'TGDIPlusCanvas'
(and in fact I rechecked the code I sent you, and in Unit1.dfm, the DefaultCanvas = 'TGDIPlusCanvas')
I have no idea why your code works and mine doesn't.
As a step forward, would you please send me the code you changed to that worked - in particular the *.cbproj file? Thank you.
Sincerely,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello Bill,
I've modified the cbproj to use TeeChart for Berlin (Tee*924) instead of XE (Tee*915). And I believe I found adding this "pragma link" seems to make the difference:
Make sure to Clean the project before Building. Sometimes the changes seem not to be applied correctly if I don't Clean the project.
I've modified the cbproj to use TeeChart for Berlin (Tee*924) instead of XE (Tee*915). And I believe I found adding this "pragma link" seems to make the difference:
Code: Select all
#pragma link "VclTee.TeeGDIPlus"
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Yeray,
Thenk you. I got the code TO WORK at 100% of the native resolution of my monitors: 1920 x 1080 and 3840 x 2160.
(See TChartBUG_1920x1080_100%.png and TChartBUG_3840x2160_100%.png.)
However I did find an additional bug that if you set one of the high resolution monitors to its native resolution (3840 x 2160) and then changed the
size of the text to 200% (by RightMouseButtonClick on WholeScreen -> Settings -> Display -> Change the size of text, apps, and other items: 200%)
which EFFECTIVELY would create a 1920 x 1080 monitor, the project1.exe TChart font sizes were INCORRECTLY HALF those in the RAD Studio XE10.1.
(See TChartBUG_3840x2160_200%.png.) This is a BUG. In contrast, the fonts in TLabels and TPanels appear correct at 3840 x 2160 at 200%.
I just wanted to bring your attention to this which you would not find if you were always using the native resolution of your monitor.
However, higher resolution monitors like 3840x2160 are now available quite cheap (<£300) and so more and more customers will
be using very high resolution monitors at size of text settings > 100%.
Sincerely,
Bill Anderson
Thenk you. I got the code TO WORK at 100% of the native resolution of my monitors: 1920 x 1080 and 3840 x 2160.
(See TChartBUG_1920x1080_100%.png and TChartBUG_3840x2160_100%.png.)
However I did find an additional bug that if you set one of the high resolution monitors to its native resolution (3840 x 2160) and then changed the
size of the text to 200% (by RightMouseButtonClick on WholeScreen -> Settings -> Display -> Change the size of text, apps, and other items: 200%)
which EFFECTIVELY would create a 1920 x 1080 monitor, the project1.exe TChart font sizes were INCORRECTLY HALF those in the RAD Studio XE10.1.
(See TChartBUG_3840x2160_200%.png.) This is a BUG. In contrast, the fonts in TLabels and TPanels appear correct at 3840 x 2160 at 200%.
I just wanted to bring your attention to this which you would not find if you were always using the native resolution of your monitor.
However, higher resolution monitors like 3840x2160 are now available quite cheap (<£300) and so more and more customers will
be using very high resolution monitors at size of text settings > 100%.
Sincerely,
Bill Anderson
- Attachments
-
- TChartBUG_3840x2160_200%.png (330.36 KiB) Viewed 18576 times
-
- TChartBUG_3840x2160x_100%.png (168.66 KiB) Viewed 18579 times
-
- TChartBUG_1920x1080_100%.png (102.14 KiB) Viewed 18576 times
Re: Cannot change font name for numbers on TChart axes
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Versay,
No, this does not work correctly, ie when the high resolution monitor was set to its native resolution (3840 x 2160) and the size of the text was set to 200%,
the project1.exe TChart font sizes were still INCORRECTLY HALF those in the RAD Studio XE10.1.
But now, instead the size of the number font increases when the size of the TChart increases (when manually elongated or increased in height). I definitely don't want this, so
TChart1->View3DOptions->ZoomText=ztAuto; definitely does not seem the way to go.
Also, the Arial number fonts on the left axis do not respond to whether the Windows 10 ClearType check box is checked or unchecked. In other words,
the TChart number fonts just don't respond the way the fonts do in C++Builder's TPanel or TLabel.
I don't know if anything can be done about this. I may have to stick with the old MS Sans Serif which do work correctly when the high resolution monitor
is set to its native resolution (3840 x 2160) and the size of the text is set to 200% - the font sizes were CORRECTLY equal to those in the RAD Studio XE10.1.
Sincerely,
Bill Anderson
No, this does not work correctly, ie when the high resolution monitor was set to its native resolution (3840 x 2160) and the size of the text was set to 200%,
the project1.exe TChart font sizes were still INCORRECTLY HALF those in the RAD Studio XE10.1.
But now, instead the size of the number font increases when the size of the TChart increases (when manually elongated or increased in height). I definitely don't want this, so
TChart1->View3DOptions->ZoomText=ztAuto; definitely does not seem the way to go.
Also, the Arial number fonts on the left axis do not respond to whether the Windows 10 ClearType check box is checked or unchecked. In other words,
the TChart number fonts just don't respond the way the fonts do in C++Builder's TPanel or TLabel.
I don't know if anything can be done about this. I may have to stick with the old MS Sans Serif which do work correctly when the high resolution monitor
is set to its native resolution (3840 x 2160) and the size of the text is set to 200% - the font sizes were CORRECTLY equal to those in the RAD Studio XE10.1.
Sincerely,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello Bill,
Looking at it again I found this seems to work in Delphi:
I'm not sure how to translate it to CBuilder.
Looking at it again I found this seems to work in Delphi:
Code: Select all
type TCustomTeePanelAccess=class(TCustomTeePanel);
procedure TForm2.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI,
NewDPI: Integer);
begin
TCustomTeePanelAccess(TChart1).ChangeScale(NewDPI, OldDPI);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Veray,
I had no progress with the Delphi code you provided. I really don't know Delphi, and I have enough trouble with C/C++!!!
Could you please send me a C++ Builder equivalent, and also tell me where you got the OldDPI and NewDPI.
Sending me all the code in this project would actually be much appreciated.
Sincerely,
Bill Anderson
I had no progress with the Delphi code you provided. I really don't know Delphi, and I have enough trouble with C/C++!!!
Could you please send me a C++ Builder equivalent, and also tell me where you got the OldDPI and NewDPI.
Sending me all the code in this project would actually be much appreciated.
Sincerely,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello Bill,
The trick consists on creating a helper class to allow accessing a protected method.
Here is how you can do it in CBuilder:
Note you have to create the FormAfterMonitorDpiChanged method using the Object Inspector:
The trick consists on creating a helper class to allow accessing a protected method.
Here is how you can do it in CBuilder:
Code: Select all
class TCustomTeePanelAccess : public TCustomTeePanel
{
public:
DYNAMIC void __fastcall ChangeScale(int M, int D)
{
TCustomTeePanel::ChangeScale(M,D);
}
};
void __fastcall TForm1::FormAfterMonitorDpiChanged(TObject *Sender, int OldDPI, int NewDPI)
{
((TCustomTeePanelAccess*)TChart1)->ChangeScale(NewDPI, OldDPI);
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Yeray,
I was successful in implementing your code from 5 May, 14:43 using FormAfterMonitorDpiChanged() so that when I CHANGE FROM 1920x1080 at 100% TO 3840x2160 pixels at 200% the LeftAxis fonts scaled correctly to the right size.
However if I START the program at 3840 pixels at 200% then the LeftAxis fonts are still INCORRECTLY at HALF the size they should be. How can I fix this?
Sincerely,
Bill Anderson
I was successful in implementing your code from 5 May, 14:43 using FormAfterMonitorDpiChanged() so that when I CHANGE FROM 1920x1080 at 100% TO 3840x2160 pixels at 200% the LeftAxis fonts scaled correctly to the right size.
However if I START the program at 3840 pixels at 200% then the LeftAxis fonts are still INCORRECTLY at HALF the size they should be. How can I fix this?
Sincerely,
Bill Anderson
Re: Cannot change font name for numbers on TChart axes
Hello Bill,
What about calling the event manually when the form is created?
What about calling the event manually when the form is created?
Code: Select all
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
FormAfterMonitorDpiChanged(this, 96, Monitor->PixelsPerInch);
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Tue Jun 07, 2016 12:00 am
Re: Cannot change font name for numbers on TChart axes
Hi Yeray,
That suggestion to put
FormAfterMonitorDpiChanged(this, 96, Monitor->PixelsPerInch);
into the Form1 constructor solved the problem!
I just have one more question on controlling the fonts in TChart: I am having difficulty in bringing the bottom axis numbers closer to the axis. I cant seem to bring them closer than 6 pixels (with 2 pixel long outer tic marks). Is there any way to control this?
Sincerely,
Bill Anderson
That suggestion to put
FormAfterMonitorDpiChanged(this, 96, Monitor->PixelsPerInch);
into the Form1 constructor solved the problem!
I just have one more question on controlling the fonts in TChart: I am having difficulty in bringing the bottom axis numbers closer to the axis. I cant seem to bring them closer than 6 pixels (with 2 pixel long outer tic marks). Is there any way to control this?
Sincerely,
Bill Anderson