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

rendering named glyphs (dingbats)

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P4: Low
    • None
    • None
    • GUI: Font handling
    • None

    Description

      Iconic fonts such as FontAwesome can provide icons at arbitrary Unicode codepoints in the "user" section and label them with names. e.g. U+F000 is named "glass" and is an icon for a martini glass. CSS can provide a means of rendering individual named glyphs:

      http://fortawesome.github.io/Font-Awesome/examples/

      Such fonts can be useful for menu items, toolbars, buttons etc., to avoid the need to provide separate PNG assets. So it would be nice to have a means of generating QtQuick Items which realize the named glyph, instead of having to first look up the arbitrary Unicode value which was assigned. E.g. this already works

      Text {
          font.family: "FontAwesome"
          text: "\uF000"
      }
      

      but this would be more intuitive

      Text {
          font.family: "FontAwesome"
          text: "\&glass;"
      }
      

      or

      Glyph {
          font.family: "FontAwesome"
          name: "glass"
      }
      

      I think this will need a new QPA function something like

      virtual QChar QFontEngine::namedCharacter(const QByteArray& name) const

      which can be implemented using FT_Get_Name_Index on freetype, and hopefully equivalent methods on other platforms:

      http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Get_Name_Index

      but I have not verified that it's possible on every platform. However qtbase/src/gui/text/qfontsubset_agl.cpp already contains a hard-coded table for the Adobe-defined glyph names, so we could use that as a fallback to support some standard symbols in non-dingbat fonts.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes