@@ -2409,6 +2409,10 @@ var Font = (function FontClosure() {
2409
2409
// Repair the TrueType file. It is can be damaged in the point of
2410
2410
// view of the sanitizer
2411
2411
data = this .checkAndRepair (name , file , properties );
2412
+ if (!data ) {
2413
+ // TrueType data is not found, e.g. when the font is an OpenType font
2414
+ warn ('Font is not a TrueType font' );
2415
+ }
2412
2416
break ;
2413
2417
2414
2418
default :
@@ -3696,6 +3700,8 @@ var Font = (function FontClosure() {
3696
3700
prep = table ;
3697
3701
else if (table .tag == 'cvt ' )
3698
3702
cvt = table ;
3703
+ else if (table .tag == 'CFF ' )
3704
+ return null ; // XXX: OpenType font is found, stopping
3699
3705
else // skipping table if it's not a required or optional table
3700
3706
continue ;
3701
3707
}
@@ -5257,13 +5263,18 @@ Type1Font.prototype = {
5257
5263
getOrderedCharStrings : function Type1Font_getOrderedCharStrings (glyphs ,
5258
5264
properties ) {
5259
5265
var charstrings = [];
5266
+ var usedUnicodes = [];
5260
5267
var i , length , glyphName ;
5261
5268
var unusedUnicode = CMAP_GLYPH_OFFSET ;
5262
5269
for (i = 0 , length = glyphs .length ; i < length ; i ++) {
5263
5270
var item = glyphs [i ];
5264
5271
var glyphName = item .glyph ;
5265
5272
var unicode = glyphName in GlyphsUnicode ?
5266
5273
GlyphsUnicode [glyphName ] : unusedUnicode ++;
5274
+ while (usedUnicodes [unicode ]) {
5275
+ unicode = unusedUnicode ++;
5276
+ }
5277
+ usedUnicodes [unicode ] = true ;
5267
5278
charstrings .push ({
5268
5279
glyph : glyphName ,
5269
5280
unicode : unicode ,
0 commit comments