@ -515,7 +515,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -515,7 +515,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
var self = this ;
return this . loadFont ( fontName , fontRef , this . xref , resources ) . then (
return this . loadFont ( fontName , fontRef , resources ) . then (
function ( translated ) {
if ( ! translated . font . isType3Font ) {
return translated ;
@ -572,7 +572,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -572,7 +572,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
setGState : function PartialEvaluator _setGState ( resources , gState ,
operatorList , task ,
xref , stateManager ) {
stateManager ) {
// This array holds the converted/processed state data.
var gStateObj = [ ] ;
var gStateKeys = gState . getKeys ( ) ;
@ -655,14 +655,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -655,14 +655,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} ) ;
} ,
loadFont : function PartialEvaluator _loadFont ( fontName , font , xref ,
resources ) {
loadFont : function PartialEvaluator _loadFont ( fontName , font , resources ) {
function errorFont ( ) {
return Promise . resolve ( new TranslatedFont ( 'g_font_error' ,
new ErrorFont ( 'Font ' + fontName + ' is not available' ) , font ) ) ;
}
var fontRef ;
var fontRef , xref = this . xref ;
if ( font ) { // Loading by ref.
assert ( isRef ( font ) ) ;
fontRef = font ;
@ -697,7 +696,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -697,7 +696,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var fontCapability = createPromiseCapability ( ) ;
var preEvaluatedFont = this . preEvaluateFont ( font , xref ) ;
var preEvaluatedFont = this . preEvaluateFont ( font ) ;
var descriptor = preEvaluatedFont . descriptor ;
var fontRefIsRef = isRef ( fontRef ) , fontID ;
@ -767,7 +766,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -767,7 +766,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// TODO move promises into translate font
var translatedPromise ;
try {
translatedPromise = this . translateFont ( preEvaluatedFont , xref ) ;
translatedPromise = this . translateFont ( preEvaluatedFont ) ;
} catch ( e ) {
translatedPromise = Promise . reject ( e ) ;
}
@ -821,7 +820,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -821,7 +820,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} ,
handleColorN : function PartialEvaluator _handleColorN ( operatorList , fn , args ,
cs , patterns , resources , task , xref ) {
cs , patterns ,
resources , task ) {
// compile tiling patterns
var patternName = args [ args . length - 1 ] ;
// SCN/scn applies patterns along with normal colors
@ -838,7 +838,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -838,7 +838,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} else if ( typeNum === SHADING _PATTERN ) {
var shading = dict . get ( 'Shading' ) ;
var matrix = dict . getArray ( 'Matrix' ) ;
pattern = Pattern . parseShading ( shading , matrix , xref , resources ,
pattern = Pattern . parseShading ( shading , matrix , this . xref , resources ,
this . handler ) ;
operatorList . addOp ( fn , pattern . getIR ( ) ) ;
return Promise . resolve ( ) ;
@ -1052,7 +1052,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1052,7 +1052,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
cs = stateManager . state . fillColorSpace ;
if ( cs . name === 'Pattern' ) {
next ( self . handleColorN ( operatorList , OPS . setFillColorN , args ,
cs , patterns , resources , task , xref ) ) ;
cs , patterns , resources , task ) ) ;
return ;
}
args = cs . getRgb ( args , 0 ) ;
@ -1062,7 +1062,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1062,7 +1062,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
cs = stateManager . state . strokeColorSpace ;
if ( cs . name === 'Pattern' ) {
next ( self . handleColorN ( operatorList , OPS . setStrokeColorN , args ,
cs , patterns , resources , task , xref ) ) ;
cs , patterns , resources , task ) ) ;
return ;
}
args = cs . getRgb ( args , 0 ) ;
@ -1091,7 +1091,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1091,7 +1091,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
var gState = extGState . get ( dictName . name ) ;
next ( self . setGState ( resources , gState , operatorList , task , xref ,
next ( self . setGState ( resources , gState , operatorList , task ,
stateManager ) ) ;
return ;
case OPS . moveTo :
@ -1299,7 +1299,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1299,7 +1299,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
function handleSetFont ( fontName , fontRef ) {
return self . loadFont ( fontName , fontRef , xref , resources ) .
return self . loadFont ( fontName , fontRef , resources ) .
then ( function ( translated ) {
textState . font = translated . font ;
textState . fontMatrix = translated . font . fontMatrix ||
@ -1667,7 +1667,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1667,7 +1667,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
extractDataStructures :
function PartialEvaluator _extractDataStructures ( dict , baseDict ,
xref , properties ) {
properties ) {
var xref = this . xref ;
// 9.10.2
var toUnicode = ( dict . get ( 'ToUnicode' ) || baseDict . get ( 'ToUnicode' ) ) ;
var toUnicodePromise = toUnicode ?
@ -1982,9 +1983,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -1982,9 +1983,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
return result ;
} ,
extractWidths : function PartialEvaluator _extractWidths ( dict , xref ,
descriptor ,
extractWidths : function PartialEvaluator _extractWidths ( dict , descriptor ,
properties ) {
var xref = this . xref ;
var glyphsWidths = [ ] ;
var defaultWidth = 0 ;
var glyphsVMetrics = [ ] ;
@ -2149,7 +2150,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -2149,7 +2150,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
return widths ;
} ,
preEvaluateFont : function PartialEvaluator _preEvaluateFont ( dict , xref ) {
preEvaluateFont : function PartialEvaluator _preEvaluateFont ( dict ) {
var baseDict = dict ;
var type = dict . get ( 'Subtype' ) ;
assert ( isName ( type ) , 'invalid font Subtype' ) ;
@ -2163,7 +2164,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -2163,7 +2164,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// - get the FontDescriptor from the descendant font
var df = dict . get ( 'DescendantFonts' ) ;
assert ( df , 'Descendant fonts are not specified' ) ;
dict = ( isArray ( df ) ? xref . fetchIfRef ( df [ 0 ] ) : df ) ;
dict = ( isArray ( df ) ? this . xref . fetchIfRef ( df [ 0 ] ) : df ) ;
type = dict . get ( 'Subtype' ) ;
assert ( isName ( type ) , 'invalid font Subtype' ) ;
@ -2233,8 +2234,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -2233,8 +2234,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} ;
} ,
translateFont : function PartialEvaluator _translateFont ( preEvaluatedFont ,
xref ) {
translateFont : function PartialEvaluator _translateFont ( preEvaluatedFont ) {
var baseDict = preEvaluatedFont . baseDict ;
var dict = preEvaluatedFont . dict ;
var composite = preEvaluatedFont . composite ;
@ -2278,7 +2278,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -2278,7 +2278,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
firstChar : 0 ,
lastChar : maxCharIndex
} ;
return this . extractDataStructures ( dict , dict , xref , properties ) . then (
return this . extractDataStructures ( dict , dict , properties ) . then (
function ( properties ) {
properties . widths = this . buildCharCodeToWidth ( metrics . widths ,
properties ) ;
@ -2381,9 +2381,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
@@ -2381,9 +2381,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
return cMapPromise . then ( function ( ) {
return this . extractDataStructures ( dict , baseDict , xref , properties ) ;
return this . extractDataStructures ( dict , baseDict , properties ) ;
} . bind ( this ) ) . then ( function ( properties ) {
this . extractWidths ( dict , xref , descriptor , properties ) ;
this . extractWidths ( dict , descriptor , properties ) ;
if ( type === 'Type3' ) {
properties . isType3Font = true ;