Skip to content

Commit aa6e968

Browse files
authored
Pre-load fonts so map's local font cache is populated (#334)
1 parent 24a5752 commit aa6e968

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/gen_tile.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,19 @@ static enum protoCmd render(struct xmlmapconfig * map, int x, int y, int z, char
300300
mapnik::image_32 buf(render_size_tx * map->tilesize, render_size_ty * map->tilesize);
301301

302302
try {
303-
Map map_parameterized = map->map;
304-
305303
if (map->parameterize_function) {
304+
Map map_parameterized = map->map;
305+
306306
map->parameterize_function(map_parameterized, options);
307-
}
308307

309-
mapnik::agg_renderer<mapnik::image_32> ren(map_parameterized, buf, map->scale);
310-
ren.apply();
308+
map_parameterized.load_fonts();
309+
310+
mapnik::agg_renderer<mapnik::image_32> ren(map_parameterized, buf, map->scale);
311+
ren.apply();
312+
} else {
313+
mapnik::agg_renderer<mapnik::image_32> ren(map->map, buf, map->scale);
314+
ren.apply();
315+
}
311316
} catch (std::exception const& ex) {
312317
g_logger(G_LOG_LEVEL_ERROR, "failed to render TILE %s %d %d-%d %d-%d", map->xmlname, z, x, x + render_size_tx - 1, y, y + render_size_ty - 1);
313318
g_logger(G_LOG_LEVEL_ERROR, " reason: %s", ex.what());
@@ -421,6 +426,10 @@ void *render_thread(void * arg)
421426
try {
422427
mapnik::load_map(maps[iMaxConfigs].map, maps[iMaxConfigs].xmlfile);
423428

429+
if (!maps[iMaxConfigs].parameterize_function) {
430+
maps[iMaxConfigs].map.load_fonts();
431+
}
432+
424433
/* If we have more than 10 rendering threads configured, we need to fix
425434
* up the mapnik datasources to support larger postgres connection pools
426435
*/

0 commit comments

Comments
 (0)