diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-04-27 11:01:51 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2013-04-29 12:45:38 +0200 |
commit | d225318ead0154681982656bcd3e98011e022c34 (patch) | |
tree | 6e95222ee11083987c0479d065847286633dd14b /vcl | |
parent | 2b21f71065b44949cce2a9acbc5f379f0ab86ab6 (diff) |
[harfbuzz] Correctly apply RTL width adjustments
It turns out it is GenericSalLayout::ApplyDXArray() that is messing with
glyph advance widths trying to recalculate them. It is very old code (it
has been there since ICU were introduced back in 2002), but whatever
issue it is fixing, HarfBuzz does not need it.
Change-Id: I5c896d3f318e2f17d135f9eea599b917e04ed592
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/glyphs/gcach_layout.cxx | 21 | ||||
-rw-r--r-- | vcl/inc/generic/glyphcache.hxx | 1 |
2 files changed, 14 insertions, 8 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index ca40e9d69d97..eef1fd08f201 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -67,7 +67,6 @@ bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs ) } // ----------------------------------------------------------------------- - void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) { GenericSalLayout::AdjustLayout( rArgs ); @@ -91,6 +90,18 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) } } +void ServerFontLayout::ApplyDXArray(ImplLayoutArgs& rArgs) +{ +#if ENABLE_HARFBUZZ + // No idea what issue ApplyDXArray() was supposed to fix, but whatever + // GenericSalLayout::ApplyDXArray() does it just breaks our perfectly + // positioned text. + const char* pUseHarfBuzz = getenv("SAL_USE_HARFBUZZ"); + if (!pUseHarfBuzz) +#endif + GenericSalLayout::ApplyDXArray(rArgs); +} + // ======================================================================= static bool lcl_CharIsJoiner(sal_Unicode cChar) @@ -423,13 +434,7 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) aNewPos = Point(aNewPos.X() + aHbPositions[i].x_offset, aNewPos.Y() - aHbPositions[i].y_offset); GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth); - - // This is a hack to compensate for assumptions made elsewhere in - // the codebase, the right way is to use aHbPositions[i].x_advance - // instead of nGlyphWidth above, and leave mnNewWidth alone - // (whatever it is meant for) - if (i + 1 < nRunGlyphCount) - aGI.mnNewWidth = nGlyphWidth + (aHbPositions[i + 1].x_offset >> 6); + aGI.mnNewWidth = aHbPositions[i].x_advance; rLayout.AppendGlyph(aGI); diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx index d9f8378a28d9..cc3ae497c584 100644 --- a/vcl/inc/generic/glyphcache.hxx +++ b/vcl/inc/generic/glyphcache.hxx @@ -322,6 +322,7 @@ public: ServerFontLayout( ServerFont& ); virtual bool LayoutText( ImplLayoutArgs& ); virtual void AdjustLayout( ImplLayoutArgs& ); + virtual void ApplyDXArray( ImplLayoutArgs& ); virtual void DrawText( SalGraphics& ) const; ServerFont& GetServerFont() const { return mrServerFont; } }; |