Details
-
Task
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
-
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
- is duplicated by
-
QTBUG-101778 Support Font Icons in QtQuick Controls
- Reported
- relates to
-
QTBUG-102346 QIcon theme revamp
- In Progress
-
QTBUG-110428 Qt icon library
- In Progress
-
QTBUG-101778 Support Font Icons in QtQuick Controls
- Reported