diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 32344edcc04..553c8c79a67 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -201,6 +201,7 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye // Create a copy! const FontStack &fontStack = glyphStore.getFontStack(bucket_desc.geometry.font); + std::map shaping; // Shape and place all labels. { @@ -221,29 +222,30 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye uint32_t i = 0; uint32_t x = 0; const std::string string = toString(it_prop->second); - std::map shaping; + Shaping shapedGlyphs; std::map metrics = fontStack.getMetrics(); // fprintf(stderr, "%s\n", string.c_str()); + // TODO: Shape label // 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); + // Can we reuse GlyphPlacement here? First arg is a faces index. + GlyphPlacement glyph = GlyphPlacement(0, chr, x, 0); + // No idea how to properly put together a shapedGlyphs vector. + shapedGylphs.push(glyph); 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); + shaping.emplace(string, shaped); } - } + // 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); + return std::move(bucket); }