Fix selection of fonts that require OpenType features
HB_Face's supported_scripts[] expects HB_Script, so QChar::Script should be remapped via script_to_hbscript(). Change-Id: Ib068c35ab76567fe9a61da7d8ab01133a6f58bc0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
ccdec0b7a6
commit
c63e7f5766
|
|
@ -236,6 +236,11 @@ HB_Face QFontEngine::initializedHarfbuzzFace() const
|
|||
return face;
|
||||
}
|
||||
|
||||
bool QFontEngine::supportsScript(QChar::Script script) const
|
||||
{
|
||||
return initializedHarfbuzzFace()->supported_scripts[script_to_hbscript(script)];
|
||||
}
|
||||
|
||||
glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
|
||||
{
|
||||
glyph_metrics_t metrics = boundingBox(glyph);
|
||||
|
|
|
|||
|
|
@ -255,6 +255,7 @@ public:
|
|||
HB_Font harfbuzzFont() const;
|
||||
HB_Face harfbuzzFace() const;
|
||||
HB_Face initializedHarfbuzzFace() const;
|
||||
bool supportsScript(QChar::Script script) const;
|
||||
|
||||
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
|
||||
|
|
|
|||
|
|
@ -262,8 +262,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, QChar::Scri
|
|||
delete engine;
|
||||
engine = 0;
|
||||
} else if (scriptRequiresOpenType(script)) {
|
||||
HB_Face hbFace = engine->initializedHarfbuzzFace();
|
||||
if (!hbFace || !hbFace->supported_scripts[script]) {
|
||||
if (!engine->supportsScript(script)) {
|
||||
delete engine;
|
||||
engine = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -638,8 +638,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc
|
|||
delete engine;
|
||||
engine = 0;
|
||||
} else if (scriptRequiresOpenType(script)) {
|
||||
HB_Face hbFace = engine->initializedHarfbuzzFace();
|
||||
if (!hbFace || !hbFace->supported_scripts[script]) {
|
||||
if (!engine->supportsScript(script)) {
|
||||
delete engine;
|
||||
engine = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1883,8 +1883,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ
|
|||
// for scripts that do not require OpenType we should just look at the list of
|
||||
// supported writing systems in the font's OS/2 table.
|
||||
if (scriptRequiresOpenType(script)) {
|
||||
HB_Face hbFace = few->harfbuzzFace();
|
||||
if (!hbFace || !hbFace->supported_scripts[script]) {
|
||||
if (!few->supportsScript(QChar::Script(script))) {
|
||||
qWarning(" OpenType support missing for script\n");
|
||||
delete few;
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue