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

CoreGraphicsContext: Use CopyableHeapBlock for glyph positions

This commit is contained in:
reuk 2024-09-10 19:20:21 +01:00
parent 67fa9b11cd
commit 44e2d0343b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -838,21 +838,20 @@ void CoreGraphicsContext::drawGlyphs (Span<const uint16_t> glyphs,
flip();
applyTransform (AffineTransform::scale (1.0f, -1.0f).followedBy (transform));
std::vector<CGPoint> pos (glyphs.size());
CopyableHeapBlock<CGPoint> pos (glyphs.size());
std::transform (positions.begin(), positions.end(), pos.begin(), [scale] (const auto& p) { return CGPointMake (p.x / scale, -p.y); });
CTFontDrawGlyphs (state->fontRef.get(), glyphs.data(), pos.data(), glyphs.size(), context.get());
return;
}
else
for (const auto [index, glyph] : enumerate (glyphs, size_t{}))
{
for (const auto [index, glyph] : enumerate (glyphs, size_t{}))
{
Path p;
auto& f = state->font;
f.getTypefacePtr()->getOutlineForGlyph (f.getMetricsKind(), glyph, p);
const auto scale = f.getHeight();
fillPath (p, AffineTransform::scale (scale * f.getHorizontalScale(), scale).translated (positions[index]).followedBy (transform));
}
Path p;
auto& f = state->font;
f.getTypefacePtr()->getOutlineForGlyph (f.getMetricsKind(), glyph, p);
const auto scale = f.getHeight();
fillPath (p, AffineTransform::scale (scale * f.getHorizontalScale(), scale).translated (positions[index]).followedBy (transform));
}
}