diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-09 16:27:23 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-09 16:27:23 -0700 |
commit | 22c8afced5970cac24a7ce98d67ac6741bb26cef (patch) | |
tree | 1966072953231ba552ec7e284796199bca40d5ab /src/text | |
parent | f2ee02d3ca4c8033d120d8f681f4edf54dfa89ca (diff) | |
download | qtlocation-mapboxgl-22c8afced5970cac24a7ce98d67ac6741bb26cef.tar.gz |
replace {{token}} with {token}, and %d/%d/%d with {z}/{x}/{y}
refs https://github.com/mapbox/mapbox-gl-style-spec/pull/87
Diffstat (limited to 'src/text')
-rw-r--r-- | src/text/glyph_store.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp index b79010670d..f83d810899 100644 --- a/src/text/glyph_store.cpp +++ b/src/text/glyph_store.cpp @@ -120,12 +120,11 @@ GlyphPBF::GlyphPBF(const std::string &glyphURL, const std::string &fontStack, Gl : future(promise.get_future().share()) { // Load the glyph set URL - - const std::map<std::string, std::string> tokens {{ - { "fontstack", fontStack }, - { "range", std::to_string(glyphRange.first) + "-" + std::to_string(glyphRange.second) } - }}; - std::string url = util::replaceTokens(glyphURL, tokens); + std::string url = util::replaceTokens(glyphURL, [&](const std::string &name) -> std::string { + if (name == "fontstack") return fontStack; + if (name == "range") return std::to_string(glyphRange.first) + "-" + std::to_string(glyphRange.second); + return ""; + }); // TODO: Find more reliable URL normalization function std::replace(url.begin(), url.end(), ' ', '+'); |