diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2020-03-19 16:21:29 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2020-04-24 13:46:40 -0700 |
commit | 76ddb15dbcee8d75a02c1202ded8ea8a282f9f8c (patch) | |
tree | a05ae7230d333085a7c40ba745360d04f02fdbd9 | |
parent | 9b78a156de79beb89dd86b484c326c68682dc79f (diff) |
[core] Factored out default fonts
-rw-r--r-- | include/mbgl/util/constants.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_impl.cpp | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index 56f42ac89..bb026817c 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -66,6 +66,9 @@ constexpr uint32_t DEFAULT_MAXIMUM_CONCURRENT_REQUESTS = 20; constexpr uint8_t TERRAIN_RGB_MAXZOOM = 15; +constexpr const char* LAST_RESORT_ALPHABETIC_FONT = "Open Sans Regular"; +constexpr const char* LAST_RESORT_PAN_UNICODE_FONT = "Arial Unicode MS Regular"; + } // namespace util namespace debug { diff --git a/src/mbgl/style/layers/symbol_layer_impl.cpp b/src/mbgl/style/layers/symbol_layer_impl.cpp index e35e7b0b9..60ebe57f9 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.cpp +++ b/src/mbgl/style/layers/symbol_layer_impl.cpp @@ -27,13 +27,11 @@ void SymbolLayer::Impl::populateFontStack(std::set<FontStack>& fontStack) const } layout.get<TextFont>().match( - [&fontStack] (Undefined) { - fontStack.insert({"Open Sans Regular", "Arial Unicode MS Regular"}); + [&fontStack](Undefined) { + fontStack.insert({util::LAST_RESORT_ALPHABETIC_FONT, util::LAST_RESORT_PAN_UNICODE_FONT}); }, - [&fontStack] (const FontStack& constant) { - fontStack.insert(constant); - }, - [&] (const auto& function) { + [&fontStack](const FontStack& constant) { fontStack.insert(constant); }, + [&](const auto& function) { for (const auto& value : function.possibleOutputs()) { if (value) { fontStack.insert(*value); @@ -42,8 +40,7 @@ void SymbolLayer::Impl::populateFontStack(std::set<FontStack>& fontStack) const break; } } - } - ); + }); } } // namespace style |