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

CoreGraphics: Added convertToPointFloat() helper

This commit is contained in:
ed 2021-04-27 09:56:11 +01:00 committed by reuk
parent ec43c7f61c
commit a747f7c47f
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 8 additions and 2 deletions

View file

@ -47,6 +47,12 @@ namespace
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
template <class PointType>
Point<float> convertToPointFloat (PointType p) noexcept
{
return { (float) p.x, (float) p.y };
}
template <typename PointType>
CGPoint convertToCGPoint (PointType p) noexcept
{

View file

@ -491,8 +491,8 @@ namespace CoreTextTypeLayout
const Positions positions (run, (size_t) numGlyphs);
for (CFIndex k = 0; k < numGlyphs; ++k)
glyphRun->glyphs.add (TextLayout::Glyph (glyphs.glyphs[k], Point<float> ((float) positions.points[k].x,
(float) positions.points[k].y),
glyphRun->glyphs.add (TextLayout::Glyph (glyphs.glyphs[k],
convertToPointFloat (positions.points[k]),
(float) advances.advances[k].width));
}