diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-06-07 15:38:08 +0300 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-08-13 13:32:56 +0300 |
commit | 9aa529576f4d0565bb81369f03a1fecdb8dd0886 (patch) | |
tree | 22c66df95c47aa8ad7f1e76ba4497adcb471a892 /src/mbgl/text/shaping.cpp | |
parent | 075d458403ba2c7367f06e5fc66c2a00c788634a (diff) | |
download | qtlocation-mapboxgl-9aa529576f4d0565bb81369f03a1fecdb8dd0886.tar.gz |
[core] Implement support for "text-writing-mode" layout property
Diffstat (limited to 'src/mbgl/text/shaping.cpp')
-rw-r--r-- | src/mbgl/text/shaping.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp index 1d95376b04..132f74661e 100644 --- a/src/mbgl/text/shaping.cpp +++ b/src/mbgl/text/shaping.cpp @@ -292,12 +292,8 @@ void shapeLines(Shaping& shaping, const style::TextJustifyType textJustify, const WritingModeType writingMode, const GlyphMap& glyphMap) { - - // the y offset *should* be part of the font metadata - const int32_t yOffset = -17; - float x = 0; - float y = yOffset; + float y = Shaping::yOffset; float maxLineLength = 0; @@ -342,7 +338,7 @@ void shapeLines(Shaping& shaping, shaping.positionedGlyphs.emplace_back(codePoint, x, y + baselineOffset, false, section.fontStackHash, section.scale, sectionIndex); x += glyph.metrics.advance * section.scale + spacing; } else { - shaping.positionedGlyphs.emplace_back(codePoint, x, baselineOffset, true, section.fontStackHash, section.scale, sectionIndex); + shaping.positionedGlyphs.emplace_back(codePoint, x, y + baselineOffset, true, section.fontStackHash, section.scale, sectionIndex); x += util::ONE_EM * section.scale + spacing; } } @@ -364,7 +360,7 @@ void shapeLines(Shaping& shaping, align(shaping, justify, anchorAlign.horizontalAlign, anchorAlign.verticalAlign, maxLineLength, lineHeight, lines.size()); - const float height = y - yOffset; + const float height = y - Shaping::yOffset; // Calculate the bounding box shaping.top += -anchorAlign.verticalAlign * height; |