diff options
Diffstat (limited to 'vcl/source/glyphs/gcach_layout.cxx')
-rw-r--r-- | vcl/source/glyphs/gcach_layout.cxx | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx index bed698d9c1aa..40e270c40c49 100644 --- a/vcl/source/glyphs/gcach_layout.cxx +++ b/vcl/source/glyphs/gcach_layout.cxx @@ -534,12 +534,40 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) ); const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex ); int nGlyphWidth = rGM.GetCharWidth(); + int nNewWidth = nGlyphWidth; if( nGlyphWidth <= 0 ) bDiacritic |= true; // #i99367# force all diacritics to zero width // TODO: we need mnOrigWidth/mnLogicWidth/mnNewWidth else if( bDiacritic ) - nGlyphWidth = 0; + nGlyphWidth = nNewWidth = 0; + else + { + // Hack, find next +ve width glyph and calculate current + // glyph width by substracting the two posituons + const IcuPosition* pNextPos = pPos+1; + for ( int j = i + 1; j <= nRawRunGlyphCount; ++j, ++pNextPos ) + { + if ( j == nRawRunGlyphCount ) + { + nNewWidth = pNextPos->fX - pPos->fX; + break; + } + + LEGlyphID nNextGlyphIndex = pIcuGlyphs[j]; + if( (nNextGlyphIndex == ICU_MARKED_GLYPH) + || (nNextGlyphIndex == ICU_DELETED_GLYPH) ) + continue; + + const GlyphMetric& rNextGM = rFont.GetGlyphMetric( nNextGlyphIndex ); + int nNextGlyphWidth = rNextGM.GetCharWidth(); + if ( nNextGlyphWidth > 0 ) + { + nNewWidth = pNextPos->fX - pPos->fX; + break; + } + } + } // heuristic to detect glyph clusters bool bInCluster = true; @@ -593,7 +621,8 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr nGlyphFlags |= GlyphItem::IS_DIACRITIC; // add resulting glyph item to layout - const GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth ); + GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth ); + aGI.mnNewWidth = nNewWidth; rLayout.AppendGlyph( aGI ); ++nFilteredRunGlyphCount; nLastCharPos = nCharPos; |