From 3970dd9d27c157a2a0fbda158c556910791972e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 15 Apr 2020 12:07:06 -0700 Subject: [ios, macos] Enable local glyph rasterization for all scripts --- platform/darwin/src/local_glyph_rasterizer.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm index 974f75b7b4..1dc2bcdcb5 100644 --- a/platform/darwin/src/local_glyph_rasterizer.mm +++ b/platform/darwin/src/local_glyph_rasterizer.mm @@ -12,7 +12,7 @@ #import "CFHandle.hpp" /// Enables local glyph rasterization for all writing systems, not just CJK. -#define MBGL_DARWIN_NO_REMOTE_FONTS 0 +#define MBGL_DARWIN_NO_REMOTE_FONTS 1 namespace mbgl { @@ -265,7 +265,15 @@ PremultipliedImage drawGlyphBitmap(GlyphID glyphID, CTFontRef font, GlyphMetrics CTRunGetTypographicBounds(glyphRun, wholeRunRange, NULL, &descent, NULL); CGContextSetTextPosition(*context, 0.0, descent); - CTLineDraw(*line, *context); +// CTLineDraw(*line, *context); + + CTFontRef glyphFont = (CTFontRef)CFDictionaryGetValue(CTRunGetAttributes(glyphRun), kCTFontAttributeName); + + CGGlyph glyphs[wholeRunRange.length]; + CTRunGetGlyphs(glyphRun, wholeRunRange, glyphs); + CGPoint positions[wholeRunRange.length]; + CTRunGetPositions(glyphRun, wholeRunRange, positions); + CTFontDrawGlyphs(glyphFont, glyphs, positions, wholeRunRange.length, *context); return rgbaBitmap; } -- cgit v1.2.1