Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add eviction strategy for Glyphs #12388

Closed

Description

@kkaefer

In #9213, we factored out glyph management from the GlyphAtlas into its own class called GlyphManager. Previously, glyphs were stored and associated with a style, which meant that setting a new style also removed all cached glyphs. This isn't true anymore after #9213, since the GlyphManager is now owned by the Renderer::Impl, which persists across styles changes.

GlyphManager only ever has Glyphs/PBFs added to it, never removed, including glyphs from previously loaded styles that aren't used anymore. We should add an eviction strategy for glyphs that are unused so that they don't stick around forever in long-lived Map objects.

@jfirebaugh thinks that this could be fairly straightforward: promote style::Parser::fontStacks to a more general location, and then in Renderer::Impl::render, remove any unused font stacks from GlyphManager when the layer diff is non-empty.

Activity

  1. added
    Core
    on Jul 16, 2018
  2. jfirebaugh commented on Jul 17, 2018

    @jfirebaugh
    Contributor

    Note that the proposed change will turn what is currently a warning:

    Layer '%s' has an invalid value for text-font and will not work offline. Output values must be contained as literals within the expression.

    ...into a hard error: symbol layers that don't conform to this constraint will not render text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Corerefactor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions