summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-11-10 00:24:26 +0800
committerCaolán McNamara <caolanm@redhat.com>2017-11-30 13:20:38 +0100
commit2ed722a7a49e9e90480e49e1ef0cec8e8c79b79d (patch)
tree4df0d0d5dd0b27bbf14dc061ab355c166075576d
parentaa0f44de5b260b2b2a39bdd2de9445d72ab14265 (diff)
tdf#111967 translate offsets so it is relative to v origin
The offsets were 0 in HarfBuzz 1.3.3 but the value became something else and made text offsets toward upper-right after upgrading to HarfBuzz 1.4.8. Those values are offsets relative to the horizontal origin. But underlying renderer expect positions relative to the vertical origin. Translate them back by adding the horizontal origin. Change-Id: If58d2c082b198bfd8789efb3df2be49869a04bf9 Reviewed-on: https://gerrit.libreoffice.org/44556 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com> (cherry picked from commit 58af692e28146a1ecb4fbeef89e839baa1a1b39d) Reviewed-on: https://gerrit.libreoffice.org/45315 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 54a8dc312398..c23293fd6f2b 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -662,6 +662,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
{
nGlyphFlags |= GlyphItem::IS_VERTICAL;
+ // We have glyph offsets that is relative to h origin now,
+ // add the origin back so it is relative to v origin.
+ hb_font_add_glyph_origin_for_direction( mpHbFont,
+ nGlyphIndex,
+ HB_DIRECTION_TTB,
+ &pHbPositions[i].x_offset ,
+ &pHbPositions[i].y_offset );
nAdvance = -pHbPositions[i].y_advance;
nXOffset = pHbPositions[i].y_offset;
nYOffset = pHbPositions[i].x_offset;