diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 14:55:55 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 14:55:55 +0000 |
commit | ca6c4d47055ab4d7ff1d9173ed181c1ff66391a9 (patch) | |
tree | 1fe1f4560b2d1571b2a44c389ecacdbc2ddc7049 /vcl/source/gdi/metric.cxx | |
parent | 9b0d249041e4bec7f23019790c5056f199ba8633 (diff) |
INTEGRATION: CWS vcl26 (1.11.24); FILE MERGED
2004/08/26 16:27:53 hdu 1.11.24.1: #i33121# fix ImplFontCharmap oddities
Diffstat (limited to 'vcl/source/gdi/metric.cxx')
-rw-r--r-- | vcl/source/gdi/metric.cxx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 87f6e6871169..3b8aa983d4a8 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -2,9 +2,9 @@ * * $RCSfile: metric.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: hdu $ $Date: 2004-07-20 09:48:34 $ + * last change: $Author: hr $ $Date: 2004-09-08 15:55:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -366,14 +366,14 @@ int ImplFontCharMap::CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const // find and adjust range and char count for cMin int nRangeMin = ImplFindRangeIndex( cMin ); - if( (nRangeMin & 1) != 0 ) + if( nRangeMin & 1 ) ++nRangeMin; else if( cMin > mpRangeCodes[ nRangeMin ] ) nCount -= cMin - mpRangeCodes[ nRangeMin ]; // find and adjust range and char count for cMax int nRangeMax = ImplFindRangeIndex( cMax ); - if( (nRangeMin & 1) != 0 ) + if( nRangeMax & 1 ) --nRangeMax; else nCount -= mpRangeCodes[ nRangeMax+1 ] - cMax - 1; @@ -408,9 +408,9 @@ sal_uInt32 ImplFontCharMap::GetNextChar( sal_uInt32 cChar ) const if( cChar >= GetLastChar() ) return GetLastChar(); - int nRange = ImplFindRangeIndex( cChar ); - if( nRange & 1 ) // outside a range? - return mpRangeCodes[ nRange + 1 ]; // => first in next range + int nRange = ImplFindRangeIndex( cChar + 1 ); + if( nRange & 1 ) // outside of range? + return mpRangeCodes[ nRange + 1 ]; // => first in next range return (cChar + 1); } @@ -423,11 +423,9 @@ sal_uInt32 ImplFontCharMap::GetPrevChar( sal_uInt32 cChar ) const if( cChar > GetLastChar() ) return GetLastChar(); - int nRange = ImplFindRangeIndex( cChar ); + int nRange = ImplFindRangeIndex( cChar - 1 ); if( nRange & 1 ) // outside a range? return (mpRangeCodes[ nRange ] - 1); // => last in prev range - else if( cChar == mpRangeCodes[ nRange ] ) // first in prev range? - return (mpRangeCodes[ nRange-1 ] - 1); // => last in prev range return (cChar - 1); } @@ -443,10 +441,11 @@ int ImplFontCharMap::GetIndexFromChar( sal_uInt32 cChar ) const sal_uInt32 cFirst = *(pRange++); sal_uInt32 cLast = *(pRange++); if( cChar >= cLast ) - break; - if( cChar >= cFirst ) + nCharIndex += cLast - cFirst; + else if( cChar >= cFirst ) return nCharIndex + (cChar - cFirst); - nCharIndex += cLast - cFirst; + else + break; } return -1; |