vcl/generic/glyphs/gcach_layout.cxx | 3 +++ vcl/inc/generic/glyphcache.hxx | 1 + 2 files changed, 4 insertions(+)
New commits: commit a4532151e3ca83488bc8fd255cc64971421b4517 Author: Mark Hung <mark...@gmail.com> Date: Sat Aug 15 22:43:02 2015 +0800 Fix tdf#40091 and tdf#40335 text layout issues. tdf#40091 Vertical writing inferior to MS Word tdf#40335 Using Right-to-left (vertical) for text, the characters overlap each other. Cursor is placed at the half of the character. It seems that current implementation use HarfBuzz OpenType layout API hb_buffer_get_glyph_positions() to layout the text, however instead of setting text direction to HB_DIRECTION_TTB, it uses HB_DIRECTION_LTR as its direction and rotates each CJK glyph to simulate the HB_DIRECTION_TTB. However the API use font width to position each glyph no matter whether the glyph will be rotated or not. Change-Id: Ie35238dd92218f8c4463c0ae1d356ad8609c5f48 Reviewed-on: https://gerrit.libreoffice.org/17774 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthieb...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/18878 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index 7bab5fe..6b3f0ae 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -402,6 +402,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) // allocate temporary arrays, note: round to even int nGlyphCapacity = (3 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos) | 15) + 1; + int32_t nVirtAdv = int32_t(aFtFace->size->metrics.height*rFont.GetStretch())>>6; rLayout.Reserve(nGlyphCapacity); @@ -563,6 +564,8 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) int32_t nYOffset = pHbPositions[i].y_offset >> 6; int32_t nXAdvance = pHbPositions[i].x_advance >> 6; int32_t nYAdvance = pHbPositions[i].y_advance >> 6; + if ( nGlyphIndex & GF_ROTMASK ) + nXAdvance = nVirtAdv; Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset)); const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance, nXOffset, nYOffset); diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index c7c2123..7fe9e36 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -185,6 +185,7 @@ public: const unsigned char* GetTable( const char* pName, sal_uLong* pLength ); int GetEmUnits() const { return maFaceFT->units_per_EM;} const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; } + double GetStretch() { return mfStretch; } const FontCharMapPtr GetFontCharMap() const; bool GetFontCapabilities(vcl::FontCapabilities &) const;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits