r16455 by jghali - #9842: Crash when using Gabriola Regular font
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 17 22:17:09 CET 2011
Author: jghali
Date: Thu Mar 17 21:17:09 2011
New Revision: 16455
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16455
Log:
#9842: Crash when using Gabriola Regular font
Modified:
branches/Version135/Scribus/scribus/fonts/scface_ttf.cpp
Modified: branches/Version135/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16455&path=/branches/Version135/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/fonts/scface_ttf.cpp (original)
+++ branches/Version135/Scribus/scribus/fonts/scface_ttf.cpp Thu Mar 17 21:17:09 2011
@@ -139,6 +139,7 @@
{
quint16 GlyphCount ( toUint16 ( Coverage_Offset + 2 ) );
quint16 GlyphID ( Coverage_Offset + 4 );
+ if (GlyphCount == 0) continue;
for ( unsigned int gl ( 0 ); gl < GlyphCount; ++gl )
{
@@ -148,6 +149,7 @@
else if ( 2 == CoverageFormat ) // Coverage Format2 => ranges based
{
quint16 RangeCount ( toUint16 ( Coverage_Offset + 2 ) );
+ if (RangeCount == 0) continue;
// int gl_base ( 0 );
for ( int r ( 0 ); r < RangeCount; ++r )
@@ -156,8 +158,18 @@
quint16 Start ( toUint16 ( rBase ) );
quint16 End ( toUint16 ( rBase + 2 ) );
// quint16 StartCoverageIndex ( toUint16 ( rBase + 4 ) );
- for ( unsigned int gl ( Start ); gl <= End; ++gl )
- coverages[SubTable] << gl;
+ // #9842 : for some font such as Gabriola Regular
+ // the range maybe be specified in reverse order
+ if (Start <= End)
+ {
+ for ( unsigned int gl ( Start ); gl <= End; ++gl )
+ coverages[SubTable] << gl;
+ }
+ else
+ {
+ for ( unsigned int gl ( Start ); gl >= End; --gl )
+ coverages[SubTable] << gl;
+ }
}
}
else
More information about the scribus-commit
mailing list