norgepaul / TChromeTabs

Comprehensive Delphi implementation of Chrome's tab system
Other
218 stars 78 forks source link

Tab fonts are too large when High-DPI awareness is enabled #94

Open haimgel opened 3 years ago

haimgel commented 3 years ago

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%.

IgitBuh commented 2 years ago

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;
xelnaga64 commented 2 years ago

@IgitBuh, thank you for the quick fix. It fixes the large font size, but X and Plus signs are too small.

chrometabs

@haimgel, your no-op solution seems to be working fine. Can someone merge this?

landrix commented 7 months ago

https://github.com/norgepaul/TChromeTabs/blob/c6ee68a865db374e9a8fff7d02729f9985338ab3/Lib/ChromeTabs.pas#L2840

IgitBuh commented 7 months ago

@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.

landrix commented 7 months ago

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.

xelnaga64 commented 6 months ago

I tested the current version today. I confirm tab fonts are still too large when high-DPI awareness is enabled.

xelnaga64 commented 6 months ago

The current ScaledFontSize function is not functioning well. I use this:

function TCustomChromeTabs.ScaledFontSize(fFontSize: Integer): Integer;
begin
  Result:=fFontSize;
end;