diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/darwin/src/local_glyph_rasterizer.mm | 19 | ||||
-rw-r--r-- | platform/ios/config.cmake | 1 | ||||
-rw-r--r-- | platform/macos/config.cmake | 1 |
3 files changed, 14 insertions, 7 deletions
diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm index f12be78daa..a5edecb097 100644 --- a/platform/darwin/src/local_glyph_rasterizer.mm +++ b/platform/darwin/src/local_glyph_rasterizer.mm @@ -22,16 +22,21 @@ namespace mbgl { */ using CTFontDescriptorRefHandle = CFHandle<CTFontDescriptorRef, CFTypeRef, CFRelease>; -using CTFontRefHandle = CFHandle<CTFontRef, CFTypeRef, CFRelease>; using CTLineRefHandle = CFHandle<CTLineRef, CFTypeRef, CFRelease>; class LocalGlyphRasterizer::Impl { public: - Impl(CTFontRef fontHandle) - : font(fontHandle) + Impl(CTFontRef font_) + : font(font_) {} + + ~Impl() { + if (font) { + CFRelease(font); + } + } - CTFontRefHandle font; + CTFontRef font; }; LocalGlyphRasterizer::LocalGlyphRasterizer(const optional<std::string> fontFamily) @@ -56,7 +61,7 @@ LocalGlyphRasterizer::~LocalGlyphRasterizer() bool LocalGlyphRasterizer::canRasterizeGlyph(const FontStack&, GlyphID glyphID) { // TODO: This is a rough approximation of the set of glyphs that will work with fixed glyph metrics // Either narrow this down to be conservative, or actually extract glyph metrics in rasterizeGlyph - return *(impl->font) && util::i18n::allowsIdeographicBreaking(glyphID); + return impl->font && util::i18n::allowsIdeographicBreaking(glyphID); } // TODO: In theory we should be able to transform user-coordinate bounding box and advance @@ -137,7 +142,7 @@ PremultipliedImage drawGlyphBitmap(GlyphID glyphID, CTFontRef font, Size size) { Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID glyphID) { Glyph fixedMetrics; - if (!*(impl->font)) { + if (!impl->font) { return fixedMetrics; } @@ -151,7 +156,7 @@ Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID glyphID) { fixedMetrics.metrics.top = -1; fixedMetrics.metrics.advance = 24; - PremultipliedImage rgbaBitmap = drawGlyphBitmap(glyphID, *(impl->font), size); + PremultipliedImage rgbaBitmap = drawGlyphBitmap(glyphID, impl->font, size); // Copy alpha values from RGBA bitmap into the AlphaImage output fixedMetrics.bitmap = AlphaImage(size); diff --git a/platform/ios/config.cmake b/platform/ios/config.cmake index b08138c9b9..1caf372b25 100644 --- a/platform/ios/config.cmake +++ b/platform/ios/config.cmake @@ -72,6 +72,7 @@ macro(mbgl_platform_core) target_link_libraries(mbgl-core PUBLIC "-lz" PUBLIC "-framework Foundation" + PUBLIC "-framework CoreText" PUBLIC "-framework CoreGraphics" PUBLIC "-framework OpenGLES" PUBLIC "-framework ImageIO" diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake index 83b618e379..3b7d112455 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -62,6 +62,7 @@ macro(mbgl_platform_core) target_link_libraries(mbgl-core PUBLIC "-lz" PUBLIC "-framework Foundation" + PUBLIC "-framework CoreText" PUBLIC "-framework CoreGraphics" PUBLIC "-framework OpenGL" PUBLIC "-framework ImageIO" |