summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2019-07-25 21:32:01 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-07-29 15:55:14 +0300
commit51affeb93d9c351ffa8faf9cc314ddcd0fcf8fd4 (patch)
tree83c99be670f016042adee0d7c13b77cf84847730
parentd538715fd45e2562a362b1cc750ed0e733798f44 (diff)
downloadqtlocation-mapboxgl-51affeb93d9c351ffa8faf9cc314ddcd0fcf8fd4.tar.gz
android_wip
-rw-r--r--platform/android/src/map_renderer.cpp6
-rw-r--r--platform/android/src/map_renderer.hpp2
-rw-r--r--platform/android/src/snapshotter/map_snapshotter.cpp11
-rw-r--r--platform/android/src/text/local_glyph_rasterizer.cpp12
4 files changed, 20 insertions, 11 deletions
diff --git a/platform/android/src/map_renderer.cpp b/platform/android/src/map_renderer.cpp
index 92444c404d..6d21a7291c 100644
--- a/platform/android/src/map_renderer.cpp
+++ b/platform/android/src/map_renderer.cpp
@@ -21,8 +21,12 @@ MapRenderer::MapRenderer(jni::JNIEnv& _env,
: javaPeer(_env, obj)
, pixelRatio(pixelRatio_)
, programCacheDir(jni::Make<std::string>(_env, programCacheDir_))
- , localIdeographFontFamily(localIdeographFontFamily_ ? jni::Make<std::string>(_env, localIdeographFontFamily_) : optional<std::string>{})
, mailbox(std::make_shared<Mailbox>(*this)) {
+
+ if (localIdeographFontFamily_) {
+ localIdeographFontFamily = std::vector<std::string>();
+ localIdeographFontFamily->emplace_back(jni::Make<std::string>(_env, localIdeographFontFamily_));
+ }
}
MapRenderer::~MapRenderer() = default;
diff --git a/platform/android/src/map_renderer.hpp b/platform/android/src/map_renderer.hpp
index efbe55af7f..70df759323 100644
--- a/platform/android/src/map_renderer.hpp
+++ b/platform/android/src/map_renderer.hpp
@@ -105,7 +105,7 @@ private:
float pixelRatio;
std::string programCacheDir;
- optional<std::string> localIdeographFontFamily;
+ optional<std::vector<std::string>> localIdeographFontFamily;
std::shared_ptr<ThreadPool> threadPool;
std::shared_ptr<Mailbox> mailbox;
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp
index 2eca6595e1..a341d9c416 100644
--- a/platform/android/src/snapshotter/map_snapshotter.cpp
+++ b/platform/android/src/snapshotter/map_snapshotter.cpp
@@ -55,6 +55,13 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
}
showLogo = _showLogo;
+ optional<std::vector<std::string>> fontFamily;
+
+ if (_localIdeographFontFamily) {
+ fontFamily = std::vector<std::string>();
+ fontFamily->emplace_back(jni::Make<std::string>(_env, _localIdeographFontFamily));
+ }
+
// Create the core snapshotter
snapshotter = std::make_unique<mbgl::MapSnapshotter>(style,
size,
@@ -62,9 +69,7 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
cameraOptions,
bounds,
jni::Make<std::string>(_env, _programCacheDir),
- _localIdeographFontFamily ?
- jni::Make<std::string>(_env, _localIdeographFontFamily) :
- optional<std::string>{},
+ std::move(fontFamily),
mbgl::android::FileSource::getSharedResourceOptions(_env, _jFileSource));
}
diff --git a/platform/android/src/text/local_glyph_rasterizer.cpp b/platform/android/src/text/local_glyph_rasterizer.cpp
index 8892ee3f37..7545ff0885 100644
--- a/platform/android/src/text/local_glyph_rasterizer.cpp
+++ b/platform/android/src/text/local_glyph_rasterizer.cpp
@@ -64,8 +64,8 @@ void LocalGlyphRasterizer::registerNative(jni::JNIEnv& env) {
class LocalGlyphRasterizer::Impl {
public:
- Impl(const optional<std::string> fontFamily_)
- : fontFamily(fontFamily_)
+ Impl(optional<std::vector<std::string>> fontFamily_)
+ : fontFamily(std::move(fontFamily_))
{}
bool isConfigured() const {
@@ -81,16 +81,16 @@ public:
break;
}
}
- return androidLocalGlyphRasterizer.drawGlyphBitmap(*fontFamily, bold, glyphID);
+ return androidLocalGlyphRasterizer.drawGlyphBitmap((*fontFamily)[0], bold, glyphID);
}
private:
- optional<std::string> fontFamily;
+ optional<std::vector<std::string>> fontFamily;
android::LocalGlyphRasterizer androidLocalGlyphRasterizer;
};
-LocalGlyphRasterizer::LocalGlyphRasterizer(const optional<std::string> fontFamily)
- : impl(std::make_unique<Impl>(fontFamily))
+LocalGlyphRasterizer::LocalGlyphRasterizer(optional<std::vector<std::string>> fontFamily)
+ : impl(std::make_unique<Impl>(std::move(fontFamily)))
{}
LocalGlyphRasterizer::~LocalGlyphRasterizer()