summaryrefslogtreecommitdiff
path: root/src/text
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-03-24 11:13:20 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-03-24 11:13:20 +0100
commit67a88824573aa961bf1632cd83a3966bceca9660 (patch)
tree82e6362c00240a7b113b4426e72d3c651794a270 /src/text
parentaf8c936c10db1479b589a0187cc66bbec24dd18a (diff)
downloadqtlocation-mapboxgl-67a88824573aa961bf1632cd83a3966bceca9660.tar.gz
use the correct glyphs
Diffstat (limited to 'src/text')
-rw-r--r--src/text/placement.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/text/placement.cpp b/src/text/placement.cpp
index 2380e191e3..be329eda30 100644
--- a/src/text/placement.cpp
+++ b/src/text/placement.cpp
@@ -33,14 +33,21 @@ bool byScale(const Anchor &a, const Anchor &b) { return a.scale < b.scale; }
static const Glyph null_glyph;
inline const Glyph &getGlyph(const GlyphPlacement &placed,
- const IndexedFaceGlyphPositions &faces) {
+ const IndexedFaces &faces) {
if (placed.face < faces.size()) {
const GlyphPositions &face = *faces[placed.face];
if (&face) {
- if (placed.glyph < face.size()) {
- return face[placed.glyph];
+ auto it = face.find(placed.glyph);
+ if (it != face.end()) {
+ return it->second;
+ } else {
+ fprintf(stderr, "glyph %d does not exist\n", placed.glyph);
}
+ } else {
+ fprintf(stderr, "face pointer is null\n");
}
+ } else {
+ fprintf(stderr, "face does not exist\n");
}
return null_glyph;
@@ -137,7 +144,7 @@ void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs,
}
PlacedGlyphs getGlyphs(Anchor &anchor, float advance, const Shaping &shaping,
- const IndexedFaceGlyphPositions &faces, float fontScale,
+ const IndexedFaces &faces, float fontScale,
bool horizontal, const std::vector<Coordinate> &line,
float maxAngleDelta, float rotate) {
// The total text advance is the width of this label.
@@ -260,7 +267,7 @@ PlacedGlyphs getGlyphs(Anchor &anchor, float advance, const Shaping &shaping,
void Placement::addFeature(TextBucket& bucket,
const std::vector<Coordinate> &line,
const BucketGeometryDescription &info,
- const IndexedFaceGlyphPositions &faces,
+ const IndexedFaces &faces,
const Shaping &shaping) {
const bool horizontal = info.path == TextPathType::Horizontal;
@@ -306,7 +313,7 @@ void Placement::addFeature(TextBucket& bucket,
}
}
-float Placement::measureText(const IndexedFaceGlyphPositions &faces,
+float Placement::measureText(const IndexedFaces &faces,
const Shaping &shaping) {
float advance = 0;