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

Text underscores on QMenuBar don't look good on high-dpi in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.6, 6.0.0
    • GUI: Text handling
    • None
    • Linux/X11

    Description

      This has been bothering me ever since we added high-dpi scaling, but maybe Qt 6 is a good time to tweak the appearance?

      The underscore seems to be 2px instead of 1px high if scaling factor > 1, when I try to disable scaling by setting QT_ENABLE_HIGHDPI_SCALING=0. My xft_dpi is set to 120 (just a matter of preference, because I don't mind having smaller text on a 4K screen in GTK applications for example), and physical DPI is 160, so if I don't set QT_ENABLE_HIGHDPI_SCALING, then QHighDpiScaling::rawScaleFactor() is 1.25, which actually seems sensible in practice. It's just not clear to me why the underscore scaling is not very well in sync with the text scaling.

      Screens: 3, High DPI scaling: inactive
      # 0 "DisplayPort-0" Depth: 24 Primary: yes
        Manufacturer: Samsung Electric Company
        Model: U28E850-
        Serial number: HTPJC00213-
        Geometry: 3840x2160+3840+0 Available: 3840x2160+3840+0
        Virtual geometry: 8880x2160+0+0 Available: 8880x2160+0+0
        3 virtual siblings
        Physical size: 607x345 mm  Refresh: 59.9966 Hz Power state: 0
        Physical DPI: 160.685,159.026 Logical DPI: 120,120 Subpixel_None
        DevicePixelRatio: 1
        Primary orientation: 2 Orientation: 2 Native orientation: 0
      

      The underscores are also solid black pixels with no AA. The result is it looks too "bold" and encroaches on the rendering of the characters themselves. It also looks too high vertically; perhaps it should align with the descenders, or midway between the baseline and the bottom of the descender; but it looks like instead perhaps it always "grows" upwards whenever the logic decides that it should be 2px high instead of 1px. Perhaps AA should result in it being less than fully black, unless the scaling factor is actually 2.

      Whereas with no env vars set, the underscore is 1px high on this setup, and that looks better.

      Qt Creator has the ugly underscores with no env vars set, whether its "enable high-dpi" setting is turned on or off. But my current version of that is built with 5.15.2.

      Attachments

        1. assistant-menu.png
          assistant-menu.png
          8 kB
        2. assistant-menu-no-env.png
          assistant-menu-no-env.png
          7 kB
        3. assistant-menu-zoomed.png
          assistant-menu-zoomed.png
          10 kB
        4. manual-aa-approx.png
          manual-aa-approx.png
          10 kB
        5. qtcreator-menu.png
          qtcreator-menu.png
          11 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes