Don't support subpixel positioning for color fonts

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

Pick-to: 6.8
Change-Id: I57148bff48a48bb81a03203626df25646c9acb6a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2024-11-26 10:47:30 +01:00
parent cfb9d1aa1f
commit fd9c9788f7
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; bool canRender(const QChar *string, int len) const override;
int synthesized() const override { return synthesisFlags; } int synthesized() const override { return synthesisFlags; }
bool supportsHorizontalSubPixelPositions() const override { return true; } bool supportsHorizontalSubPixelPositions() const override { return !isColorFont(); }
bool supportsVerticalSubPixelPositions() const override { return false; } bool supportsVerticalSubPixelPositions() const override { return false; }
QFixed lineThickness() const override; QFixed lineThickness() const override;

View File

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

View File

@ -749,7 +749,8 @@ QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const
{ {
DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef); 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_GDI_NATURAL
&& renderMode != DWRITE_RENDERING_MODE_ALIASED); && renderMode != DWRITE_RENDERING_MODE_ALIASED);
} }