load glyphset url from stylesheet

This commit is contained in:
Konstantin Käfer
2014-07-02 12:10:09 +02:00
parent e93803ac80
commit af87fb6c26
13 changed files with 58 additions and 18 deletions

View File

@@ -24,7 +24,6 @@ Map::Map(View& view)
transform(),
style(std::make_shared<Style>()),
glyphAtlas(std::make_shared<GlyphAtlas>(1024, 1024)),
glyphStore(std::make_shared<GlyphStore>()),
spriteAtlas(std::make_shared<SpriteAtlas>(512, 512)),
texturepool(std::make_shared<Texturepool>()),
painter(*this),
@@ -439,6 +438,16 @@ void Map::prepare() {
spriteAtlas->resize(state.getPixelRatio());
}
// Create a new glyph store object in case the glyph URL changed.
// TODO: Move this to a less frequently called place; we only need to do this when the
// stylesheet changes.
if (glyphStore && glyphStore->glyphURL != style->glyph_url) {
glyphStore.reset();
}
if (!glyphStore && style->glyph_url.size()) {
glyphStore = std::make_shared<GlyphStore>(style->glyph_url);
}
if (pixelRatioChanged || dimensionsChanged) {
painter.clearFramebuffers();
}