Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
Description
We need platform specific font matching to enable locale based
matching rules in certain font databases. For example it should be
possible to set a default font family for given language.
Extends QPA font database to allow platform specific font matching
in QPlatformFontDatabase and provides the implementation in
QFontconfigDatabase.
It works like this: in font loading we will first call
QPlatformFontDatabase::matchedFontEngine(). Platform font databases
don't support it will always return 0, if it fails (or returns 0)
then we fallback to the old routine and do the match() in
QFontDatabase.
In QFontconfigDatabase, we will construct a FcPattern * from the
QFontDef request created by QFont, do the match with fontconfig. One
special case is when 'script' is not QUnicodeTables::Common, we will
make sure the script has a higher priority than the fontDef.family,
so that the behavior is consistent with match() in QFontDatabase (if
the requested family doesn't support given script we will fallback
to the default family for that script).
We also detect the current system locale and see if that's different
from the script from text. We will modify the language for matching
if it makes sense. Define QT_NO_LOCALE_FONT_MATCHING to disable it.
and current unfinished code in https://codereview.qt-project.org/20590