在嵌入式设备上运行QtWebEngine失败

问题描述 投票:0回答:1

我正在尝试在外部嵌入式设备上运行此简单示例:https://doc.qt.io/qt-5/qtwebengine-webengine-minimal-example.html#

它在我的桌面上运行良好,但是当我在设备上运行它时,得到以下输出:

[0820/143911.204817:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
[0820/143911.325717:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
QFontDatabase: Cannot find font directory /usr/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.
[2861:2880:0820/143911.407749:ERROR:surface_factory_qt.cpp(82)] eglGetProcAddress not found.
[2861:2876:0820/143911.513052:ERROR:nss_util.cc(94)] Failed to create /home/root/.pki/nssdb directory.
[2861:2861:0820/143911.534321:FATAL:platform_font_linux.cc(63)] Check failed: typeface. Could not find any font: sans, sans
#0 0x0000b322ee9a <unknown>
#1 0x0000b323924a <unknown>
#2 0x0000b358221e <unknown>
#3 0x0000b358255e <unknown>
#4 0x0000b3582636 <unknown>
#5 0x0000b357d5b4 <unknown>
#6 0x0000b2fb3f82 <unknown>
#7 0x0000b2fb3fd2 <unknown>
#8 0x0000b2d3443a QtWebEngineCore::WebContentsAdapter::initialize()

Aborted (core dumped)

我确实为我的应用程序设置了默认字体并将其捆绑为资源。

int fontId = QFontDatabase::addApplicationFont(":/fonts/SourceHanSans-Regular.ttc");
if (fontId != -1) {
    QFont m_font("Source Han San");
    m_application->setFont(m_font);
}

我试图四处搜寻,但并未真正找到有关该错误的任何有用信息。其他人以前有这个问题吗?我正在使用Qt 5.9.6。

qt fonts qt5 qtwebengine qt5.9
1个回答
0
投票

Webengine需要有效的fontconfig,并且必须在fontconfig搜索的目录中安装兼容的字体。

© www.soinside.com 2019 - 2024. All rights reserved.