Skip to content

Commit 37a9681

Browse files
author
Dane Springmeyer
committed
do not load fonts for already cached sources
1 parent 0772780 commit 37a9681

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/mapnik_backend.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@ exports = module.exports = MapnikSource;
1919
require('util').inherits(MapnikSource, require('events').EventEmitter);
2020
function MapnikSource(uri, callback) {
2121
uri = this._normalizeURI(uri);
22-
var key = JSON.stringify(uri);
2322

2423
if (uri.protocol && uri.protocol !== 'mapnik:') {
2524
throw new Error('Only the mapnik protocol is supported');
2625
}
2726

28-
// This deafults to true. To disable font auto-loading
29-
// Set ?autoLoadFonts=false in the mapnik URL to disable
30-
if (uri.query.autoLoadFonts) {
31-
if (mapnik.register_default_fonts) mapnik.register_default_fonts();
32-
if (mapnik.register_system_fonts) mapnik.register_system_fonts();
33-
}
27+
var key = JSON.stringify(uri);
3428

3529
// by default we use an internal self-caching mechanism but
3630
// calling applications can pass `internal_cache:false` to disable
@@ -150,6 +144,13 @@ MapnikSource.prototype._open = function(uri) {
150144
this.metatile = uri.query.metatile;
151145
this.bufferSize = uri.query.bufferSize;
152146

147+
// This defaults to true. To disable font auto-loading
148+
// Set ?autoLoadFonts=false in the mapnik URL to disable
149+
if (this._autoLoadFonts) {
150+
if (mapnik.register_default_fonts) mapnik.register_default_fonts();
151+
if (mapnik.register_system_fonts) mapnik.register_system_fonts();
152+
}
153+
153154
// Initialize this map. This wraps `localize()` and calls `create()`
154155
// afterwards to actually create a new Mapnik map object.
155156
Step(function() {

0 commit comments

Comments
 (0)