0

我正在尝试在外部嵌入式设备上运行这个简单的示例: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。

4

1 回答 1

1

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

于 2019-12-10T18:22:25.300 回答