From 0bba794e98a6fd8d2da1065c255bbce38a45f754 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Tue, 20 Nov 2018 13:46:26 -0800 Subject: [android] Expose "local ideograph font family" in MapSnapshotter::Options Use local glyph generation in test app's MapSnapshotterActivity. --- .../mapboxsdk/snapshotter/MapSnapshotter.java | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java') diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java index a4f1f2e751..93b7dd9260 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java @@ -95,6 +95,7 @@ public class MapSnapshotter { private LatLngBounds region; private CameraPosition cameraPosition; private boolean showLogo = true; + private String localIdeographFontFamily; /** * @param width the width of the image @@ -171,6 +172,22 @@ public class MapSnapshotter { return this; } + /** + * Set the font family for generating glyphs locally for ideographs in the 'CJK Unified Ideographs' + * and 'Hangul Syllables' ranges. + *

+ * The font family argument is passed to {@link android.graphics.Typeface#create(String, int)}. + * Default system fonts are defined in '/system/etc/fonts.xml' + * + * @param fontFamily font family for local ideograph generation. + * @return the mutated {@link Options} + */ + @NonNull + public Options withLocalIdeographFontFamily(String fontFamily) { + this.localIdeographFontFamily = fontFamily; + return this; + } + /** * @return the width of the image */ @@ -214,6 +231,14 @@ public class MapSnapshotter { public CameraPosition getCameraPosition() { return cameraPosition; } + + /** + * @return the font family used for locally generating ideographs + */ + public String getLocalIdeographFontFamily() { + return localIdeographFontFamily; + } + } /** @@ -231,7 +256,7 @@ public class MapSnapshotter { nativeInitialize(this, fileSource, options.pixelRatio, options.width, options.height, options.styleUrl, options.styleJson, options.region, options.cameraPosition, - options.showLogo, programCacheDir); + options.showLogo, programCacheDir, options.localIdeographFontFamily); } /** @@ -513,7 +538,8 @@ public class MapSnapshotter { FileSource fileSource, float pixelRatio, int width, int height, String styleUrl, String styleJson, LatLngBounds region, CameraPosition position, - boolean showLogo, String programCacheDir); + boolean showLogo, String programCacheDir, + String localIdeographFontFamily); @Keep protected native void nativeStart(); -- cgit v1.2.1