summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-01-14 00:04:46 +1100
committerCaolán McNamara <caolanm@redhat.com>2014-01-17 11:44:25 +0000
commit683764db4c435f27a83a2fdcf532be245c7fe4c9 (patch)
tree31d82f5905ea761f873c25532a4626500f428307
parentd930faddc9e8c5d3ec933b423aa0fe8fc74060f9 (diff)
Additional warnings when processing cmap tables
Small enhancements to the code: * Removed unused code that clips unicode characters to the baseplane * Add a SAL_WARNING if the maximum character is greater than the minimum character. Change-Id: I783fba75435e7f98a65afab2e091b737efc9ddc6 Reviewed-on: https://gerrit.libreoffice.org/7404 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/gdi/impfont.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/vcl/source/gdi/impfont.cxx b/vcl/source/gdi/impfont.cxx
index bfe99dcb574d..9b27e3a29cfb 100644
--- a/vcl/source/gdi/impfont.cxx
+++ b/vcl/source/gdi/impfont.cxx
@@ -419,10 +419,14 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
const sal_UCS4 cMaxChar = Getsal_uInt16( pLimitBase + 2*i );
const int nGlyphDelta = GetSShort( pDeltaBase + 2*i );
const int nRangeOffset = Getsal_uInt16( pOffsetBase + 2*i );
- if( cMinChar > cMaxChar ) // no sane font should trigger this
+ if( cMinChar > cMaxChar ) { // no sane font should trigger this
+ SAL_WARN("vcl.gdi", "Min char should never be more than the max char!");
break;
- if( cMaxChar == 0xFFFF )
+ }
+ if( cMaxChar == 0xFFFF ) {
+ SAL_WARN("vcl.gdi", "Format 4 char should not be 0xFFFF");
break;
+ }
*(pCP++) = cMinChar;
*(pCP++) = cMaxChar + 1;
if( !nRangeOffset ) {
@@ -454,15 +458,12 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
sal_UCS4 cMaxChar = GetUInt( pGroup + 4 );
int nGlyphId = GetUInt( pGroup + 8 );
pGroup += 12;
-#if 0 // TODO: remove unicode baseplane clipping for UCS-4 support
- if( cMinChar > 0xFFFF )
- continue;
- if( cMaxChar > 0xFFFF )
- cMaxChar = 0xFFFF;
-#else
- if( cMinChar > cMaxChar ) // no sane font should trigger this
+
+ if( cMinChar > cMaxChar ) { // no sane font should trigger this
+ SAL_WARN("vcl.gdi", "Min char should never be more than the max char!");
break;
-#endif
+ }
+
*(pCP++) = cMinChar;
*(pCP++) = cMaxChar + 1;
pStartGlyphs[i] = nGlyphId;