Special fontstacks.json handling for Tileserver GL

This commit is contained in:
Lukas Martinelli 2017-01-25 13:46:46 +01:00
parent e5fbe3b74a
commit 404b53587f

View file

@ -21,7 +21,12 @@ function loadJSON(url, defaultValue, cb) {
export function downloadGlyphsMetadata(urlTemplate, cb) {
if(!urlTemplate) return cb([])
const url = urlTemplate.replace('{fontstack}/{range}.pbf', 'fontstacks.json')
// Special handling because Tileserver GL serves the fontstacks metadata differently
// https://github.com/klokantech/tileserver-gl/pull/104
let url = urlTemplate.replace('/fonts/{fontstack}/{range}.pbf', '/fontstacks.json')
url = url.replace('{fontstack}/{range}.pbf', 'fontstacks.json')
loadJSON(url, [], cb)
}