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

SVG font-family does not accept comma-delimited list of fonts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15.15
    • SVG Support
    • None

    Description

      Overview

      When an SVG has a font-family attribute set to a comma-delimited list of font families, the default font is used instead.

      Analysis

      Qt added a vector to hold the list of font families (in 5.13?) but the code for parsing the list was omitted. This breaks things when font-family is a comma delimited list was, since it takes the font-family attribute literally as the font name (complete with commas) which of course will never exist.

      Attached is a sample SVG file, along with expected and actual rendered versions.

      A solution

      Also attached is a fix, as a diff/patch. Comments on the fix:
      The original code to process the list is in qfontdatabse familyList. We've borrowed that code (and left the original code in place since it may still be needed) so the parsing should work the same as before. In particular, the parsing trims leading and trailing whitespace, and if an element is quoted (single or double quotes), the quotes are removed.

      Related

      See also
      https://bugreports.qt.io/browse/QTBUG-81926
      https://codereview.qt-project.org/c/qt/qtsvg/+/291101

       

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            jdjd JD Dean
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes