[core] Shape images in labels at bucket zoom level
This commit is contained in:
@@ -355,6 +355,7 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap,
|
||||
optional<PositionedIcon> shapedIcon;
|
||||
std::array<float, 2> textOffset{{0.0f, 0.0f}};
|
||||
const float layoutTextSize = layout->evaluate<TextSize>(zoom + 1, feature);
|
||||
const float layoutTextSizeAtBucketZoomLevel = layout->evaluate<TextSize>(zoom, feature);
|
||||
const float layoutIconSize = layout->evaluate<IconSize>(zoom + 1, feature);
|
||||
|
||||
// if feature has text, shape the text
|
||||
@@ -381,6 +382,7 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap,
|
||||
/* glyphs */ glyphPositions,
|
||||
/* images */ imagePositions,
|
||||
layoutTextSize,
|
||||
layoutTextSizeAtBucketZoomLevel,
|
||||
allowVerticalPlacement);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -532,6 +532,7 @@ const Shaping getShaping(const TaggedString& formattedString,
|
||||
const GlyphPositions& glyphPositions,
|
||||
const ImagePositions& imagePositions,
|
||||
float layoutTextSize,
|
||||
float layoutTextSizeAtBucketZoomLevel,
|
||||
bool allowVerticalPlacement) {
|
||||
assert(layoutTextSize);
|
||||
std::vector<TaggedString> reorderedLines;
|
||||
@@ -561,7 +562,7 @@ const Shaping getShaping(const TaggedString& formattedString,
|
||||
glyphMap,
|
||||
glyphPositions,
|
||||
imagePositions,
|
||||
layoutTextSize,
|
||||
layoutTextSizeAtBucketZoomLevel,
|
||||
allowVerticalPlacement);
|
||||
|
||||
return shaping;
|
||||
|
||||
@@ -73,6 +73,7 @@ const Shaping getShaping(const TaggedString& string,
|
||||
const GlyphPositions& glyphPositions,
|
||||
const ImagePositions& imagePositions,
|
||||
float layoutTextSize,
|
||||
float layoutTextSizeAtBucketZoomLevel,
|
||||
bool allowVerticalPlacement);
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -25,6 +25,8 @@ TEST(Shaping, ZWSP) {
|
||||
auto immutableGlyph = Immutable<Glyph>(makeMutable<Glyph>(std::move(glyph)));
|
||||
const std::vector<std::string> fontStack{{"font-stack"}};
|
||||
const SectionOptions sectionOptions(1.0f, fontStack);
|
||||
const float layoutTextSize = 16.0f;
|
||||
const float layoutTextSizeAtBucketZoomLevel = 16.0f;
|
||||
GlyphMap glyphs = {
|
||||
{ FontStackHasher()(fontStack), {{u'中', std::move(immutableGlyph)}} }
|
||||
};
|
||||
@@ -44,7 +46,8 @@ TEST(Shaping, ZWSP) {
|
||||
glyphs,
|
||||
glyphPositions,
|
||||
imagePositions,
|
||||
16.0,
|
||||
layoutTextSize,
|
||||
layoutTextSizeAtBucketZoomLevel,
|
||||
/*allowVerticalPlacement*/ false);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user