From af9f6ff8c5e7ca0a99b9f6928365d291b4f70696 Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Mon, 3 Apr 2017 14:00:02 +0200 Subject: Fix the handling of glyph positioning (gpos) offsets in vertical-upright mode. --- gfx/thebes/gfxHarfBuzzShaper.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gfx') diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index b0cfc79be..6f7adb729 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -1620,7 +1620,15 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, // collect all glyphs in a list to be assigned to the first char; // there must be at least one in the clump, and we already measured // its advance, hence the placement of the loop-exit test and the - // measurement of the next glyph + // measurement of the next glyph. + // For vertical orientation, we add a "base offset" to compensate + // for the positioning within the cluster being based on horizontal + // glyph origin/offset. + hb_position_t baseIOffset, baseBOffset; + if (aVertical) { + baseIOffset = 2 * (i_offset - i_advance); + baseBOffset = GetGlyphHAdvance(ginfo[glyphStart].codepoint); + } while (1) { gfxTextRun::DetailedGlyph* details = detailedGlyphs.AppendElement(); @@ -1643,9 +1651,9 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, } if (aVertical) { - i_offset = posInfo[glyphStart].y_offset; + i_offset = baseIOffset - posInfo[glyphStart].y_offset; i_advance = posInfo[glyphStart].y_advance; - b_offset = posInfo[glyphStart].x_offset; + b_offset = baseBOffset - posInfo[glyphStart].x_offset; b_advance = posInfo[glyphStart].x_advance; } else { i_offset = posInfo[glyphStart].x_offset; -- cgit v1.2.3