Browse Source

CoreGraphics: Added convertToPointFloat() helper

v6.1.6
ed reuk 4 years ago
parent
commit
a747f7c47f
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
2 changed files with 8 additions and 2 deletions
  1. +6
    -0
      modules/juce_graphics/native/juce_mac_CoreGraphicsHelpers.h
  2. +2
    -2
      modules/juce_graphics/native/juce_mac_Fonts.mm

+ 6
- 0
modules/juce_graphics/native/juce_mac_CoreGraphicsHelpers.h 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
{


+ 2
- 2
modules/juce_graphics/native/juce_mac_Fonts.mm 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));
}


Loading…
Cancel
Save