summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2011-01-28 14:03:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-01-28 14:14:49 +0000
commit9ab4e7482b56f46cdd091b55e6de4c2200ea04c5 (patch)
tree12ce5179c0550c5047a93a60b1c00fce51bf5128 /vcl/source
parente8021d4a74761ae496394159e7c8d101b4167904 (diff)
Resolves: fdo#31016 try some bandaids to improve Arabic rendering
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/glyphs/gcach_layout.cxx33
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;