Don't force antialiasing when it is turned off

In the gray antialiasing code path for text on Windows, we
check whether Cleartype is enabled in the system and,
if it is, we forcibly enable gray antialiasing instead. But in
this logic we did not consider the case where antialiasing
is turned off entirely, i.e. when the style strategy is
QFont::NoAntialias. We should never override
no-antialias with antialias.

[ChangeLog][Windows][Text] Made it possible to disable
antialiasing for text when drawing into images.

Task-number: QTBUG-47141
Change-Id: Ieb2beba8c2d02295abe6d9a98d2e63a2d39c9e6a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2016-02-05 15:24:46 +01:00
parent a4fac65938
commit 51f29b88da

View File

@ -1149,7 +1149,9 @@ glyph_metrics_t QWindowsFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed, c
QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
{
HFONT font = hfont;
if (m_fontEngineData->clearTypeEnabled) {
bool clearTypeTemporarilyDisabled = (m_fontEngineData->clearTypeEnabled && m_logfont.lfQuality != NONANTIALIASED_QUALITY);
if (clearTypeTemporarilyDisabled) {
LOGFONT lf = m_logfont;
lf.lfQuality = ANTIALIASED_QUALITY;
font = CreateFontIndirect(&lf);
@ -1188,7 +1190,7 @@ QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xfo
// Cleanup...
delete mask;
if (m_fontEngineData->clearTypeEnabled) {
if (clearTypeTemporarilyDisabled) {
DeleteObject(font);
}