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

<font> HTML tag for QML Text is deprecated and unnecessary

    XMLWordPrintable

Details

    Description

      The <font> tag in HTML is deprecated: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/font
      Since the same functionality can be obtained by setting CSS attributes on the desired element (and all 3 <font> attributes supported have equivalents in CSS) there is no need to have a <font> tag. It adds nothing semantically as an HTML tag (since all text has a font by definition) and discourages consistent styling across apps (unlike CSS classes).

      From the docs (https://doc.qt.io/qt-6/qml-qtquick-text.html#textFormat-prop), the two textFormats:

      Text.StyledText optimized basic rich text as in HTML 3.2
      Text.RichText a subset of HTML 4

      HTML 3.2 is 29 years old, HTML 4 is 28. Might make sense to put both on 4 at least.

      IDEs that allow language injection will complain that <font> is deprecated and it's very unlikely that they support downgrading their HTML LSP to a version that supports it. RichText supports all the CSS attributes required to substitute <font>:
      https://doc.qt.io/qt-6/richtext-html-subset.html
      Not clear if StyledText does as well but if not, it probably should.

      First of all the examples from the documentation should be removed.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes