@@ -2484,6 +2484,10 @@ var Font = (function FontClosure() {
2484
2484
// Repair the TrueType file. It is can be damaged in the point of
2485
2485
// view of the sanitizer
2486
2486
data = this .checkAndRepair (name , file , properties );
2487
+ if (!data ) {
2488
+ // TrueType data is not found, e.g. when the font is an OpenType font
2489
+ warn ('Font is not a TrueType font' );
2490
+ }
2487
2491
break ;
2488
2492
2489
2493
default :
@@ -3830,6 +3834,8 @@ var Font = (function FontClosure() {
3830
3834
prep = table ;
3831
3835
else if (table .tag == 'cvt ' )
3832
3836
cvt = table ;
3837
+ else if (table .tag == 'CFF ' )
3838
+ return null ; // XXX: OpenType font is found, stopping
3833
3839
else // skipping table if it's not a required or optional table
3834
3840
continue ;
3835
3841
}
@@ -5463,13 +5469,18 @@ Type1Font.prototype = {
5463
5469
getOrderedCharStrings : function Type1Font_getOrderedCharStrings (glyphs ,
5464
5470
properties ) {
5465
5471
var charstrings = [];
5472
+ var usedUnicodes = [];
5466
5473
var i , length , glyphName ;
5467
5474
var unusedUnicode = CMAP_GLYPH_OFFSET ;
5468
5475
for (i = 0 , length = glyphs .length ; i < length ; i ++) {
5469
5476
var item = glyphs [i ];
5470
5477
var glyphName = item .glyph ;
5471
5478
var unicode = glyphName in GlyphsUnicode ?
5472
5479
GlyphsUnicode [glyphName ] : unusedUnicode ++;
5480
+ while (usedUnicodes [unicode ]) {
5481
+ unicode = unusedUnicode ++;
5482
+ }
5483
+ usedUnicodes [unicode ] = true ;
5473
5484
charstrings .push ({
5474
5485
glyph : glyphName ,
5475
5486
unicode : unicode ,
0 commit comments