问题
The upper font is from a QLabel
with QFont("Arial")
.
The lower font is rendered with QWebEngine
, e.g. Chromium/Blink backend
, using css
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
Is there a way to make the blink one look as dark and sharp as the Qt one? It looks blurry and as both texts in the app are placed next to each other, it does not look good enough.
(Qt5.8 msvc 2015 on windows 8.1)
Edit
The reason is that chromium since version 52 did drop GDI support. In former version GDI rendering could be activated by disabling the DirectWrite flag. So basically I need to recompile Qt with a different chromium backend. Or perhaps with Cent Browser because it still supports that flag despite using newest chromium.
回答1:
First get the font family using QFontInfo::family()
.
This function returns matched family name of windows system font.
QFont f("Arial");
QFontInfo info(f);
QString family = info.family();
In simple terms "QFontInfo object is used to determine the attributes of the font actually used in the window system."
Use the family name returned by QFontInfo
and set the same for QWebEngine
by QWebEngineSettings::setFontFamily
or using CSS.
useful links:
http://doc.qt.io/qt-5/qfontinfo.html#family
http://doc.qt.io/qt-5/qwebenginesettings.html#setFontFamily
来源:https://stackoverflow.com/questions/43161662/rendered-text-looks-very-different-in-qt-and-blink-although-same-font-is-set