From 02d2ddef5255f54fe08f6fa5d08bd19536fa817c Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 2 Apr 2015 12:39:30 -0700 Subject: [PATCH] fix quad offsets by subtracting buffer -js doesn't have this here because it subtracts the buffer earlier. https://github.com/mapbox/mapbox-gl-js/blob/617e590c833040407508606b9dbdae2abc3a305d/js/symbol/glyph_source.js#L75 We should match -js eventually. --- src/mbgl/text/quads.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp index ca76dfe9f..c2bb3d822 100644 --- a/src/mbgl/text/quads.cpp +++ b/src/mbgl/text/quads.cpp @@ -149,8 +149,11 @@ SymbolQuads getGlyphQuads(Anchor &anchor, const Shaping &shapedText, glyphInstances.emplace_back(GlyphInstance{anchor}); } - const float x1 = positionedGlyph.x + glyph.metrics.left; - const float y1 = positionedGlyph.y - glyph.metrics.top; + // The rects have an addditional buffer that is not included in their size; + const float rectBuffer = 3.0f; + + const float x1 = positionedGlyph.x + glyph.metrics.left - rectBuffer; + const float y1 = positionedGlyph.y - glyph.metrics.top - rectBuffer; const float x2 = x1 + rect.w; const float y2 = y1 + rect.h;