From 25803b4b98192675cb15cb73738d1c554253dd1f Mon Sep 17 00:00:00 2001 From: Young Hahn Date: Wed, 28 May 2014 22:57:32 -0400 Subject: [PATCH] Guesses. --- src/map/tile_parser.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 673600ecc..32344edcc 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -10,12 +10,11 @@ #include #include #include - +#include #include 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), @@ -219,10 +218,29 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye continue; } + uint32_t i = 0; + uint32_t x = 0; const std::string string = toString(it_prop->second); - + std::map shaping; + std::map 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 bucket = std::make_unique( + tile.textVertexBuffer, tile.triangleElementsBuffer, bucket_desc, placement); + addBucketFeatures(bucket, layer, bucket_desc, faces, shaping); } }