Don't support subpixel positioning for color fonts

This comes at a price and it does not really make sense for
emojis.

Change-Id: I57148bff48a48bb81a03203626df25646c9acb6a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit fd9c9788f73cb088229701dd92443aa04005a4a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2024-11-26 10:47:30 +01:00 committed by Qt Cherry-pick Bot
parent ca1b4baf09
commit 2e3439dc94
3 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,7 @@ public:
bool canRender(const QChar *string, int len) const override;
int synthesized() const override { return synthesisFlags; }
bool supportsHorizontalSubPixelPositions() const override { return true; }
bool supportsHorizontalSubPixelPositions() const override { return !isColorFont(); }
bool supportsVerticalSubPixelPositions() const override { return false; }
QFixed lineThickness() const override;

View File

@ -152,8 +152,9 @@ private:
QFixed emSquareSize() const override;
bool supportsHorizontalSubPixelPositions() const override
{
return default_hint_style == HintLight ||
default_hint_style == HintNone;
return !isColorFont()
&& (default_hint_style == HintLight ||
default_hint_style == HintNone);
}
bool supportsVerticalSubPixelPositions() const override

View File

@ -688,7 +688,8 @@ QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const
{
DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
return (renderMode != DWRITE_RENDERING_MODE_GDI_CLASSIC
return (!isColorFont()
&& renderMode != DWRITE_RENDERING_MODE_GDI_CLASSIC
&& renderMode != DWRITE_RENDERING_MODE_GDI_NATURAL
&& renderMode != DWRITE_RENDERING_MODE_ALIASED);
}