diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5fa8b02..0755b91 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -80,25 +80,27 @@ return next(); } - var xmlUrl = path.dirname(resource.url); + var xmlUrl = !resource.isDataUrl ? path.dirname(resource.url) : ''; - if (xmlUrl === '.') { - xmlUrl = ''; - } - - if (this.baseUrl && xmlUrl) { - // if baseurl has a trailing slash then add one to xmlUrl so the replace works below - if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') { - xmlUrl += '/'; + if (resource.isDataUrl) { + if (xmlUrl === '.') { + xmlUrl = ''; } - // remove baseUrl from xmlUrl - xmlUrl = xmlUrl.replace(this.baseUrl, ''); - } + if (this.baseUrl && xmlUrl) { + // if baseurl has a trailing slash then add one to xmlUrl so the replace works below + if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') { + xmlUrl += '/'; + } - // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. - if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') { - xmlUrl += '/'; + // remove baseUrl from xmlUrl + xmlUrl = xmlUrl.replace(this.baseUrl, ''); + } + + // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. + if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') { + xmlUrl += '/'; + } } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); if (core.utils.TextureCache[textureUrl]) {