[haiku-development] Re: HiDPI strategies, current and future

  • From: "X512" <dmarc-noreply@xxxxxxxxxxxxx> ("danger_mail")
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 31 Aug 2021 07:25:59 +0900

On 2021/08/31 6:06, Mr. waddlesplash wrote:

Probably we will have to introduce a
BScreen::DefaultFont(...) method, or something like it, and also a
BWindow::Screen() method or something like it to handle this
indirection.
So you can set different font typefaces per screen? That makes no sense. BScreen should provide only scaling ratio and be fully BFont independent. Otherwise this would mix GUI system design layering.

On 2021/08/31 6:06, Mr. waddlesplash wrote:
It also creates massive API usage headaches
if you ever want to operate in device pixels instead of device
independent pixels, with coordinate and API call mixup footguns being
very common.
Just make it always operate in device pixels like Haiku currently does. Use BControlLook and BLayout to calculate that device pixels values to avoid hardcoding can manual scaling calculation. be_default_font should be probably also replaced with `BFont BControlLook::DefaultFont()` that will return font with suze premultiplied to scaling ratio.

In order to make this work, BControlLook should get information about scaling ratio that can be retrieved by BView -> BWindow -> BScreen path. One option would be adding BView argument to all BControlLook methods to retrieve scaling ratio. Another option would be creating separate instance of BControlLook for each scaling ratio and introduce some BControlLookRoster to request BControlLook for specific BView/BWindow/BScreen. It is also possible to get scaling ratio by TLS variable because each BWindow have separate thread, but I think that it is not a good idea.

On 2021/08/31 6:06, Mr. waddlesplash wrote:
Clearly, coupling the "scale factor" tightly to the font size, and
having most things compute UI metrics based on the font size was a
good idea.
No. It introduce serious limitation to not allow separately define UI scaling and font size. Some users may prefer setting larger/smaller font, but do not change UI scaling (icons/bitmaps size, padding/margins etc.). For example BeOS use smaller font size than Haiku, but the same other sizes. I see absolutely no sense in introducing this limitation.

Other related posts: