From 01bfa988277dd3968ce352c5ba54492879ea0945 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 18 Nov 2024 12:18:24 +0000 Subject: [PATCH] CoreGraphics: Fix incorrect behaviour of non-solid-colour text fills Previously, filling a string containing a space or other non-rendered character with a gradient would end up filling the entire clip region. The correct behaviour is to completely skip filling any empty paths. --- modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm index 1caaf7e7b2..aa18f90ac1 100644 --- a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm +++ b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm @@ -867,6 +867,10 @@ void CoreGraphicsContext::drawGlyphs (Span glyphs, Path p; auto& f = state->font; f.getTypefacePtr()->getOutlineForGlyph (f.getMetricsKind(), glyph, p); + + if (p.isEmpty()) + continue; + const auto scale = f.getHeight(); fillPath (p, AffineTransform::scale (scale * f.getHorizontalScale(), scale).translated (positions[index]).followedBy (transform)); }