diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-17 15:33:50 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-08-17 09:38:39 -0700 |
commit | 8ca419fb2ebbba427f2f27ba3d794fb3d6cc5797 (patch) | |
tree | d20c4176c368080144299b6e9e7e59c3116b48b5 /src/mbgl/style/parser.cpp | |
parent | 790b9f5c827101a47fd06fbfa944d36e3f0b285c (diff) | |
download | qtlocation-mapboxgl-8ca419fb2ebbba427f2f27ba3d794fb3d6cc5797.tar.gz |
[core] Evict unused font stacks from GlyphManager
Diffstat (limited to 'src/mbgl/style/parser.cpp')
-rw-r--r-- | src/mbgl/style/parser.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index 8d14d7972c..0a90919f0b 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -1,6 +1,5 @@ #include <mbgl/style/parser.hpp> #include <mbgl/style/layer_impl.hpp> -#include <mbgl/style/layers/symbol_layer.hpp> #include <mbgl/style/rapidjson_conversion.hpp> #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/coordinate.hpp> @@ -274,31 +273,12 @@ void Parser::parseLayer(const std::string& id, const JSValue& value, std::unique } std::vector<FontStack> Parser::fontStacks() const { - std::set<FontStack> result; - + std::vector<Immutable<Layer::Impl>> impls; + impls.reserve(layers.size()); for (const auto& layer : layers) { - if (layer->is<SymbolLayer>() && !layer->as<SymbolLayer>()->getTextField().isUndefined()) { - layer->as<SymbolLayer>()->getTextFont().match( - [&] (Undefined) { - result.insert({"Open Sans Regular", "Arial Unicode MS Regular"}); - }, - [&] (const FontStack& constant) { - result.insert(constant); - }, - [&] (const auto& function) { - for (const auto& value : function.possibleOutputs()) { - if (value) { - result.insert(*value); - } else { - Log::Warning(Event::ParseStyle, "Layer '%s' has an invalid value for text-font and will not work offline. Output values must be contained as literals within the expression.", layer->getID().c_str()); - break; - } - } - } - ); - } + impls.emplace_back(layer->baseImpl); } - + std::set<FontStack> result = mbgl::fontStacks(impls); return std::vector<FontStack>(result.begin(), result.end()); } |