diff options
author | Mark Hung <marklh9@gmail.com> | 2015-08-15 22:43:02 +0800 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2015-08-16 06:42:54 +0000 |
commit | 21dc114a11138df497f05876979b82594c4ed1cd (patch) | |
tree | 9f63fe88ddd85b08c92d7e40c369b2146484ca24 /vcl/generic/glyphs | |
parent | Spell-check wrong-dirty text upon showing context menu. (diff) | |
download | core-21dc114a11138df497f05876979b82594c4ed1cd.tar.gz core-21dc114a11138df497f05876979b82594c4ed1cd.zip |
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 <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'vcl/generic/glyphs')
-rw-r--r-- | vcl/generic/glyphs/gcach_layout.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index f9dd96d91919..26d8c1165cef 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -406,6 +406,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); @@ -561,6 +562,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); |