summaryrefslogtreecommitdiff
path: root/src/mbgl/style/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/parser.cpp')
-rw-r--r--src/mbgl/style/parser.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp
index 10fce33986..52d788b3a1 100644
--- a/src/mbgl/style/parser.cpp
+++ b/src/mbgl/style/parser.cpp
@@ -271,28 +271,29 @@ void Parser::parseLayer(const std::string& id, const JSValue& value, std::unique
}
std::vector<FontStack> Parser::fontStacks() const {
- std::set<FontStack> optional;
+ std::set<FontStack> result;
for (const auto& layer : layers) {
if (layer->is<SymbolLayer>()) {
- PropertyValue<FontStack> textFont = layer->as<SymbolLayer>()->getTextFont();
- if (textFont.isUndefined()) {
- optional.insert({"Open Sans Regular", "Arial Unicode MS Regular"});
- } else if (textFont.isConstant()) {
- optional.insert(textFont.asConstant());
- } else if (textFont.isCameraFunction()) {
- textFont.asCameraFunction().stops.match(
- [&] (const auto& stops) {
- for (const auto& stop : stops.stops) {
- optional.insert(stop.second);
+ 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);
}
}
- );
- }
+ }
+ );
}
}
- return std::vector<FontStack>(optional.begin(), optional.end());
+ return std::vector<FontStack>(result.begin(), result.end());
}
} // namespace style