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

Commit

Permalink
Guesses.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhahn committed May 29, 2014
1 parent 9441672 commit 25803b4
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/map/tile_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
#include <llmr/util/constants.hpp>
#include <llmr/geometry/glyph_atlas.hpp>
#include <llmr/text/glyph_store.hpp>

#include <llmr/text/glyph.hpp>
#include <llmr/util/std.hpp>

using namespace llmr;


TileParser::TileParser(const std::string& data, VectorTileData& tile, const Style& style, GlyphAtlas& glyphAtlas, GlyphStore &glyphStore, SpriteAtlas &spriteAtlas)
: vector_data(pbf((const uint8_t *)data.data(), data.size())),
tile(tile),
Expand Down Expand Up @@ -219,10 +218,29 @@ std::unique_ptr<Bucket> TileParser::createTextBucket(const VectorTileLayer& laye
continue;
}

uint32_t i = 0;
uint32_t x = 0;
const std::string string = toString(it_prop->second);

std::map<uint32_t, GlyphPlacement> shaping;
std::map<uint32_t, GlyphMetrics> metrics = fontStack.getMetrics();
// fprintf(stderr, "%s\n", string.c_str());
// Loop through all characters of this label and shape.
for (uint32_t chr : string) {
// Can we reuse GlyphPlacement here? First arg is a faces index ...
GlyphPlacement shaped = GlyphPlacement(0, chr, x, 0);
// No idea how to properly put together a shaping std::map ...
shaping.emplace(i, shaped);
i++;
x += metrics[chr].advance;
}
// TODO: Shape label
// TODO: Place label
// Can faces here be a std::map of fontstacks?
// It looks like nearly the same interface through the rest
// of the stack.
std::unique_ptr<TextBucket> bucket = std::make_unique<TextBucket>(
tile.textVertexBuffer, tile.triangleElementsBuffer, bucket_desc, placement);
addBucketFeatures(bucket, layer, bucket_desc, faces, shaping);
}

}
Expand Down

0 comments on commit 25803b4

Please sign in to comment.