summaryrefslogtreecommitdiff
path: root/src/mbgl/style/parser.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-01-05 12:40:54 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-01-10 15:31:12 -0800
commit76ed5079a547e9f98616a9401c8814d224cec9d8 (patch)
tree4bad1bcefd0744a0262d6973b825a977fa2cfe45 /src/mbgl/style/parser.cpp
parent158bd5e08cae5974a9c587677d7d8e63a36a5ff0 (diff)
downloadqtlocation-mapboxgl-76ed5079a547e9f98616a9401c8814d224cec9d8.tar.gz
[core, ios, macos, android] Add data-driven-styling support for `text-font`
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