wasm: add DejaVu Sans as a fallback font
Add fallback font which supports emoji. Similar logic of addding additional fallback fonts is used for some other platforms. Fixes: QTBUG-87339 Change-Id: Iad9e7071bcc3c5bb1c11c6c745fd86f7d0f7860b Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 81d9b5ada4d6e495a592123cf76ac5fff0718014) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9ee1576b5a
commit
c8b9fcef6c
@ -41,11 +41,13 @@ QStringList QWasmFontDatabase::fallbacksForFamily(const QString &family, QFont::
|
|||||||
QStringList fallbacks
|
QStringList fallbacks
|
||||||
= QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script);
|
= QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script);
|
||||||
|
|
||||||
// Add the vera.ttf font (loaded in populateFontDatabase above) as a falback font
|
// Add the vera.ttf and DejaVuSans.ttf fonts (loaded in populateFontDatabase above) as falback fonts
|
||||||
// to all other fonts (except itself).
|
// to all other fonts (except itself).
|
||||||
const QString veraFontFamily = QStringLiteral("Bitstream Vera Sans");
|
static const QString wasmFallbackFonts[] = { "Bitstream Vera Sans", "DejaVu Sans" };
|
||||||
if (family != veraFontFamily)
|
for (auto wasmFallbackFont : wasmFallbackFonts) {
|
||||||
fallbacks.append(veraFontFamily);
|
if (family != wasmFallbackFont && !fallbacks.contains(wasmFallbackFont))
|
||||||
|
fallbacks.append(wasmFallbackFont);
|
||||||
|
}
|
||||||
|
|
||||||
return fallbacks;
|
return fallbacks;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user