File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2938,6 +2938,7 @@ var Font = (function FontClosure() {
2938
2938
}
2939
2939
this .toFontChar = toFontChar ;
2940
2940
}
2941
+ var unitsPerEm = properties .unitsPerEm || 1000 ; // defaulting to 1000
2941
2942
2942
2943
var fields = {
2943
2944
// PostScript Font Program
@@ -2958,7 +2959,7 @@ var Font = (function FontClosure() {
2958
2959
'\x00\x00\x00\x00' + // checksumAdjustement
2959
2960
'\x5F\x0F\x3C\xF5' + // magicNumber
2960
2961
'\x00\x00' + // Flags
2961
- '\x03\xE8' + // unitsPerEM (defaulting to 1000)
2962
+ safeString16 ( unitsPerEm ) + // unitsPerEM
2962
2963
'\x00\x00\x00\x00\x9e\x0b\x7e\x27' + // creation date
2963
2964
'\x00\x00\x00\x00\x9e\x0b\x7e\x27' + // modifification date
2964
2965
'\x00\x00' + // xMin
@@ -4413,6 +4414,12 @@ var CFFParser = (function CFFParserClosure() {
4413
4414
var charStringOffset = topDict .getByName ('CharStrings' );
4414
4415
cff .charStrings = this .parseCharStrings (charStringOffset );
4415
4416
4417
+ var fontMatrix = topDict .getByName ('FontMatrix' );
4418
+ if (fontMatrix ) {
4419
+ // estimating unitsPerEM for the font
4420
+ properties .unitsPerEm = 1 / fontMatrix [0 ];
4421
+ }
4422
+
4416
4423
var charset , encoding ;
4417
4424
if (cff .isCIDFont ) {
4418
4425
var fdArrayIndex = this .parseIndex (topDict .getByName ('FDArray' )).obj ;
You can’t perform that action at this time.
0 commit comments