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

Commit

Permalink
[core] Extract some GlyphRange-related constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Sep 26, 2016
1 parent 8764c20 commit a9842db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platform/default/mbgl/storage/offline_download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const {
}

if (!parser.glyphURL.empty()) {
result.requiredResourceCount += parser.fontStacks().size() * 256;
result.requiredResourceCount += parser.fontStacks().size() * GLYPH_RANGES_PER_FONT_STACK;
}

if (!parser.spriteURL.empty()) {
Expand Down Expand Up @@ -184,8 +184,8 @@ void OfflineDownload::activateDownload() {

if (!parser.glyphURL.empty()) {
for (const auto& fontStack : parser.fontStacks()) {
for (uint32_t i = 0; i < 256; i++) {
queueResource(Resource::glyphs(parser.glyphURL, fontStack, getGlyphRange(i * 256)));
for (uint32_t i = 0; i < GLYPH_RANGES_PER_FONT_STACK; i++) {
queueResource(Resource::glyphs(parser.glyphURL, fontStack, getGlyphRange(i * GLYPHS_PER_GLYPH_RANGE)));
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/mbgl/text/glyph_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ struct GlyphRangeHash {

typedef std::unordered_set<GlyphRange, GlyphRangeHash> GlyphRangeSet;

constexpr uint32_t GLYPHS_PER_GLYPH_RANGE = 256;
constexpr uint32_t GLYPH_RANGES_PER_FONT_STACK = 256;

} // end namespace mbgl

0 comments on commit a9842db

Please sign in to comment.