Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123098

Adapting text to scale factors

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.0
    • GUI: Text handling
    • None
    • All

    Description

      Currently, Qt will disable hinting whenever there is a screen with a device pixel ratio != 1.

      The reason for this is that hinted text layouts are not scalable. Scaling the text by factor X does not make the layout X times wider and X times taller, but an arbitrary factor Y. This also means that line breaks may happen at different places in the text, so the entire layout has to be redone from scratch, as if the text itself had changed.

      With an unhinted font, this is simpler since everything is linearly scalable, so we default to unhinted text as soon as we suspect we might at some point appear on a dpr-scaled screen. In addition, hinting becomes less and less relevant the higher the density of the screen, so for scaled systems the unhinted text will often look better.

      However, it does have the downside that applications shown on a low density screen gets unhinted font rendering just because there is also a high density screen attached.

      An alternative to this would be to base the decision on the scale factor of the current window instead. This means we have to update text layouts and size hints as soon as the dpr of the window changes.

      In anything using text, cached font engines have to be flushed and recreated, text layouts have to be redone and sizes have to be updated so that layouts are also adjusted. Basically, we need to treat the dpr changed event same as if the font itself has changed.

      Implication is that dragging a window from a low density screen to a high density screen (or vice versa) can cause the whole UI to shuffle around as the layouts are updating.

      It also means that all users who implemented their own widgets with text need to do this. So it's possible we should have an application attribute to revert to old behavior (or potentially just an environment variable)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes