1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Direct2D: Fix text drawing using gradients when the screen scaling is 1

This commit is contained in:
attila 2025-03-13 16:57:49 +01:00 committed by Attila Szarvas
parent 432a7e1c9a
commit 273c7936d3

View file

@ -1680,7 +1680,16 @@ void Direct2DGraphicsContext::drawGlyphs (Span<const uint16_t> glyphNumbers,
if (fontFace == nullptr)
return;
const auto brush = currentState->getBrush (SavedState::BrushTransformFlags::applyFillTypeTransform);
const auto fontScale = font.getHorizontalScale();
const auto scaledTransform = AffineTransform::scale (fontScale, 1.0f).followedBy (transform);
const auto glyphRunTransform = scaledTransform.followedBy (currentState->currentTransform.getTransform());
const auto onlyTranslated = glyphRunTransform.isOnlyTranslation();
const auto fillTransform = onlyTranslated
? SavedState::BrushTransformFlags::applyWorldAndFillTypeTransforms
: SavedState::BrushTransformFlags::applyFillTypeTransform;
const auto brush = currentState->getBrush (fillTransform);
if (! brush)
return;
@ -1689,11 +1698,6 @@ void Direct2DGraphicsContext::drawGlyphs (Span<const uint16_t> glyphNumbers,
D2D1_POINT_2F baselineOrigin { 0.0f, 0.0f };
const auto fontScale = font.getHorizontalScale();
const auto scaledTransform = AffineTransform::scale (fontScale, 1.0f).followedBy (transform);
const auto glyphRunTransform = scaledTransform.followedBy (currentState->currentTransform.getTransform());
const auto onlyTranslated = glyphRunTransform.isOnlyTranslation();
if (onlyTranslated)
baselineOrigin = { glyphRunTransform.getTranslationX(), glyphRunTransform.getTranslationY() };
else