diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2020-04-15 12:07:06 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2020-04-22 21:28:01 -0700 |
commit | 3970dd9d27c157a2a0fbda158c556910791972e0 (patch) | |
tree | ca2ee0ea4dbf94110fd8d24817c40014d263b764 | |
parent | b905aefa5b9c00fd8395fc8e60e6680440e27888 (diff) | |
download | qtlocation-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.mm | 12 |
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; } |