TChromeTabs
TChromeTabs copied to clipboard
Tab fonts are too large when High-DPI awareness is enabled
On Delphi 10.4, when High-DPI awareness is enabled in the manifest, the tab fonts are drawn too large. This seems to be related to [this commit|adf5f73a48a4f7c13e03d276150c0096405578d0] -- I make ScaledFontSize
a no-op (returning same size) and font rendering became normal again.
Tested on a monitor with font scaling set to 200%.
I can confirm that with Delphi 11. Running the application on a 200% high-dpi scale monitor results in huge tabs.
Notice, that this does not only affect text but also icons, so fixing ScaledFontSize
isn't enough.
As a quick fix, manual scaling can be dropped completely. Delphi seems to do this already, so we don't need to do this twice.
function TCustomChromeTabs.ScaledPixels(pPixels: Integer): Integer;
begin
// Font amd icons are scaled twice and become too large
// Result := MulDiv(pPixels, {$ifdef CURRENT_PPI_SUPPORT}Self.FCurrentPPI{$else}Screen.PixelsPerInch{$ENDIF}, 96);
Result := pPixels;
end;
@IgitBuh, thank you for the quick fix. It fixes the large font size, but X and Plus signs are too small.

@haimgel, your no-op solution seems to be working fine. Can someone merge this?
https://github.com/norgepaul/TChromeTabs/blob/c6ee68a865db374e9a8fff7d02729f9985338ab3/Lib/ChromeTabs.pas#L2840
@landrix I might be missing something, but did you actually change something regarding this issue? Your link shows the unchanged line of code that is still causing the described issue.
Sry, but the quickfix isn't the solution. It brings side effects when drawing the component. You can also see this in the screenshots above. I think TChromeTab cannot be made HighDPI capable in a simple way. The component needs a complete redesign. The point about different DPI for multiple monitors would also be important. There are still several active issues related to this topic. The use of timers for drawing also needs to be reconsidered.
Contributions are welcome.
I tested the current version today. I confirm tab fonts are still too large when high-DPI awareness is enabled.
The current ScaledFontSize function is not functioning well. I use this:
function TCustomChromeTabs.ScaledFontSize(fFontSize: Integer): Integer;
begin
Result:=fFontSize;
end;