From 740dde32fc2f8db99f4f4f8328ea6080eb7a9485 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 17 Jul 2018 15:33:50 -0700 Subject: [core] Evict unused font stacks from GlyphManager --- src/mbgl/style/parser.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src/mbgl/style/parser.cpp') 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 #include -#include #include #include #include @@ -274,31 +273,12 @@ void Parser::parseLayer(const std::string& id, const JSValue& value, std::unique } std::vector Parser::fontStacks() const { - std::set result; - + std::vector> impls; + impls.reserve(layers.size()); for (const auto& layer : layers) { - if (layer->is() && !layer->as()->getTextField().isUndefined()) { - layer->as()->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 result = mbgl::fontStacks(impls); return std::vector(result.begin(), result.end()); } -- cgit v1.2.1