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

[Reg: 6.4.2 -> 6.5.3] QFont::setPixelSize warning when rendering svg files with painter font size set in pixels

    XMLWordPrintable

Details

    • 863929f44 (dev), 381135d56 (6.7), f62b5daa5 (6.6), 65d96953a (tqtc/lts-6.5), 59b581701 (tqtc/lts-5.15)

    Description

      A bunch of warnings show up in the output when rendering an svg file containing <text> elements using either:

      • QSvgRenderer::render, with a painter argument whose font size has been set using QFont::setPixelSize,
      • QSvgWidget displaying the svg file, where the widget's font size is set in pixels for example by an application wide stylesheet,
      • Other widgets capable of rendering svg such as a QToolButton with an svg icon set.

      The warning is "QFont::setPixelSize: Pixel size <= 0 (-300)" and is shown whenever the widget etc. is repainted. It does not affect the actual visual output.

      Reproducer cmake project attached, just need to set the svg file path to wherever you extract it to.

      Issue appears to be in `QSvgText::precheck` when it calls `font.setPixelSize((100.0 / originalFontSize) * maxFontSize)`. If the painter's font size is set in pixels, `originalFontSize` is -1.

      Attachments

        For Gerrit Dashboard: QTBUG-122752
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            arthurgw Arthur Gordon-Wright
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes