2023.38
I am having a problem with some of my charts and font sizes related to Windows Display Scale options: when I go to 200%, sometimes the fonts appear at about 400%. I assign the font sizes to my charts because I need to manage them for creating reports (when I don't want the fonts to be large). I have a few charts that work fine--but I can't find the difference (and I have had a few other programmers look over my shoulder).
It seems that some of the charts are managing the Windows' scaling for me and other charts are letting me manage it.
Here is what I am seeing when I go from 100% to 200%--the chart font size goes 4x. (And gain, I explicitly set the font size in the chart so that I can get an image from it when I am wanting to print without the larger fonts).
http://www.tbinc.com/misc/ChartFontSize.jpg
How do I get this to work right?
(And I accidently spelt my last name incorrectly when I logged in and it won't let me fix it).
Ed Dressel
Font Sizes in Charts
Re: Font Sizes in Charts
Hello Ed,
Can you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Can you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
I've edited it, but you should be able to modify it here.Ed Dressel wrote: ↑Thu Aug 24, 2023 10:17 pm(And I accidently spelt my last name incorrectly when I logged in and it won't let me fix it).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 10
- Joined: Wed Aug 16, 2023 12:00 am
Re: Font Sizes in Charts
(Thanks for fixing my name--I tried several times on the page, but it did not save the changes).
I've attached a demo that reproduces part of what I'm seeing. You have to run this very specifically to see the problem:
Problem #1: Fonts are the wrong size:
1) Start the app on a monitor with normal DPI. The "Chart #1" tab page should be showing.
2) Without changing pages, drag the application to a monitor with 200% DPI.
3) Switch to the "Chart #2" tab page. You should see that the fonts are at 100%, not 200%
4) Drag the app back to the normal font monitor. You should see the fonts on Chart #2 are way too small.
Here are images of what I am seeing that correspond to each step (the image option still not seem to be working):
www.tbinc.com/misc/ChartFontSize2.jpg
Problem #2: Unable to create an image with normal font sizes
I create a copy of the image without scaled fonts for my reports, but it does not always work:
1) Run the app and put it on a monitor with 200% font size. You should see this on the active tab page with large fonts.
2) Click the "Create Image". The code should create an image with unscaled fonts, but the fonts in the BMP are scaled.
Thank you,
Ed Dressel
I've attached a demo that reproduces part of what I'm seeing. You have to run this very specifically to see the problem:
Problem #1: Fonts are the wrong size:
1) Start the app on a monitor with normal DPI. The "Chart #1" tab page should be showing.
2) Without changing pages, drag the application to a monitor with 200% DPI.
3) Switch to the "Chart #2" tab page. You should see that the fonts are at 100%, not 200%
4) Drag the app back to the normal font monitor. You should see the fonts on Chart #2 are way too small.
Here are images of what I am seeing that correspond to each step (the image option still not seem to be working):
www.tbinc.com/misc/ChartFontSize2.jpg
Problem #2: Unable to create an image with normal font sizes
I create a copy of the image without scaled fonts for my reports, but it does not always work:
1) Run the app and put it on a monitor with 200% font size. You should see this on the active tab page with large fonts.
2) Click the "Create Image". The code should create an image with unscaled fonts, but the fonts in the BMP are scaled.
Thank you,
Ed Dressel
- Attachments
-
- DPI Issue.zip
- (13.19 KiB) Downloaded 1537 times
-
- Newbie
- Posts: 10
- Joined: Wed Aug 16, 2023 12:00 am
Re: Font Sizes in Charts
I inadvertently left some CodeSite code in there. It is removed in the updated attachment.
- Attachments
-
- DPI Issue.zip
- (13.16 KiB) Downloaded 1528 times
-
- Newbie
- Posts: 10
- Joined: Wed Aug 16, 2023 12:00 am
Re: Font Sizes in Charts
I found another problem in the demo that I am seeing in my application:
1) Start the app and put it on a monitor with the display set to 200%.
2) Click on the "create image" button
3) Go back to the tab that the image was created on--the fonts are now 400%, not 200%.
I look forward to your comments. Much appreciated.
Ed Dressel
1) Start the app and put it on a monitor with the display set to 200%.
2) Click on the "create image" button
3) Go back to the tab that the image was created on--the fonts are now 400%, not 200%.
I look forward to your comments. Much appreciated.
Ed Dressel
-
- Newbie
- Posts: 10
- Joined: Wed Aug 16, 2023 12:00 am
Re: Font Sizes in Charts
No comment on this? Is there any support here?
Re: Font Sizes in Charts
Hello,
Sorry for the delayed reply here.
This seems to fix both issues for me here.
Sorry for the delayed reply here.
I see removing theEd Dressel wrote: ↑Fri Aug 25, 2023 4:08 pmProblem #1: Fonts are the wrong size:
1) Start the app on a monitor with normal DPI. The "Chart #1" tab page should be showing.
2) Without changing pages, drag the application to a monitor with 200% DPI.
3) Switch to the "Chart #2" tab page. You should see that the fonts are at 100%, not 200%
4) Drag the app back to the normal font monitor. You should see the fonts on Chart #2 are way too small.
Showing
condition at TCustomTeePanel.ChangeScale
at {VCLTee.}TeeProcs.pas unit fixes it, but I have to check for any collateral damages:
Code: Select all
procedure TCustomTeePanel.ChangeScale(M, D: Integer{$IFDEF D24}; isDpiChange: Boolean{$ENDIF});
//...
if not (csLoading in ComponentState) and (M <> D) {and Showing <-- remove this} then
SetAutoFontZoom(MulDiv(FView3DOptions.FontZoom, M, D));
end;
Ed Dressel wrote: ↑Fri Aug 25, 2023 4:08 pmProblem #2: Unable to create an image with normal font sizes
I create a copy of the image without scaled fonts for my reports, but it does not always work:
1) Run the app and put it on a monitor with 200% font size. You should see this on the active tab page with large fonts.
2) Click the "Create Image". The code should create an image with unscaled fonts, but the fonts in the BMP are scaled.
I see you are playing with the font sizes atEd Dressel wrote: ↑Fri Aug 25, 2023 6:01 pmI found another problem in the demo that I am seeing in my application:
1) Start the app and put it on a monitor with the display set to 200%.
2) Click on the "create image" button
3) Go back to the tab that the image was created on--the fonts are now 400%, not 200%.
ConfigChartFontSize
. You should set the aChart.View3DOptions.FontZoom
property accordingly so the internal drawing can use it.
Code: Select all
class procedure TChartConfig.ConfigChartFontSize(aChart: TChart; aScaleFonts: boolean);
//...
begin
if aScaleFonts then begin
aChart.View3DOptions.FontZoom := aChart.PixelsPerInch * 100 div 96; // <-- add this
lScale := (aChart.PixelsPerInch / 96) / (aChart.View3DOptions.FontZoom * 0.01);
lFont12 := Round(lScale * 12);
lFont10 := Round(lScale * 10);
lFont9 := Round(lScale * 9);
lFont8 := Round(lScale * 8);
end else begin
aChart.View3DOptions.FontZoom := 100; // <-- add this
lFont12 := 12;
lFont10 := 10;
lFont9 := 9;
lFont8 := 8;
end;
//...
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Font Sizes in Charts
I've pushed this change to the code base for #2633.Yeray wrote: ↑Mon Sep 04, 2023 1:44 pmI see removing theShowing
condition atTCustomTeePanel.ChangeScale
at {VCLTee.}TeeProcs.pas unit fixes it, but I have to check for any collateral damages:Code: Select all
procedure TCustomTeePanel.ChangeScale(M, D: Integer{$IFDEF D24}; isDpiChange: Boolean{$ENDIF}); //... if not (csLoading in ComponentState) and (M <> D) {and Showing <-- remove this} then SetAutoFontZoom(MulDiv(FView3DOptions.FontZoom, M, D)); end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |