View Issue Details

IDProjectCategoryView StatusLast Update
0032359LazarusLCLpublic2017-09-19 22:23
ReporterMichl Assigned ToMichl  
Status confirmedResolutionfixed 
Product Version1.9 (SVN) 
Fixed in Version1.9 (SVN) 
Summary0032359: Themed drawing doesn't work for High-DPI scaled forms.
DescriptionI fixed themed text drawing in revision 55758 for Windows. Now the correct system font is also used, when themed enabled (e.g. Windows 7 Aero theme). It works fine, also when a High-DPI font is used. But it doesn't work, if the form is High-DPI scaled.
Steps To ReproduceTo see that issue enable Windows-Color -> DialogField -> Font -> Bold (see added picture options.png).

Now start the added test project. One time with "Use LCL scaling (HI-DPI)" in project options enabled and one time disabled.

On a 96DPI Windows 7 "Use LCL scaling (HI-DPI)" enabled/disabled the text is correct drawn.
On a 120DPI Windows 7 "Use LCL scaling (HI-DPI)" disabled the text is correct drawn.
On a 120DPI Windows 7 "Use LCL scaling (HI-DPI)" enabled the text is wrong drawn, it uses a normal, instead of the bold system font.
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0032319 closedMichl CLASSIC THEME with bold "DialogFieldFont" : wrong appearance, part of the text is hidden... 
related to 0031276 closedMichl Set Font.Size in FormCreate cause scaled twice 



2017-08-30 10:40


options.png (140,354 bytes)   
options.png (140,354 bytes)   


2017-08-30 11:44

developer   ~0102513

Last edited: 2017-08-30 22:03

View 3 revisions

Just tested Windows 10. There you can switch: Desktop right mouse click -> Display Settings -> Display -> Advanced display settings -> Advanced sizing of text and other items -> select Messages boxes -> check "Bold" and apply settings.

On 96DPI Windows 10, the test app (also the Lazarus IDE itself) shows the correct bold font.
On 120DPI Windows 10, the test app (also the Lazarus IDE itself) shows a wrong normal font, if "Use LCL scaling (HI-DPI)" is enabled.

So it's the same as on Windows 7.

Edit: The bug only occur, if the form DesignTimePPi <> current Screen.PixelsPerInch.


2017-08-30 23:38

developer   ~0102523

The reported issue is fixed in revision 55761. Tested GTK2 and Qt4 without sideffects. Hope it doesn't break any font High-DPI scaling on any OS.

I see some more themed drawing issues. I'll close this bugreport, when they are fixed too.


2017-08-31 21:28

developer   ~0102545

Last edited: 2017-08-31 22:01

View 2 revisions

Some notes for me:

The buttons and other controls in dialogs doesn't have the correct themed font. Other programs, I tested here, have the same problem. The implementation of TaskDialogIndirect doesn't allow any font settings. So it isn't a Lazarus but a Windows issue. IMHO, there isn't anything more to do.


2017-09-19 21:49

developer (1,722 bytes)


2017-09-19 21:56

developer   ~0102925

Last edited: 2017-09-19 22:23

View 3 revisions

Reverted revision 55761 in revision 55884 as it breaks per monitor High-DPI scaling.

To fix the issue, we have to get the font style before scaling (a new reference counted font with a new height is created).
I get it working in most cases, but e.g. the font of a TLabel use not the default font, returned by GetFontData(OnGetSystemFont()). The font itself doesn't know it, this difference is made in the widgetset controls. To see the problem test the added project on a Windows 10 (with Messages boxes bold font - see OptionsWin10.png) with two monitors.


2017-09-19 22:02


OptionsWin10.png (35,360 bytes)   
OptionsWin10.png (35,360 bytes)   

Issue History

Date Modified Username Field Change
2017-08-30 10:39 Michl New Issue
2017-08-30 10:39 Michl File Added:
2017-08-30 10:40 Michl File Added: options.png
2017-08-30 10:40 Michl Assigned To => Michl
2017-08-30 10:40 Michl Status new => assigned
2017-08-30 10:41 Michl Relationship added related to 0032319
2017-08-30 11:44 Michl Note Added: 0102513
2017-08-30 11:45 Michl Note Edited: 0102513 View Revisions
2017-08-30 22:03 Michl Note Edited: 0102513 View Revisions
2017-08-30 23:32 Michl Fixed in Revision => r55761
2017-08-30 23:38 Michl Note Added: 0102523
2017-08-31 21:28 Michl Note Added: 0102545
2017-08-31 22:01 Michl Note Edited: 0102545 View Revisions
2017-08-31 22:02 Michl Status assigned => resolved
2017-08-31 22:02 Michl Fixed in Version => 1.9 (SVN)
2017-08-31 22:02 Michl Resolution open => fixed
2017-09-11 11:53 Michl Relationship added related to 0031276
2017-09-19 21:49 Michl File Deleted:
2017-09-19 21:49 Michl File Added:
2017-09-19 21:56 Michl Note Added: 0102925
2017-09-19 21:56 Michl Status resolved => confirmed
2017-09-19 21:56 Michl Target Version 1.8 =>
2017-09-19 22:02 Michl File Added: OptionsWin10.png
2017-09-19 22:03 Michl Fixed in Revision r55761 =>
2017-09-19 22:09 Michl Note Edited: 0102925 View Revisions
2017-09-19 22:23 Michl Note Edited: 0102925 View Revisions