Revert "Don't support subpixel positioning for color fonts"

This reverts commit fd9c9788f73cb088229701dd92443aa04005a4a3.

This change failed to consider the fact that color fonts may
also contain non-emoji characters and can be used for regular
text. In this case, it very much makes sense to support
subpixel positioning.

If needed, a more specific optimization can be made for emoji
characters later, but for now we just revert to fix the
regression.

Task-number: QTBUG-134626
Pick-to: 6.8
Change-Id: I07fece03d02b62811c2def26c19c5225a08a0037
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit e72b2f19300f5a5e2b4c58926024ba332d65e75c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2025-03-12 16:01:02 +01:00 committed by Qt Cherry-pick Bot
parent 27f59f908d
commit 1b119638ac
3 changed files with 4 additions and 7 deletions

View File

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

View File

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

View File

@ -779,9 +779,7 @@ QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const
{
QFont::HintingPreference hinting = determineHinting(fontDef);
return (!isColorFont()
&& hinting != QFont::PreferFullHinting
&& !(fontDef.styleStrategy & QFont::NoAntialias));
return (hinting != QFont::PreferFullHinting && !(fontDef.styleStrategy & QFont::NoAntialias));
}
QFontEngine::Properties QWindowsFontEngineDirectWrite::properties() const