[core] don't force downloading of Open Sans fonts

When a SymbolLayer doesn't have a text-font defined, we automatically add Open Sans/Arial Unicode MS. However, when the SymbolLayer is only used for rendering icons, it doesn't have text-field defined either. In those cases, we still force downloading Open Sans/Arial Unicode MS during offline pack creation. If the user doesn't use this font, this change should save ~15MB and a few seconds in download time.
This commit is contained in:
Konstantin Käfer
2018-01-25 15:24:29 -08:00
parent c148a7a061
commit 191c0124c7
3 changed files with 25 additions and 1 deletions

View File

@@ -277,7 +277,7 @@ std::vector<FontStack> Parser::fontStacks() const {
std::set<FontStack> result;
for (const auto& layer : layers) {
if (layer->is<SymbolLayer>()) {
if (layer->is<SymbolLayer>() && !layer->as<SymbolLayer>()->getTextField().isUndefined()) {
layer->as<SymbolLayer>()->getTextFont().match(
[&] (Undefined) {
result.insert({"Open Sans Regular", "Arial Unicode MS Regular"});