summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2020-04-15 12:07:06 -0700
committerMinh Nguyễn <mxn@1ec5.org>2020-04-22 21:28:01 -0700
commit3970dd9d27c157a2a0fbda158c556910791972e0 (patch)
treeca2ee0ea4dbf94110fd8d24817c40014d263b764
parentb905aefa5b9c00fd8395fc8e60e6680440e27888 (diff)
downloadqtlocation-mapboxgl-upstream/1ec5-coretext-no-remote-7862.tar.gz
[ios, macos] Enable local glyph rasterization for all scriptsupstream/1ec5-coretext-no-remote-7862
-rw-r--r--platform/darwin/src/local_glyph_rasterizer.mm12
1 files 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;
}