Refactor class method names.
Also move functionality to more logical place in canvas.js and jpx.js.
This commit is contained in:
		
							parent
							
								
									921c1e82a3
								
							
						
					
					
						commit
						99440ab691
					
				
							
								
								
									
										274
									
								
								src/canvas.js
									
									
									
									
									
								
							
							
						
						
									
										274
									
								
								src/canvas.js
									
									
									
									
									
								
							@ -20,56 +20,6 @@ var TextRenderingMode = {
 | 
			
		||||
// Minimal font size that would be used during canvas fillText operations.
 | 
			
		||||
var MIN_FONT_SIZE = 1;
 | 
			
		||||
 | 
			
		||||
var CanvasExtraState = (function CanvasExtraStateClosure() {
 | 
			
		||||
  function CanvasExtraState(old) {
 | 
			
		||||
    // Are soft masks and alpha values shapes or opacities?
 | 
			
		||||
    this.alphaIsShape = false;
 | 
			
		||||
    this.fontSize = 0;
 | 
			
		||||
    this.fontSizeScale = 1;
 | 
			
		||||
    this.textMatrix = IDENTITY_MATRIX;
 | 
			
		||||
    this.fontMatrix = IDENTITY_MATRIX;
 | 
			
		||||
    this.leading = 0;
 | 
			
		||||
    // Current point (in user coordinates)
 | 
			
		||||
    this.x = 0;
 | 
			
		||||
    this.y = 0;
 | 
			
		||||
    // Start of text line (in text coordinates)
 | 
			
		||||
    this.lineX = 0;
 | 
			
		||||
    this.lineY = 0;
 | 
			
		||||
    // Character and word spacing
 | 
			
		||||
    this.charSpacing = 0;
 | 
			
		||||
    this.wordSpacing = 0;
 | 
			
		||||
    this.textHScale = 1;
 | 
			
		||||
    this.textRenderingMode = TextRenderingMode.FILL;
 | 
			
		||||
    // Color spaces
 | 
			
		||||
    this.fillColorSpace = new DeviceGrayCS();
 | 
			
		||||
    this.fillColorSpaceObj = null;
 | 
			
		||||
    this.strokeColorSpace = new DeviceGrayCS();
 | 
			
		||||
    this.strokeColorSpaceObj = null;
 | 
			
		||||
    this.fillColorObj = null;
 | 
			
		||||
    this.strokeColorObj = null;
 | 
			
		||||
    // Default fore and background colors
 | 
			
		||||
    this.fillColor = '#000000';
 | 
			
		||||
    this.strokeColor = '#000000';
 | 
			
		||||
    // Note: fill alpha applies to all non-stroking operations
 | 
			
		||||
    this.fillAlpha = 1;
 | 
			
		||||
    this.strokeAlpha = 1;
 | 
			
		||||
    this.lineWidth = 1;
 | 
			
		||||
 | 
			
		||||
    this.old = old;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CanvasExtraState.prototype = {
 | 
			
		||||
    clone: function canvasextra_clone() {
 | 
			
		||||
      return Object.create(this);
 | 
			
		||||
    },
 | 
			
		||||
    setCurrentPoint: function canvasextra_setCurrentPoint(x, y) {
 | 
			
		||||
      this.x = x;
 | 
			
		||||
      this.y = y;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  return CanvasExtraState;
 | 
			
		||||
})();
 | 
			
		||||
 | 
			
		||||
function createScratchCanvas(width, height) {
 | 
			
		||||
  var canvas = document.createElement('canvas');
 | 
			
		||||
  canvas.width = width;
 | 
			
		||||
@ -187,6 +137,56 @@ function addContextCurrentTransform(ctx) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var CanvasExtraState = (function CanvasExtraStateClosure() {
 | 
			
		||||
  function CanvasExtraState(old) {
 | 
			
		||||
    // Are soft masks and alpha values shapes or opacities?
 | 
			
		||||
    this.alphaIsShape = false;
 | 
			
		||||
    this.fontSize = 0;
 | 
			
		||||
    this.fontSizeScale = 1;
 | 
			
		||||
    this.textMatrix = IDENTITY_MATRIX;
 | 
			
		||||
    this.fontMatrix = IDENTITY_MATRIX;
 | 
			
		||||
    this.leading = 0;
 | 
			
		||||
    // Current point (in user coordinates)
 | 
			
		||||
    this.x = 0;
 | 
			
		||||
    this.y = 0;
 | 
			
		||||
    // Start of text line (in text coordinates)
 | 
			
		||||
    this.lineX = 0;
 | 
			
		||||
    this.lineY = 0;
 | 
			
		||||
    // Character and word spacing
 | 
			
		||||
    this.charSpacing = 0;
 | 
			
		||||
    this.wordSpacing = 0;
 | 
			
		||||
    this.textHScale = 1;
 | 
			
		||||
    this.textRenderingMode = TextRenderingMode.FILL;
 | 
			
		||||
    // Color spaces
 | 
			
		||||
    this.fillColorSpace = new DeviceGrayCS();
 | 
			
		||||
    this.fillColorSpaceObj = null;
 | 
			
		||||
    this.strokeColorSpace = new DeviceGrayCS();
 | 
			
		||||
    this.strokeColorSpaceObj = null;
 | 
			
		||||
    this.fillColorObj = null;
 | 
			
		||||
    this.strokeColorObj = null;
 | 
			
		||||
    // Default fore and background colors
 | 
			
		||||
    this.fillColor = '#000000';
 | 
			
		||||
    this.strokeColor = '#000000';
 | 
			
		||||
    // Note: fill alpha applies to all non-stroking operations
 | 
			
		||||
    this.fillAlpha = 1;
 | 
			
		||||
    this.strokeAlpha = 1;
 | 
			
		||||
    this.lineWidth = 1;
 | 
			
		||||
 | 
			
		||||
    this.old = old;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CanvasExtraState.prototype = {
 | 
			
		||||
    clone: function CanvasExtraState_clone() {
 | 
			
		||||
      return Object.create(this);
 | 
			
		||||
    },
 | 
			
		||||
    setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {
 | 
			
		||||
      this.x = x;
 | 
			
		||||
      this.y = y;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  return CanvasExtraState;
 | 
			
		||||
})();
 | 
			
		||||
 | 
			
		||||
var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
  // Defines the time the executeOperatorList is going to be executing
 | 
			
		||||
  // before it stops and shedules a continue of execution.
 | 
			
		||||
@ -241,7 +241,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      'shadingFill': true
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    beginDrawing: function canvasGraphicsBeginDrawing(mediaBox) {
 | 
			
		||||
    beginDrawing: function CanvasGraphics_beginDrawing(mediaBox) {
 | 
			
		||||
      var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height;
 | 
			
		||||
      this.ctx.save();
 | 
			
		||||
      switch (mediaBox.rotate) {
 | 
			
		||||
@ -267,7 +267,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
        this.textLayer.beginLayout();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    executeOperatorList: function canvasGraphicsExecuteOperatorList(
 | 
			
		||||
    executeOperatorList: function CanvasGraphics_executeOperatorList(
 | 
			
		||||
                                    operatorList,
 | 
			
		||||
                                    executionStartIdx, continueCallback,
 | 
			
		||||
                                    stepper) {
 | 
			
		||||
@ -332,7 +332,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    endDrawing: function canvasGraphicsEndDrawing() {
 | 
			
		||||
    endDrawing: function CanvasGraphics_endDrawing() {
 | 
			
		||||
      this.ctx.restore();
 | 
			
		||||
 | 
			
		||||
      if (this.textLayer)
 | 
			
		||||
@ -340,32 +340,32 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Graphics state
 | 
			
		||||
    setLineWidth: function canvasGraphicsSetLineWidth(width) {
 | 
			
		||||
    setLineWidth: function CanvasGraphics_setLineWidth(width) {
 | 
			
		||||
      this.current.lineWidth = width;
 | 
			
		||||
      this.ctx.lineWidth = width;
 | 
			
		||||
    },
 | 
			
		||||
    setLineCap: function canvasGraphicsSetLineCap(style) {
 | 
			
		||||
    setLineCap: function CanvasGraphics_setLineCap(style) {
 | 
			
		||||
      this.ctx.lineCap = LINE_CAP_STYLES[style];
 | 
			
		||||
    },
 | 
			
		||||
    setLineJoin: function canvasGraphicsSetLineJoin(style) {
 | 
			
		||||
    setLineJoin: function CanvasGraphics_setLineJoin(style) {
 | 
			
		||||
      this.ctx.lineJoin = LINE_JOIN_STYLES[style];
 | 
			
		||||
    },
 | 
			
		||||
    setMiterLimit: function canvasGraphicsSetMiterLimit(limit) {
 | 
			
		||||
    setMiterLimit: function CanvasGraphics_setMiterLimit(limit) {
 | 
			
		||||
      this.ctx.miterLimit = limit;
 | 
			
		||||
    },
 | 
			
		||||
    setDash: function canvasGraphicsSetDash(dashArray, dashPhase) {
 | 
			
		||||
    setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {
 | 
			
		||||
      this.ctx.mozDash = dashArray;
 | 
			
		||||
      this.ctx.mozDashOffset = dashPhase;
 | 
			
		||||
      this.ctx.webkitLineDash = dashArray;
 | 
			
		||||
      this.ctx.webkitLineDashOffset = dashPhase;
 | 
			
		||||
    },
 | 
			
		||||
    setRenderingIntent: function canvasGraphicsSetRenderingIntent(intent) {
 | 
			
		||||
    setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {
 | 
			
		||||
      TODO('set rendering intent: ' + intent);
 | 
			
		||||
    },
 | 
			
		||||
    setFlatness: function canvasGraphicsSetFlatness(flatness) {
 | 
			
		||||
    setFlatness: function CanvasGraphics_setFlatness(flatness) {
 | 
			
		||||
      TODO('set flatness: ' + flatness);
 | 
			
		||||
    },
 | 
			
		||||
    setGState: function canvasGraphicsSetGState(states) {
 | 
			
		||||
    setGState: function CanvasGraphics_setGState(states) {
 | 
			
		||||
      for (var i = 0, ii = states.length; i < ii; i++) {
 | 
			
		||||
        var state = states[i];
 | 
			
		||||
        var key = state[0];
 | 
			
		||||
@ -406,52 +406,52 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    save: function canvasGraphicsSave() {
 | 
			
		||||
    save: function CanvasGraphics_save() {
 | 
			
		||||
      this.ctx.save();
 | 
			
		||||
      var old = this.current;
 | 
			
		||||
      this.stateStack.push(old);
 | 
			
		||||
      this.current = old.clone();
 | 
			
		||||
    },
 | 
			
		||||
    restore: function canvasGraphicsRestore() {
 | 
			
		||||
    restore: function CanvasGraphics_restore() {
 | 
			
		||||
      var prev = this.stateStack.pop();
 | 
			
		||||
      if (prev) {
 | 
			
		||||
        this.current = prev;
 | 
			
		||||
        this.ctx.restore();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    transform: function canvasGraphicsTransform(a, b, c, d, e, f) {
 | 
			
		||||
    transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
 | 
			
		||||
      this.ctx.transform(a, b, c, d, e, f);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Path
 | 
			
		||||
    moveTo: function canvasGraphicsMoveTo(x, y) {
 | 
			
		||||
    moveTo: function CanvasGraphics_moveTo(x, y) {
 | 
			
		||||
      this.ctx.moveTo(x, y);
 | 
			
		||||
      this.current.setCurrentPoint(x, y);
 | 
			
		||||
    },
 | 
			
		||||
    lineTo: function canvasGraphicsLineTo(x, y) {
 | 
			
		||||
    lineTo: function CanvasGraphics_lineTo(x, y) {
 | 
			
		||||
      this.ctx.lineTo(x, y);
 | 
			
		||||
      this.current.setCurrentPoint(x, y);
 | 
			
		||||
    },
 | 
			
		||||
    curveTo: function canvasGraphicsCurveTo(x1, y1, x2, y2, x3, y3) {
 | 
			
		||||
    curveTo: function CanvasGraphics_curveTo(x1, y1, x2, y2, x3, y3) {
 | 
			
		||||
      this.ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
 | 
			
		||||
      this.current.setCurrentPoint(x3, y3);
 | 
			
		||||
    },
 | 
			
		||||
    curveTo2: function canvasGraphicsCurveTo2(x2, y2, x3, y3) {
 | 
			
		||||
    curveTo2: function CanvasGraphics_curveTo2(x2, y2, x3, y3) {
 | 
			
		||||
      var current = this.current;
 | 
			
		||||
      this.ctx.bezierCurveTo(current.x, current.y, x2, y2, x3, y3);
 | 
			
		||||
      current.setCurrentPoint(x3, y3);
 | 
			
		||||
    },
 | 
			
		||||
    curveTo3: function canvasGraphicsCurveTo3(x1, y1, x3, y3) {
 | 
			
		||||
    curveTo3: function CanvasGraphics_curveTo3(x1, y1, x3, y3) {
 | 
			
		||||
      this.curveTo(x1, y1, x3, y3, x3, y3);
 | 
			
		||||
      this.current.setCurrentPoint(x3, y3);
 | 
			
		||||
    },
 | 
			
		||||
    closePath: function canvasGraphicsClosePath() {
 | 
			
		||||
    closePath: function CanvasGraphics_closePath() {
 | 
			
		||||
      this.ctx.closePath();
 | 
			
		||||
    },
 | 
			
		||||
    rectangle: function canvasGraphicsRectangle(x, y, width, height) {
 | 
			
		||||
    rectangle: function CanvasGraphics_rectangle(x, y, width, height) {
 | 
			
		||||
      this.ctx.rect(x, y, width, height);
 | 
			
		||||
    },
 | 
			
		||||
    stroke: function canvasGraphicsStroke(consumePath) {
 | 
			
		||||
    stroke: function CanvasGraphics_stroke(consumePath) {
 | 
			
		||||
      consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var strokeColor = this.current.strokeColor;
 | 
			
		||||
@ -476,11 +476,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      // Restore the global alpha to the fill alpha
 | 
			
		||||
      ctx.globalAlpha = this.current.fillAlpha;
 | 
			
		||||
    },
 | 
			
		||||
    closeStroke: function canvasGraphicsCloseStroke() {
 | 
			
		||||
    closeStroke: function CanvasGraphics_closeStroke() {
 | 
			
		||||
      this.closePath();
 | 
			
		||||
      this.stroke();
 | 
			
		||||
    },
 | 
			
		||||
    fill: function canvasGraphicsFill(consumePath) {
 | 
			
		||||
    fill: function CanvasGraphics_fill(consumePath) {
 | 
			
		||||
      consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var fillColor = this.current.fillColor;
 | 
			
		||||
@ -497,65 +497,65 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      if (consumePath)
 | 
			
		||||
        this.consumePath();
 | 
			
		||||
    },
 | 
			
		||||
    eoFill: function canvasGraphicsEoFill() {
 | 
			
		||||
    eoFill: function CanvasGraphics_eoFill() {
 | 
			
		||||
      var savedFillRule = this.setEOFillRule();
 | 
			
		||||
      this.fill();
 | 
			
		||||
      this.restoreFillRule(savedFillRule);
 | 
			
		||||
    },
 | 
			
		||||
    fillStroke: function canvasGraphicsFillStroke() {
 | 
			
		||||
    fillStroke: function CanvasGraphics_fillStroke() {
 | 
			
		||||
      this.fill(false);
 | 
			
		||||
      this.stroke(false);
 | 
			
		||||
 | 
			
		||||
      this.consumePath();
 | 
			
		||||
    },
 | 
			
		||||
    eoFillStroke: function canvasGraphicsEoFillStroke() {
 | 
			
		||||
    eoFillStroke: function CanvasGraphics_eoFillStroke() {
 | 
			
		||||
      var savedFillRule = this.setEOFillRule();
 | 
			
		||||
      this.fillStroke();
 | 
			
		||||
      this.restoreFillRule(savedFillRule);
 | 
			
		||||
    },
 | 
			
		||||
    closeFillStroke: function canvasGraphicsCloseFillStroke() {
 | 
			
		||||
    closeFillStroke: function CanvasGraphics_closeFillStroke() {
 | 
			
		||||
      this.closePath();
 | 
			
		||||
      this.fillStroke();
 | 
			
		||||
    },
 | 
			
		||||
    closeEOFillStroke: function canvasGraphicsCloseEOFillStroke() {
 | 
			
		||||
    closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() {
 | 
			
		||||
      var savedFillRule = this.setEOFillRule();
 | 
			
		||||
      this.closePath();
 | 
			
		||||
      this.fillStroke();
 | 
			
		||||
      this.restoreFillRule(savedFillRule);
 | 
			
		||||
    },
 | 
			
		||||
    endPath: function canvasGraphicsEndPath() {
 | 
			
		||||
    endPath: function CanvasGraphics_endPath() {
 | 
			
		||||
      this.consumePath();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Clipping
 | 
			
		||||
    clip: function canvasGraphicsClip() {
 | 
			
		||||
    clip: function CanvasGraphics_clip() {
 | 
			
		||||
      this.pendingClip = NORMAL_CLIP;
 | 
			
		||||
    },
 | 
			
		||||
    eoClip: function canvasGraphicsEoClip() {
 | 
			
		||||
    eoClip: function CanvasGraphics_eoClip() {
 | 
			
		||||
      this.pendingClip = EO_CLIP;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Text
 | 
			
		||||
    beginText: function canvasGraphicsBeginText() {
 | 
			
		||||
    beginText: function CanvasGraphics_beginText() {
 | 
			
		||||
      this.current.textMatrix = IDENTITY_MATRIX;
 | 
			
		||||
      this.current.x = this.current.lineX = 0;
 | 
			
		||||
      this.current.y = this.current.lineY = 0;
 | 
			
		||||
    },
 | 
			
		||||
    endText: function canvasGraphicsEndText() {
 | 
			
		||||
    endText: function CanvasGraphics_endText() {
 | 
			
		||||
    },
 | 
			
		||||
    setCharSpacing: function canvasGraphicsSetCharSpacing(spacing) {
 | 
			
		||||
    setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) {
 | 
			
		||||
      this.current.charSpacing = spacing;
 | 
			
		||||
    },
 | 
			
		||||
    setWordSpacing: function canvasGraphicsSetWordSpacing(spacing) {
 | 
			
		||||
    setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) {
 | 
			
		||||
      this.current.wordSpacing = spacing;
 | 
			
		||||
    },
 | 
			
		||||
    setHScale: function canvasGraphicsSetHScale(scale) {
 | 
			
		||||
    setHScale: function CanvasGraphics_setHScale(scale) {
 | 
			
		||||
      this.current.textHScale = scale / 100;
 | 
			
		||||
    },
 | 
			
		||||
    setLeading: function canvasGraphicsSetLeading(leading) {
 | 
			
		||||
    setLeading: function CanvasGraphics_setLeading(leading) {
 | 
			
		||||
      this.current.leading = -leading;
 | 
			
		||||
    },
 | 
			
		||||
    setFont: function canvasGraphicsSetFont(fontRefName, size) {
 | 
			
		||||
    setFont: function CanvasGraphics_setFont(fontRefName, size) {
 | 
			
		||||
      var fontObj = this.objs.get(fontRefName);
 | 
			
		||||
      var current = this.current;
 | 
			
		||||
 | 
			
		||||
@ -609,32 +609,32 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
 | 
			
		||||
      this.ctx.font = rule;
 | 
			
		||||
    },
 | 
			
		||||
    setTextRenderingMode: function canvasGraphicsSetTextRenderingMode(mode) {
 | 
			
		||||
    setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
 | 
			
		||||
      if (mode >= TextRenderingMode.FILL_ADD_TO_PATH)
 | 
			
		||||
        TODO('unsupported text rendering mode: ' + mode);
 | 
			
		||||
      this.current.textRenderingMode = mode;
 | 
			
		||||
    },
 | 
			
		||||
    setTextRise: function canvasGraphicsSetTextRise(rise) {
 | 
			
		||||
    setTextRise: function CanvasGraphics_setTextRise(rise) {
 | 
			
		||||
      TODO('text rise: ' + rise);
 | 
			
		||||
    },
 | 
			
		||||
    moveText: function canvasGraphicsMoveText(x, y) {
 | 
			
		||||
    moveText: function CanvasGraphics_moveText(x, y) {
 | 
			
		||||
      this.current.x = this.current.lineX += x;
 | 
			
		||||
      this.current.y = this.current.lineY += y;
 | 
			
		||||
    },
 | 
			
		||||
    setLeadingMoveText: function canvasGraphicsSetLeadingMoveText(x, y) {
 | 
			
		||||
    setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) {
 | 
			
		||||
      this.setLeading(-y);
 | 
			
		||||
      this.moveText(x, y);
 | 
			
		||||
    },
 | 
			
		||||
    setTextMatrix: function canvasGraphicsSetTextMatrix(a, b, c, d, e, f) {
 | 
			
		||||
    setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) {
 | 
			
		||||
      this.current.textMatrix = [a, b, c, d, e, f];
 | 
			
		||||
 | 
			
		||||
      this.current.x = this.current.lineX = 0;
 | 
			
		||||
      this.current.y = this.current.lineY = 0;
 | 
			
		||||
    },
 | 
			
		||||
    nextLine: function canvasGraphicsNextLine() {
 | 
			
		||||
    nextLine: function CanvasGraphics_nextLine() {
 | 
			
		||||
      this.moveText(0, this.current.leading);
 | 
			
		||||
    },
 | 
			
		||||
    applyTextTransforms: function canvasApplyTransforms() {
 | 
			
		||||
    applyTextTransforms: function CanvasGraphics_applyTextTransforms() {
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var current = this.current;
 | 
			
		||||
      var textHScale = current.textHScale;
 | 
			
		||||
@ -646,7 +646,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      ctx.transform.apply(ctx, fontMatrix);
 | 
			
		||||
      ctx.scale(textHScale, 1);
 | 
			
		||||
    },
 | 
			
		||||
    getTextGeometry: function canvasGetTextGeometry() {
 | 
			
		||||
    getTextGeometry: function CanvasGraphics_getTextGeometry() {
 | 
			
		||||
      var geometry = {};
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var font = this.current.font;
 | 
			
		||||
@ -663,7 +663,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      return geometry;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    showText: function canvasGraphicsShowText(str, skipTextSelection) {
 | 
			
		||||
    showText: function CanvasGraphics_showText(str, skipTextSelection) {
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var current = this.current;
 | 
			
		||||
      var font = current.font;
 | 
			
		||||
@ -801,7 +801,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
 | 
			
		||||
      return text;
 | 
			
		||||
    },
 | 
			
		||||
    showSpacedText: function canvasGraphicsShowSpacedText(arr) {
 | 
			
		||||
    showSpacedText: function CanvasGraphics_showSpacedText(arr) {
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
      var current = this.current;
 | 
			
		||||
      var font = current.font;
 | 
			
		||||
@ -865,12 +865,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      if (textSelection)
 | 
			
		||||
        this.textLayer.appendText(text, font.loadedName, fontSize);
 | 
			
		||||
    },
 | 
			
		||||
    nextLineShowText: function canvasGraphicsNextLineShowText(text) {
 | 
			
		||||
    nextLineShowText: function CanvasGraphics_nextLineShowText(text) {
 | 
			
		||||
      this.nextLine();
 | 
			
		||||
      this.showText(text);
 | 
			
		||||
    },
 | 
			
		||||
    nextLineSetSpacingShowText:
 | 
			
		||||
      function canvasGraphicsNextLineSetSpacingShowText(wordSpacing,
 | 
			
		||||
      function CanvasGraphics_nextLineSetSpacingShowText(wordSpacing,
 | 
			
		||||
                                                         charSpacing,
 | 
			
		||||
                                                         text) {
 | 
			
		||||
      this.setWordSpacing(wordSpacing);
 | 
			
		||||
@ -879,11 +879,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Type3 fonts
 | 
			
		||||
    setCharWidth: function canvasGraphicsSetCharWidth(xWidth, yWidth) {
 | 
			
		||||
    setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {
 | 
			
		||||
      // We can safely ignore this since the width should be the same
 | 
			
		||||
      // as the width in the Widths array.
 | 
			
		||||
    },
 | 
			
		||||
    setCharWidthAndBounds: function canvasGraphicsSetCharWidthAndBounds(xWidth,
 | 
			
		||||
    setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth,
 | 
			
		||||
                                                                        yWidth,
 | 
			
		||||
                                                                        llx,
 | 
			
		||||
                                                                        lly,
 | 
			
		||||
@ -897,20 +897,20 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Color
 | 
			
		||||
    setStrokeColorSpace: function canvasGraphicsSetStrokeColorSpace(raw) {
 | 
			
		||||
    setStrokeColorSpace: function CanvasGraphics_setStrokeColorSpace(raw) {
 | 
			
		||||
      this.current.strokeColorSpace = ColorSpace.fromIR(raw);
 | 
			
		||||
    },
 | 
			
		||||
    setFillColorSpace: function canvasGraphicsSetFillColorSpace(raw) {
 | 
			
		||||
    setFillColorSpace: function CanvasGraphics_setFillColorSpace(raw) {
 | 
			
		||||
      this.current.fillColorSpace = ColorSpace.fromIR(raw);
 | 
			
		||||
    },
 | 
			
		||||
    setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) {
 | 
			
		||||
    setStrokeColor: function CanvasGraphics_setStrokeColor(/*...*/) {
 | 
			
		||||
      var cs = this.current.strokeColorSpace;
 | 
			
		||||
      var rgbColor = cs.getRgb(arguments);
 | 
			
		||||
      var color = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
 | 
			
		||||
      this.ctx.strokeStyle = color;
 | 
			
		||||
      this.current.strokeColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    getColorN_Pattern: function canvasGraphicsGetColorN_Pattern(IR, cs) {
 | 
			
		||||
    getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR, cs) {
 | 
			
		||||
      if (IR[0] == 'TilingPattern') {
 | 
			
		||||
        var args = IR[1];
 | 
			
		||||
        var base = cs.base;
 | 
			
		||||
@ -932,7 +932,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return pattern;
 | 
			
		||||
    },
 | 
			
		||||
    setStrokeColorN: function canvasGraphicsSetStrokeColorN(/*...*/) {
 | 
			
		||||
    setStrokeColorN: function CanvasGraphics_setStrokeColorN(/*...*/) {
 | 
			
		||||
      var cs = this.current.strokeColorSpace;
 | 
			
		||||
 | 
			
		||||
      if (cs.name == 'Pattern') {
 | 
			
		||||
@ -941,14 +941,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
        this.setStrokeColor.apply(this, arguments);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    setFillColor: function canvasGraphicsSetFillColor(/*...*/) {
 | 
			
		||||
    setFillColor: function CanvasGraphics_setFillColor(/*...*/) {
 | 
			
		||||
      var cs = this.current.fillColorSpace;
 | 
			
		||||
      var rgbColor = cs.getRgb(arguments);
 | 
			
		||||
      var color = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
 | 
			
		||||
      this.ctx.fillStyle = color;
 | 
			
		||||
      this.current.fillColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setFillColorN: function canvasGraphicsSetFillColorN(/*...*/) {
 | 
			
		||||
    setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) {
 | 
			
		||||
      var cs = this.current.fillColorSpace;
 | 
			
		||||
 | 
			
		||||
      if (cs.name == 'Pattern') {
 | 
			
		||||
@ -957,7 +957,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
        this.setFillColor.apply(this, arguments);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
 | 
			
		||||
    setStrokeGray: function CanvasGraphics_setStrokeGray(gray) {
 | 
			
		||||
      if (!(this.current.strokeColorSpace instanceof DeviceGrayCS))
 | 
			
		||||
        this.current.strokeColorSpace = new DeviceGrayCS();
 | 
			
		||||
 | 
			
		||||
@ -965,7 +965,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.ctx.strokeStyle = color;
 | 
			
		||||
      this.current.strokeColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setFillGray: function canvasGraphicsSetFillGray(gray) {
 | 
			
		||||
    setFillGray: function CanvasGraphics_setFillGray(gray) {
 | 
			
		||||
      if (!(this.current.fillColorSpace instanceof DeviceGrayCS))
 | 
			
		||||
        this.current.fillColorSpace = new DeviceGrayCS();
 | 
			
		||||
 | 
			
		||||
@ -973,7 +973,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.ctx.fillStyle = color;
 | 
			
		||||
      this.current.fillColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
 | 
			
		||||
    setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {
 | 
			
		||||
      if (!(this.current.strokeColorSpace instanceof DeviceRgbCS))
 | 
			
		||||
        this.current.strokeColorSpace = new DeviceRgbCS();
 | 
			
		||||
 | 
			
		||||
@ -981,7 +981,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.ctx.strokeStyle = color;
 | 
			
		||||
      this.current.strokeColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
 | 
			
		||||
    setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {
 | 
			
		||||
      if (!(this.current.fillColorSpace instanceof DeviceRgbCS))
 | 
			
		||||
        this.current.fillColorSpace = new DeviceRgbCS();
 | 
			
		||||
 | 
			
		||||
@ -989,7 +989,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.ctx.fillStyle = color;
 | 
			
		||||
      this.current.fillColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
 | 
			
		||||
    setStrokeCMYKColor: function CanvasGraphics_setStrokeCMYKColor(c, m, y, k) {
 | 
			
		||||
      if (!(this.current.strokeColorSpace instanceof DeviceCmykCS))
 | 
			
		||||
        this.current.strokeColorSpace = new DeviceCmykCS();
 | 
			
		||||
 | 
			
		||||
@ -997,7 +997,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.ctx.strokeStyle = color;
 | 
			
		||||
      this.current.strokeColor = color;
 | 
			
		||||
    },
 | 
			
		||||
    setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
 | 
			
		||||
    setFillCMYKColor: function CanvasGraphics_setFillCMYKColor(c, m, y, k) {
 | 
			
		||||
      if (!(this.current.fillColorSpace instanceof DeviceCmykCS))
 | 
			
		||||
        this.current.fillColorSpace = new DeviceCmykCS();
 | 
			
		||||
 | 
			
		||||
@ -1006,7 +1006,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.current.fillColor = color;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    shadingFill: function canvasGraphicsShadingFill(patternIR) {
 | 
			
		||||
    shadingFill: function CanvasGraphics_shadingFill(patternIR) {
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
 | 
			
		||||
      this.save();
 | 
			
		||||
@ -1043,14 +1043,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Images
 | 
			
		||||
    beginInlineImage: function canvasGraphicsBeginInlineImage() {
 | 
			
		||||
    beginInlineImage: function CanvasGraphics_beginInlineImage() {
 | 
			
		||||
      error('Should not call beginInlineImage');
 | 
			
		||||
    },
 | 
			
		||||
    beginImageData: function canvasGraphicsBeginImageData() {
 | 
			
		||||
    beginImageData: function CanvasGraphics_beginImageData() {
 | 
			
		||||
      error('Should not call beginImageData');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    paintFormXObjectBegin: function canvasGraphicsPaintFormXObjectBegin(matrix,
 | 
			
		||||
    paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix,
 | 
			
		||||
                                                                        bbox) {
 | 
			
		||||
      this.save();
 | 
			
		||||
 | 
			
		||||
@ -1066,11 +1066,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    paintFormXObjectEnd: function canvasGraphicsPaintFormXObjectEnd() {
 | 
			
		||||
    paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
 | 
			
		||||
      this.restore();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    paintJpegXObject: function canvasGraphicsPaintJpegXObject(objId, w, h) {
 | 
			
		||||
    paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {
 | 
			
		||||
      var domImage = this.objs.get(objId);
 | 
			
		||||
      if (!domImage) {
 | 
			
		||||
        error('Dependent image isn\'t ready yet');
 | 
			
		||||
@ -1088,7 +1088,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.restore();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    paintImageMaskXObject: function canvasGraphicsPaintImageMaskXObject(
 | 
			
		||||
    paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(
 | 
			
		||||
                             imgArray, inverseDecode, width, height) {
 | 
			
		||||
      function applyStencilMask(buffer, inverseDecode) {
 | 
			
		||||
        var imgArrayPos = 0;
 | 
			
		||||
@ -1137,7 +1137,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.restore();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    paintImageXObject: function canvasGraphicsPaintImageXObject(objId) {
 | 
			
		||||
    paintImageXObject: function CanvasGraphics_paintImageXObject(objId) {
 | 
			
		||||
      var imgData = this.objs.get(objId);
 | 
			
		||||
      if (!imgData)
 | 
			
		||||
        error('Dependent image isn\'t ready yet');
 | 
			
		||||
@ -1157,41 +1157,41 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
      this.restore();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    putBinaryImageData: function canvasPutBinaryImageData() {
 | 
			
		||||
    putBinaryImageData: function CanvasGraphics_putBinaryImageData() {
 | 
			
		||||
      //
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Marked content
 | 
			
		||||
 | 
			
		||||
    markPoint: function canvasGraphicsMarkPoint(tag) {
 | 
			
		||||
    markPoint: function CanvasGraphics_markPoint(tag) {
 | 
			
		||||
      TODO('Marked content');
 | 
			
		||||
    },
 | 
			
		||||
    markPointProps: function canvasGraphicsMarkPointProps(tag, properties) {
 | 
			
		||||
    markPointProps: function CanvasGraphics_markPointProps(tag, properties) {
 | 
			
		||||
      TODO('Marked content');
 | 
			
		||||
    },
 | 
			
		||||
    beginMarkedContent: function canvasGraphicsBeginMarkedContent(tag) {
 | 
			
		||||
    beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {
 | 
			
		||||
      TODO('Marked content');
 | 
			
		||||
    },
 | 
			
		||||
    beginMarkedContentProps:
 | 
			
		||||
      function canvasGraphicsBeginMarkedContentProps(tag, properties) {
 | 
			
		||||
    beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(
 | 
			
		||||
                                        tag, properties) {
 | 
			
		||||
      TODO('Marked content');
 | 
			
		||||
    },
 | 
			
		||||
    endMarkedContent: function canvasGraphicsEndMarkedContent() {
 | 
			
		||||
    endMarkedContent: function CanvasGraphics_endMarkedContent() {
 | 
			
		||||
      TODO('Marked content');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Compatibility
 | 
			
		||||
 | 
			
		||||
    beginCompat: function canvasGraphicsBeginCompat() {
 | 
			
		||||
    beginCompat: function CanvasGraphics_beginCompat() {
 | 
			
		||||
      TODO('ignore undefined operators (should we do that anyway?)');
 | 
			
		||||
    },
 | 
			
		||||
    endCompat: function canvasGraphicsEndCompat() {
 | 
			
		||||
    endCompat: function CanvasGraphics_endCompat() {
 | 
			
		||||
      TODO('stop ignoring undefined operators');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Helper functions
 | 
			
		||||
 | 
			
		||||
    consumePath: function canvasGraphicsConsumePath() {
 | 
			
		||||
    consumePath: function CanvasGraphics_consumePath() {
 | 
			
		||||
      if (this.pendingClip) {
 | 
			
		||||
        var savedFillRule = null;
 | 
			
		||||
        if (this.pendingClip == EO_CLIP)
 | 
			
		||||
@ -1208,15 +1208,15 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
			
		||||
    // We generally keep the canvas context set for
 | 
			
		||||
    // nonzero-winding, and just set evenodd for the operations
 | 
			
		||||
    // that need them.
 | 
			
		||||
    setEOFillRule: function canvasGraphicsSetEOFillRule() {
 | 
			
		||||
    setEOFillRule: function CanvasGraphics_setEOFillRule() {
 | 
			
		||||
      var savedFillRule = this.ctx.mozFillRule;
 | 
			
		||||
      this.ctx.mozFillRule = 'evenodd';
 | 
			
		||||
      return savedFillRule;
 | 
			
		||||
    },
 | 
			
		||||
    restoreFillRule: function canvasGraphicsRestoreFillRule(rule) {
 | 
			
		||||
    restoreFillRule: function CanvasGraphics_restoreFillRule(rule) {
 | 
			
		||||
      this.ctx.mozFillRule = rule;
 | 
			
		||||
    },
 | 
			
		||||
    getSinglePixelWidth: function getSinglePixelWidth(scale) {
 | 
			
		||||
    getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
 | 
			
		||||
      var inverse = this.ctx.mozCurrentTransformInverse;
 | 
			
		||||
      return Math.abs(inverse[0] + inverse[2]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -12,17 +12,17 @@ var ColorSpace = (function ColorSpaceClosure() {
 | 
			
		||||
  ColorSpace.prototype = {
 | 
			
		||||
    // Input: array of size numComps representing color component values
 | 
			
		||||
    // Output: array of rgb values, each value ranging from [0.1]
 | 
			
		||||
    getRgb: function colorSpaceGetRgb(color) {
 | 
			
		||||
    getRgb: function ColorSpace_getRgb(color) {
 | 
			
		||||
      error('Should not call ColorSpace.getRgb: ' + color);
 | 
			
		||||
    },
 | 
			
		||||
    // Input: Uint8Array of component values, each value scaled to [0,255]
 | 
			
		||||
    // Output: Uint8Array of rgb values, each value scaled to [0,255]
 | 
			
		||||
    getRgbBuffer: function colorSpaceGetRgbBuffer(input) {
 | 
			
		||||
    getRgbBuffer: function ColorSpace_getRgbBuffer(input) {
 | 
			
		||||
      error('Should not call ColorSpace.getRgbBuffer: ' + input);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  ColorSpace.parse = function colorSpaceParse(cs, xref, res) {
 | 
			
		||||
  ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
 | 
			
		||||
    var IR = ColorSpace.parseToIR(cs, xref, res);
 | 
			
		||||
    if (IR instanceof AlternateCS)
 | 
			
		||||
      return IR;
 | 
			
		||||
@ -30,7 +30,7 @@ var ColorSpace = (function ColorSpaceClosure() {
 | 
			
		||||
    return ColorSpace.fromIR(IR);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  ColorSpace.fromIR = function colorSpaceFromIR(IR) {
 | 
			
		||||
  ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
 | 
			
		||||
    var name = isArray(IR) ? IR[0] : IR;
 | 
			
		||||
 | 
			
		||||
    switch (name) {
 | 
			
		||||
@ -68,7 +68,7 @@ var ColorSpace = (function ColorSpaceClosure() {
 | 
			
		||||
    return null;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  ColorSpace.parseToIR = function colorSpaceParseToIR(cs, xref, res) {
 | 
			
		||||
  ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
 | 
			
		||||
    if (isName(cs)) {
 | 
			
		||||
      var colorSpaces = xref.fetchIfRef(res.get('ColorSpace'));
 | 
			
		||||
      if (isDict(colorSpaces)) {
 | 
			
		||||
@ -171,7 +171,7 @@ var ColorSpace = (function ColorSpaceClosure() {
 | 
			
		||||
   * @param {Array} decode Decode map (usually from an image).
 | 
			
		||||
   * @param {Number} n Number of components the color space has.
 | 
			
		||||
   */
 | 
			
		||||
  ColorSpace.isDefaultDecode = function colorSpaceIsDefaultDecode(decode, n) {
 | 
			
		||||
  ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
 | 
			
		||||
    if (!decode)
 | 
			
		||||
      return true;
 | 
			
		||||
 | 
			
		||||
@ -207,11 +207,11 @@ var AlternateCS = (function AlternateCSClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  AlternateCS.prototype = {
 | 
			
		||||
    getRgb: function altcs_getRgb(color) {
 | 
			
		||||
    getRgb: function AlternateCS_getRgb(color) {
 | 
			
		||||
      var tinted = this.tintFn(color);
 | 
			
		||||
      return this.base.getRgb(tinted);
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function altcs_getRgbBuffer(input, bits) {
 | 
			
		||||
    getRgbBuffer: function AlternateCS_getRgbBuffer(input, bits) {
 | 
			
		||||
      var tintFn = this.tintFn;
 | 
			
		||||
      var base = this.base;
 | 
			
		||||
      var scale = 1 / ((1 << bits) - 1);
 | 
			
		||||
@ -232,7 +232,7 @@ var AlternateCS = (function AlternateCSClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return base.getRgbBuffer(baseBuf, 8);
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function altcs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -275,7 +275,7 @@ var IndexedCS = (function IndexedCSClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  IndexedCS.prototype = {
 | 
			
		||||
    getRgb: function indexcs_getRgb(color) {
 | 
			
		||||
    getRgb: function IndexedCS_getRgb(color) {
 | 
			
		||||
      var numComps = this.base.numComps;
 | 
			
		||||
      var start = color[0] * numComps;
 | 
			
		||||
      var c = [];
 | 
			
		||||
@ -285,7 +285,7 @@ var IndexedCS = (function IndexedCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return this.base.getRgb(c);
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function indexcs_getRgbBuffer(input) {
 | 
			
		||||
    getRgbBuffer: function IndexedCS_getRgbBuffer(input) {
 | 
			
		||||
      var base = this.base;
 | 
			
		||||
      var numComps = base.numComps;
 | 
			
		||||
      var lookup = this.lookup;
 | 
			
		||||
@ -302,7 +302,7 @@ var IndexedCS = (function IndexedCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return base.getRgbBuffer(baseBuf, 8);
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function indexcs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      // indexed color maps shouldn't be changed
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
@ -318,11 +318,11 @@ var DeviceGrayCS = (function DeviceGrayCSClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  DeviceGrayCS.prototype = {
 | 
			
		||||
    getRgb: function graycs_getRgb(color) {
 | 
			
		||||
    getRgb: function DeviceGrayCS_getRgb(color) {
 | 
			
		||||
      var c = color[0];
 | 
			
		||||
      return [c, c, c];
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function graycs_getRgbBuffer(input, bits) {
 | 
			
		||||
    getRgbBuffer: function DeviceGrayCS_getRgbBuffer(input, bits) {
 | 
			
		||||
      var scale = 255 / ((1 << bits) - 1);
 | 
			
		||||
      var length = input.length;
 | 
			
		||||
      var rgbBuf = new Uint8Array(length * 3);
 | 
			
		||||
@ -334,7 +334,7 @@ var DeviceGrayCS = (function DeviceGrayCSClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return rgbBuf;
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function graycs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -348,10 +348,10 @@ var DeviceRgbCS = (function DeviceRgbCSClosure() {
 | 
			
		||||
    this.defaultColor = [0, 0, 0];
 | 
			
		||||
  }
 | 
			
		||||
  DeviceRgbCS.prototype = {
 | 
			
		||||
    getRgb: function rgbcs_getRgb(color) {
 | 
			
		||||
    getRgb: function DeviceRgbCS_getRgb(color) {
 | 
			
		||||
      return color;
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function rgbcs_getRgbBuffer(input, bits) {
 | 
			
		||||
    getRgbBuffer: function DeviceRgbCS_getRgbBuffer(input, bits) {
 | 
			
		||||
      if (bits == 8)
 | 
			
		||||
        return input;
 | 
			
		||||
      var scale = 255 / ((1 << bits) - 1);
 | 
			
		||||
@ -361,7 +361,7 @@ var DeviceRgbCS = (function DeviceRgbCSClosure() {
 | 
			
		||||
        rgbBuf[i] = (scale * input[i]) | 0;
 | 
			
		||||
      return rgbBuf;
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function rgbcs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -375,7 +375,7 @@ var DeviceCmykCS = (function DeviceCmykCSClosure() {
 | 
			
		||||
    this.defaultColor = [0, 0, 0, 1];
 | 
			
		||||
  }
 | 
			
		||||
  DeviceCmykCS.prototype = {
 | 
			
		||||
    getRgb: function cmykcs_getRgb(color) {
 | 
			
		||||
    getRgb: function DeviceCmykCS_getRgb(color) {
 | 
			
		||||
      var c = color[0], m = color[1], y = color[2], k = color[3];
 | 
			
		||||
 | 
			
		||||
      // CMYK -> CMY: http://www.easyrgb.com/index.php?X=MATH&H=14#text14
 | 
			
		||||
@ -390,7 +390,7 @@ var DeviceCmykCS = (function DeviceCmykCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return [r, g, b];
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function cmykcs_getRgbBuffer(colorBuf, bits) {
 | 
			
		||||
    getRgbBuffer: function DeviceCmykCS_getRgbBuffer(colorBuf, bits) {
 | 
			
		||||
      var scale = 1 / ((1 << bits) - 1);
 | 
			
		||||
      var length = colorBuf.length / 4;
 | 
			
		||||
      var rgbBuf = new Uint8Array(length * 3);
 | 
			
		||||
@ -409,7 +409,7 @@ var DeviceCmykCS = (function DeviceCmykCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return rgbBuf;
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function cmykcs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -473,7 +473,7 @@ var LabCS = (function LabCSClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  LabCS.prototype = {
 | 
			
		||||
    getRgb: function labcs_getRgb(color) {
 | 
			
		||||
    getRgb: function LabCS_getRgb(color) {
 | 
			
		||||
      // Ls,as,bs <---> L*,a*,b* in the spec
 | 
			
		||||
      var Ls = color[0], as = color[1], bs = color[2];
 | 
			
		||||
 | 
			
		||||
@ -499,7 +499,7 @@ var LabCS = (function LabCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return Util.apply3dTransform(XYZtoRGB, [X, Y, Z]);
 | 
			
		||||
    },
 | 
			
		||||
    getRgbBuffer: function labcs_getRgbBuffer(input, bits) {
 | 
			
		||||
    getRgbBuffer: function LabCS_getRgbBuffer(input, bits) {
 | 
			
		||||
      if (bits == 8)
 | 
			
		||||
        return input;
 | 
			
		||||
      var scale = 255 / ((1 << bits) - 1);
 | 
			
		||||
@ -517,7 +517,7 @@ var LabCS = (function LabCSClosure() {
 | 
			
		||||
 | 
			
		||||
      return rgbBuf;
 | 
			
		||||
    },
 | 
			
		||||
    isDefaultDecode: function labcs_isDefaultDecode(decodeMap) {
 | 
			
		||||
    isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
 | 
			
		||||
      // From Table 90 in Adobe's:
 | 
			
		||||
      // "Document management - Portable document format", 1st ed, 2008
 | 
			
		||||
      if (decodeMap[0] === 0 && decodeMap[1] === 100 &&
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										46
									
								
								src/core.js
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								src/core.js
									
									
									
									
									
								
							@ -72,10 +72,10 @@ var Page = (function PageClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Page.prototype = {
 | 
			
		||||
    getPageProp: function pageGetPageProp(key) {
 | 
			
		||||
    getPageProp: function Page_getPageProp(key) {
 | 
			
		||||
      return this.xref.fetchIfRef(this.pageDict.get(key));
 | 
			
		||||
    },
 | 
			
		||||
    inheritPageProp: function pageInheritPageProp(key) {
 | 
			
		||||
    inheritPageProp: function Page_inheritPageProp(key) {
 | 
			
		||||
      var dict = this.pageDict;
 | 
			
		||||
      var obj = dict.get(key);
 | 
			
		||||
      while (obj === undefined) {
 | 
			
		||||
@ -170,8 +170,8 @@ var Page = (function PageClosure() {
 | 
			
		||||
      return shadow(this, 'rotate', rotate);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    startRenderingFromOperatorList: function pageStartRenderingFromOperatorList(
 | 
			
		||||
                                                operatorList, fonts) {
 | 
			
		||||
    startRenderingFromOperatorList:
 | 
			
		||||
      function Page_startRenderingFromOperatorList(operatorList, fonts) {
 | 
			
		||||
      var self = this;
 | 
			
		||||
      this.operatorList = operatorList;
 | 
			
		||||
 | 
			
		||||
@ -190,7 +190,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getOperatorList: function pageGetOperatorList(handler, dependency) {
 | 
			
		||||
    getOperatorList: function Page_getOperatorList(handler, dependency) {
 | 
			
		||||
      if (this.operatorList) {
 | 
			
		||||
        // content was compiled
 | 
			
		||||
        return this.operatorList;
 | 
			
		||||
@ -220,7 +220,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      return this.operatorList;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    ensureFonts: function pageEnsureFonts(fonts, callback) {
 | 
			
		||||
    ensureFonts: function Page_ensureFonts(fonts, callback) {
 | 
			
		||||
      this.stats.time('Font Loading');
 | 
			
		||||
      // Convert the font names to the corresponding font obj.
 | 
			
		||||
      for (var i = 0, ii = fonts.length; i < ii; i++) {
 | 
			
		||||
@ -238,7 +238,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    display: function pageDisplay(gfx, callback) {
 | 
			
		||||
    display: function Page_display(gfx, callback) {
 | 
			
		||||
      var stats = this.stats;
 | 
			
		||||
      stats.time('Rendering');
 | 
			
		||||
      var xref = this.xref;
 | 
			
		||||
@ -276,7 +276,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      next();
 | 
			
		||||
    },
 | 
			
		||||
    rotatePoint: function pageRotatePoint(x, y, reverse) {
 | 
			
		||||
    rotatePoint: function Page_rotatePoint(x, y, reverse) {
 | 
			
		||||
      var rotate = reverse ? (360 - this.rotate) : this.rotate;
 | 
			
		||||
      switch (rotate) {
 | 
			
		||||
        case 180:
 | 
			
		||||
@ -291,7 +291,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
          return {x: x, y: this.height - y};
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getLinks: function pageGetLinks() {
 | 
			
		||||
    getLinks: function Page_getLinks() {
 | 
			
		||||
      var links = [];
 | 
			
		||||
      var annotations = pageGetAnnotations();
 | 
			
		||||
      var i, n = annotations.length;
 | 
			
		||||
@ -302,7 +302,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return links;
 | 
			
		||||
    },
 | 
			
		||||
    getAnnotations: function pageGetAnnotations() {
 | 
			
		||||
    getAnnotations: function Page_getAnnotations() {
 | 
			
		||||
      var xref = this.xref;
 | 
			
		||||
      function getInheritableProperty(annotation, name) {
 | 
			
		||||
        var item = annotation;
 | 
			
		||||
@ -433,7 +433,7 @@ var Page = (function PageClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return items;
 | 
			
		||||
    },
 | 
			
		||||
    startRendering: function pageStartRendering(ctx, callback, textLayer)  {
 | 
			
		||||
    startRendering: function Page_startRendering(ctx, callback, textLayer)  {
 | 
			
		||||
      var stats = this.stats;
 | 
			
		||||
      stats.time('Overall');
 | 
			
		||||
      // If there is no displayReadyPromise yet, then the operatorList was never
 | 
			
		||||
@ -570,7 +570,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
 | 
			
		||||
    },
 | 
			
		||||
    // Find the header, remove leading garbage and setup the stream
 | 
			
		||||
    // starting from the header.
 | 
			
		||||
    checkHeader: function pdfDocCheckHeader() {
 | 
			
		||||
    checkHeader: function PDFDocModel_checkHeader() {
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      stream.reset();
 | 
			
		||||
      if (find(stream, '%PDF-', 1024)) {
 | 
			
		||||
@ -580,7 +580,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      // May not be a PDF file, continue anyway.
 | 
			
		||||
    },
 | 
			
		||||
    setup: function pdfDocSetup(ownerPassword, userPassword) {
 | 
			
		||||
    setup: function PDFDocModel_setup(ownerPassword, userPassword) {
 | 
			
		||||
      this.checkHeader();
 | 
			
		||||
      var xref = new XRef(this.stream,
 | 
			
		||||
                          this.startXRef,
 | 
			
		||||
@ -594,14 +594,14 @@ var PDFDocModel = (function PDFDocModelClosure() {
 | 
			
		||||
      // shadow the prototype getter
 | 
			
		||||
      return shadow(this, 'numPages', num);
 | 
			
		||||
    },
 | 
			
		||||
    getDocumentInfo: function pdfDocGetDocumentInfo() {
 | 
			
		||||
    getDocumentInfo: function PDFDocModel_getDocumentInfo() {
 | 
			
		||||
      var info;
 | 
			
		||||
      if (this.xref.trailer.has('Info'))
 | 
			
		||||
        info = this.xref.fetch(this.xref.trailer.get('Info'));
 | 
			
		||||
 | 
			
		||||
      return shadow(this, 'getDocumentInfo', info);
 | 
			
		||||
    },
 | 
			
		||||
    getFingerprint: function pdfDocGetFingerprint() {
 | 
			
		||||
    getFingerprint: function PDFDocModel_getFingerprint() {
 | 
			
		||||
      var xref = this.xref, fileID;
 | 
			
		||||
      if (xref.trailer.has('ID')) {
 | 
			
		||||
        fileID = '';
 | 
			
		||||
@ -622,7 +622,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
 | 
			
		||||
 | 
			
		||||
      return shadow(this, 'getFingerprint', fileID);
 | 
			
		||||
    },
 | 
			
		||||
    getPage: function pdfDocGetPage(n) {
 | 
			
		||||
    getPage: function PDFDocModel_getPage(n) {
 | 
			
		||||
      return this.catalog.getPage(n);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -711,13 +711,13 @@ var PDFDoc = (function PDFDocClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  PDFDoc.prototype = {
 | 
			
		||||
    setupFakeWorker: function() {
 | 
			
		||||
    setupFakeWorker: function PDFDoc_setupFakeWorker() {
 | 
			
		||||
      // If we don't use a worker, just post/sendMessage to the main thread.
 | 
			
		||||
      var fakeWorker = {
 | 
			
		||||
        postMessage: function pdfDocPostMessage(obj) {
 | 
			
		||||
        postMessage: function PDFDoc_postMessage(obj) {
 | 
			
		||||
          fakeWorker.onmessage({data: obj});
 | 
			
		||||
        },
 | 
			
		||||
        terminate: function pdfDocTerminate() {}
 | 
			
		||||
        terminate: function PDFDoc_terminate() {}
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      var messageHandler = new MessageHandler('main', fakeWorker);
 | 
			
		||||
@ -729,7 +729,7 @@ var PDFDoc = (function PDFDocClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    setupMessageHandler: function(messageHandler) {
 | 
			
		||||
    setupMessageHandler: function PDFDoc_setupMessageHandler(messageHandler) {
 | 
			
		||||
      this.messageHandler = messageHandler;
 | 
			
		||||
 | 
			
		||||
      messageHandler.on('page', function pdfDocPage(data) {
 | 
			
		||||
@ -828,7 +828,7 @@ var PDFDoc = (function PDFDocClosure() {
 | 
			
		||||
      return this.pdfModel.numPages;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    startRendering: function pdfDocStartRendering(page) {
 | 
			
		||||
    startRendering: function PDFDoc_startRendering(page) {
 | 
			
		||||
      // The worker might not be ready to receive the page request yet.
 | 
			
		||||
      this.workerReadyPromise.then(function pdfDocStartRenderingThen() {
 | 
			
		||||
        page.stats.time('Page Request');
 | 
			
		||||
@ -836,7 +836,7 @@ var PDFDoc = (function PDFDocClosure() {
 | 
			
		||||
      }.bind(this));
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getPage: function pdfDocGetPage(n) {
 | 
			
		||||
    getPage: function PDFDoc_getPage(n) {
 | 
			
		||||
      if (this.pageCache[n])
 | 
			
		||||
        return this.pageCache[n];
 | 
			
		||||
 | 
			
		||||
@ -848,7 +848,7 @@ var PDFDoc = (function PDFDocClosure() {
 | 
			
		||||
      return (this.pageCache[n] = page);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    destroy: function pdfDocDestroy() {
 | 
			
		||||
    destroy: function PDFDoc_destroy() {
 | 
			
		||||
      if (this.worker)
 | 
			
		||||
        this.worker.terminate();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ var ARCFourCipher = (function ARCFourCipherClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ARCFourCipher.prototype = {
 | 
			
		||||
    encryptBlock: function arcFourCipherEncryptBlock(data) {
 | 
			
		||||
    encryptBlock: function ARCFourCipher_encryptBlock(data) {
 | 
			
		||||
      var i, n = data.length, tmp, tmp2;
 | 
			
		||||
      var a = this.a, b = this.b, s = this.s;
 | 
			
		||||
      var output = new Uint8Array(n);
 | 
			
		||||
@ -133,7 +133,7 @@ var NullCipher = (function NullCipherClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  NullCipher.prototype = {
 | 
			
		||||
    decryptBlock: function nullCipherDecryptBlock(data) {
 | 
			
		||||
    decryptBlock: function NullCipher_decryptBlock(data) {
 | 
			
		||||
      return data;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -371,7 +371,7 @@ var AES128Cipher = (function AES128CipherClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  AES128Cipher.prototype = {
 | 
			
		||||
    decryptBlock: function aes128CipherDecryptBlock(data) {
 | 
			
		||||
    decryptBlock: function AES128Cipher_decryptBlock(data) {
 | 
			
		||||
      var i, sourceLength = data.length;
 | 
			
		||||
      var buffer = this.buffer, bufferLength = this.bufferPosition;
 | 
			
		||||
      // waiting for IV values -- they are at the start of the stream
 | 
			
		||||
@ -400,7 +400,7 @@ var CipherTransform = (function CipherTransformClosure() {
 | 
			
		||||
    this.streamCipherConstructor = streamCipherConstructor;
 | 
			
		||||
  }
 | 
			
		||||
  CipherTransform.prototype = {
 | 
			
		||||
    createStream: function cipherTransformCreateStream(stream) {
 | 
			
		||||
    createStream: function CipherTransform_createStream(stream) {
 | 
			
		||||
      var cipher = new this.streamCipherConstructor();
 | 
			
		||||
      return new DecryptStream(stream,
 | 
			
		||||
        function cipherTransformDecryptStream(data) {
 | 
			
		||||
@ -408,7 +408,7 @@ var CipherTransform = (function CipherTransformClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    decryptString: function cipherTransformDecryptString(s) {
 | 
			
		||||
    decryptString: function CipherTransform_decryptString(s) {
 | 
			
		||||
      var cipher = new this.stringCipherConstructor();
 | 
			
		||||
      var data = stringToBytes(s);
 | 
			
		||||
      data = cipher.decryptBlock(data);
 | 
			
		||||
@ -573,8 +573,8 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CipherTransformFactory.prototype = {
 | 
			
		||||
    createCipherTransform: function buildCipherCreateCipherTransform(num,
 | 
			
		||||
                                                                     gen) {
 | 
			
		||||
    createCipherTransform:
 | 
			
		||||
      function CipherTransformFactory_createCipherTransform(num, gen) {
 | 
			
		||||
      if (this.algorithm == 4) {
 | 
			
		||||
        return new CipherTransform(
 | 
			
		||||
          buildCipherConstructor(this.cf, this.stmf,
 | 
			
		||||
 | 
			
		||||
@ -112,8 +112,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  PartialEvaluator.prototype = {
 | 
			
		||||
    getOperatorList: function partialEvaluatorGetOperatorList(stream, resources,
 | 
			
		||||
                                                      dependency, queue) {
 | 
			
		||||
    getOperatorList: function PartialEvaluator_getOperatorList(stream,
 | 
			
		||||
                                                               resources,
 | 
			
		||||
                                                               dependency,
 | 
			
		||||
                                                               queue) {
 | 
			
		||||
 | 
			
		||||
      var self = this;
 | 
			
		||||
      var xref = this.xref;
 | 
			
		||||
@ -521,8 +523,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
      properties.hasEncoding = hasEncoding;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    readToUnicode:
 | 
			
		||||
      function partialEvaluatorReadToUnicode(toUnicode, xref) {
 | 
			
		||||
    readToUnicode: function PartialEvaluator_readToUnicode(toUnicode, xref) {
 | 
			
		||||
      var cmapObj = xref.fetchIfRef(toUnicode);
 | 
			
		||||
      var charToUnicode = [];
 | 
			
		||||
      if (isName(cmapObj)) {
 | 
			
		||||
@ -641,8 +642,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return charToUnicode;
 | 
			
		||||
    },
 | 
			
		||||
    readCidToGidMap:
 | 
			
		||||
      function partialEvaluatorReadCidToGidMap(cidToGidStream) {
 | 
			
		||||
    readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
 | 
			
		||||
      // Extract the encoding from the CIDToGIDMap
 | 
			
		||||
      var glyphsData = cidToGidStream.getBytes();
 | 
			
		||||
 | 
			
		||||
@ -659,7 +659,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
      return result;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    extractWidths: function partialEvaluatorWidths(dict,
 | 
			
		||||
    extractWidths: function PartialEvaluator_extractWidths(dict,
 | 
			
		||||
                                                   xref,
 | 
			
		||||
                                                   descriptor,
 | 
			
		||||
                                                   properties) {
 | 
			
		||||
@ -711,7 +711,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
      properties.widths = glyphsWidths;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getBaseFontMetrics: function getBaseFontMetrics(name) {
 | 
			
		||||
    getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
 | 
			
		||||
      var defaultWidth = 0, widths = [];
 | 
			
		||||
      var glyphWidths = Metrics[stdFontMap[name] || name];
 | 
			
		||||
      if (isNum(glyphWidths)) {
 | 
			
		||||
@ -726,7 +726,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    translateFont: function partialEvaluatorTranslateFont(dict, xref, resources,
 | 
			
		||||
    translateFont: function PartialEvaluator_translateFont(dict,
 | 
			
		||||
                                                           xref,
 | 
			
		||||
                                                           resources,
 | 
			
		||||
                                                           dependency) {
 | 
			
		||||
      var baseDict = dict;
 | 
			
		||||
      var type = dict.get('Subtype');
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										131
									
								
								src/fonts.js
									
									
									
									
									
								
							
							
						
						
									
										131
									
								
								src/fonts.js
									
									
									
									
									
								
							@ -1267,7 +1267,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
    mimetype: null,
 | 
			
		||||
    encoding: null,
 | 
			
		||||
 | 
			
		||||
    checkAndRepair: function font_checkAndRepair(name, font, properties) {
 | 
			
		||||
    checkAndRepair: function Font_checkAndRepair(name, font, properties) {
 | 
			
		||||
      function readTableEntry(file) {
 | 
			
		||||
        var tag = file.getBytes(4);
 | 
			
		||||
        tag = String.fromCharCode(tag[0]) +
 | 
			
		||||
@ -2122,7 +2122,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      return stringToArray(ttf.file);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    convert: function font_convert(fontName, font, properties) {
 | 
			
		||||
    convert: function Font_convert(fontName, font, properties) {
 | 
			
		||||
      function isFixedPitch(glyphs) {
 | 
			
		||||
        for (var i = 0, ii = glyphs.length - 1; i < ii; i++) {
 | 
			
		||||
          if (glyphs[i] != glyphs[i + 1])
 | 
			
		||||
@ -2264,7 +2264,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      return stringToArray(otf.file);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    buildToFontChar: function font_buildToFontChar(toUnicode) {
 | 
			
		||||
    buildToFontChar: function Font_buildToFontChar(toUnicode) {
 | 
			
		||||
      var result = [];
 | 
			
		||||
      var unusedUnicode = kCmapGlyphOffset;
 | 
			
		||||
      for (var i = 0, ii = toUnicode.length; i < ii; i++) {
 | 
			
		||||
@ -2277,7 +2277,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      return result;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    rebuildToUnicode: function font_rebuildToUnicode(properties) {
 | 
			
		||||
    rebuildToUnicode: function Font_rebuildToUnicode(properties) {
 | 
			
		||||
      var firstChar = properties.firstChar, lastChar = properties.lastChar;
 | 
			
		||||
      var map = [];
 | 
			
		||||
      if (properties.composite) {
 | 
			
		||||
@ -2299,7 +2299,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      this.toUnicode = map;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    loadCidToUnicode: function font_loadCidToUnicode(properties) {
 | 
			
		||||
    loadCidToUnicode: function Font_loadCidToUnicode(properties) {
 | 
			
		||||
      if (!properties.cidSystemInfo)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
@ -2348,7 +2348,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    bindDOM: function font_bindDom(data) {
 | 
			
		||||
    bindDOM: function Font_bindDOM(data) {
 | 
			
		||||
      var fontName = this.loadedName;
 | 
			
		||||
 | 
			
		||||
      // Add the font-face rule to the document
 | 
			
		||||
@ -2400,7 +2400,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      return shadow(this, 'spaceWidth', width);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    charToGlyph: function fonts_charToGlyph(charcode) {
 | 
			
		||||
    charToGlyph: function Font_charToGlyph(charcode) {
 | 
			
		||||
      var fontCharCode, width, operatorList, disabled;
 | 
			
		||||
 | 
			
		||||
      var width = this.widths[charcode];
 | 
			
		||||
@ -2486,7 +2486,7 @@ var Font = (function FontClosure() {
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    charsToGlyphs: function fonts_charsToGlyphs(chars) {
 | 
			
		||||
    charsToGlyphs: function Font_charsToGlyphs(chars) {
 | 
			
		||||
      var charsCache = this.charsCache;
 | 
			
		||||
      var glyphs;
 | 
			
		||||
 | 
			
		||||
@ -2850,7 +2850,7 @@ var Type1Parser = function type1Parser() {
 | 
			
		||||
    return c == ' ' || c == '\n' || c == '\x0d';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  this.extractFontProgram = function t1_extractFontProgram(stream) {
 | 
			
		||||
  this.extractFontProgram = function Font_extractFontProgram(stream) {
 | 
			
		||||
    var eexec = decrypt(stream, kEexecEncryptionKey, 4);
 | 
			
		||||
    var eexecStr = '';
 | 
			
		||||
    for (var i = 0, ii = eexec.length; i < ii; i++)
 | 
			
		||||
@ -2975,7 +2975,7 @@ var Type1Parser = function type1Parser() {
 | 
			
		||||
    return program;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  this.extractFontHeader = function t1_extractFontHeader(stream, properties) {
 | 
			
		||||
  this.extractFontHeader = function Font_extractFontHeader(stream, properties) {
 | 
			
		||||
    var headerString = '';
 | 
			
		||||
    for (var i = 0, ii = stream.length; i < ii; i++)
 | 
			
		||||
      headerString += String.fromCharCode(stream[i]);
 | 
			
		||||
@ -3143,7 +3143,7 @@ var Type1Font = function Type1Font(name, file, properties) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Type1Font.prototype = {
 | 
			
		||||
  createCFFIndexHeader: function createCFFIndexHeader(objects, isByte) {
 | 
			
		||||
  createCFFIndexHeader: function Font_createCFFIndexHeader(objects, isByte) {
 | 
			
		||||
    // First 2 bytes contains the number of objects contained into this index
 | 
			
		||||
    var count = objects.length;
 | 
			
		||||
 | 
			
		||||
@ -3179,7 +3179,7 @@ Type1Font.prototype = {
 | 
			
		||||
    return data;
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  encodeNumber: function encodeNumber(value) {
 | 
			
		||||
  encodeNumber: function Font_encodeNumber(value) {
 | 
			
		||||
    // some of the fonts has ouf-of-range values
 | 
			
		||||
    // they are just arithmetic overflows
 | 
			
		||||
    // make sanitizer happy
 | 
			
		||||
@ -3197,7 +3197,7 @@ Type1Font.prototype = {
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getOrderedCharStrings: function type1Font_getOrderedCharStrings(glyphs,
 | 
			
		||||
  getOrderedCharStrings: function Font_getOrderedCharStrings(glyphs,
 | 
			
		||||
                                                            properties) {
 | 
			
		||||
    var charstrings = [];
 | 
			
		||||
    var i, length, glyphName;
 | 
			
		||||
@ -3223,7 +3223,7 @@ Type1Font.prototype = {
 | 
			
		||||
    return charstrings;
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getType2Charstrings: function getType2Charstrings(type1Charstrings) {
 | 
			
		||||
  getType2Charstrings: function Font_getType2Charstrings(type1Charstrings) {
 | 
			
		||||
    var type2Charstrings = [];
 | 
			
		||||
    var count = type1Charstrings.length;
 | 
			
		||||
    for (var i = 0; i < count; i++) {
 | 
			
		||||
@ -3234,7 +3234,7 @@ Type1Font.prototype = {
 | 
			
		||||
    return type2Charstrings;
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getType2Subrs: function getType2Subrs(type1Subrs) {
 | 
			
		||||
  getType2Subrs: function Font_getType2Subrs(type1Subrs) {
 | 
			
		||||
    var bias = 0;
 | 
			
		||||
    var count = type1Subrs.length;
 | 
			
		||||
    if (count < 1240)
 | 
			
		||||
@ -3286,7 +3286,7 @@ Type1Font.prototype = {
 | 
			
		||||
    'hvcurveto': 31
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  flattenCharstring: function flattenCharstring(charstring, map) {
 | 
			
		||||
  flattenCharstring: function Font_flattenCharstring(charstring, map) {
 | 
			
		||||
    // charstring changes size - can't cache .length in loop
 | 
			
		||||
    for (var i = 0; i < charstring.length; i++) {
 | 
			
		||||
      var command = charstring[i];
 | 
			
		||||
@ -3313,7 +3313,7 @@ Type1Font.prototype = {
 | 
			
		||||
    return charstring;
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  wrap: function wrap(name, glyphs, charstrings, subrs, properties) {
 | 
			
		||||
  wrap: function Font_wrap(name, glyphs, charstrings, subrs, properties) {
 | 
			
		||||
    var fields = {
 | 
			
		||||
      // major version, minor version, header size, offset size
 | 
			
		||||
      'header': '\x01\x00\x04\x04',
 | 
			
		||||
@ -3470,7 +3470,7 @@ var CFFFont = (function CFFFontClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CFFFont.prototype = {
 | 
			
		||||
    readExtra: function readExtra(cff) {
 | 
			
		||||
    readExtra: function CFFFont_readExtra(cff) {
 | 
			
		||||
      // charstrings contains info about glyphs (one element per glyph
 | 
			
		||||
      // containing mappings for {unicode, width})
 | 
			
		||||
      var charset = cff.charset.charset;
 | 
			
		||||
@ -3485,7 +3485,7 @@ var CFFFont = (function CFFFontClosure() {
 | 
			
		||||
      this.charstrings = charstrings;
 | 
			
		||||
      this.glyphIds = glyphIds;
 | 
			
		||||
    },
 | 
			
		||||
    getCharStrings: function getCharStrings(charsets, encoding) {
 | 
			
		||||
    getCharStrings: function CFFFont_getCharStrings(charsets, encoding) {
 | 
			
		||||
      var charstrings = [];
 | 
			
		||||
      var unicodeUsed = [];
 | 
			
		||||
      var unassignedUnicodeItems = [];
 | 
			
		||||
@ -3547,7 +3547,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
    this.properties = properties;
 | 
			
		||||
  }
 | 
			
		||||
  CFFParser.prototype = {
 | 
			
		||||
    parse: function parse() {
 | 
			
		||||
    parse: function CFFParser_parse() {
 | 
			
		||||
      var properties = this.properties;
 | 
			
		||||
      var cff = new CFF();
 | 
			
		||||
      this.cff = cff;
 | 
			
		||||
@ -3604,7 +3604,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
 | 
			
		||||
      return cff;
 | 
			
		||||
    },
 | 
			
		||||
    parseHeader: function parseHeader() {
 | 
			
		||||
    parseHeader: function CFFParser_parseHeader() {
 | 
			
		||||
      var bytes = this.bytes;
 | 
			
		||||
      var offset = 0;
 | 
			
		||||
 | 
			
		||||
@ -3623,7 +3623,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      var header = new CFFHeader(major, minor, hdrSize, offSize);
 | 
			
		||||
      return {obj: header, endPos: hdrSize};
 | 
			
		||||
    },
 | 
			
		||||
    parseDict: function parseDict(dict) {
 | 
			
		||||
    parseDict: function CFFParser_parseDict(dict) {
 | 
			
		||||
      var pos = 0;
 | 
			
		||||
 | 
			
		||||
      function parseOperand() {
 | 
			
		||||
@ -3693,7 +3693,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return entries;
 | 
			
		||||
    },
 | 
			
		||||
    parseIndex: function parseIndex(pos) {
 | 
			
		||||
    parseIndex: function CFFParser_parseIndex(pos) {
 | 
			
		||||
      var cffIndex = new CFFIndex();
 | 
			
		||||
      var bytes = this.bytes;
 | 
			
		||||
      var count = (bytes[pos++] << 8) | bytes[pos++];
 | 
			
		||||
@ -3723,7 +3723,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return {obj: cffIndex, endPos: end};
 | 
			
		||||
    },
 | 
			
		||||
    parseNameIndex: function parseNameIndex(index) {
 | 
			
		||||
    parseNameIndex: function CFFParser_parseNameIndex(index) {
 | 
			
		||||
      var names = [];
 | 
			
		||||
      for (var i = 0, ii = index.count; i < ii; ++i) {
 | 
			
		||||
        var name = index.get(i);
 | 
			
		||||
@ -3750,7 +3750,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return names;
 | 
			
		||||
    },
 | 
			
		||||
    parseStringIndex: function parseStringIndex(index) {
 | 
			
		||||
    parseStringIndex: function CFFParser_parseStringIndex(index) {
 | 
			
		||||
      var strings = new CFFStrings();
 | 
			
		||||
      for (var i = 0, ii = index.count; i < ii; ++i) {
 | 
			
		||||
        var data = index.get(i);
 | 
			
		||||
@ -3758,7 +3758,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return strings;
 | 
			
		||||
    },
 | 
			
		||||
    createDict: function createDict(type, dict, strings) {
 | 
			
		||||
    createDict: function CFFParser_createDict(type, dict, strings) {
 | 
			
		||||
      var cffDict = new type(strings);
 | 
			
		||||
      var types = cffDict.types;
 | 
			
		||||
 | 
			
		||||
@ -3770,7 +3770,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return cffDict;
 | 
			
		||||
    },
 | 
			
		||||
    parseCharStrings: function parseCharStrings(charStringOffset) {
 | 
			
		||||
    parseCharStrings: function CFFParser_parseCharStrings(charStringOffset) {
 | 
			
		||||
      var charStrings = this.parseIndex(charStringOffset).obj;
 | 
			
		||||
      // The CFF specification state that the 'dotsection' command
 | 
			
		||||
      // (12, 0) is deprecated and treated as a no-op, but all Type2
 | 
			
		||||
@ -3799,7 +3799,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return charStrings;
 | 
			
		||||
    },
 | 
			
		||||
    parsePrivateDict: function parsePrivateDict(parentDict) {
 | 
			
		||||
    parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
 | 
			
		||||
      // no private dict, do nothing
 | 
			
		||||
      if (!parentDict.hasName('Private'))
 | 
			
		||||
        return;
 | 
			
		||||
@ -3837,7 +3837,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      var subrsIndex = this.parseIndex(relativeOffset);
 | 
			
		||||
      privateDict.subrsIndex = subrsIndex.obj;
 | 
			
		||||
    },
 | 
			
		||||
    parseCharsets: function parsecharsets(pos, length, strings, cid) {
 | 
			
		||||
    parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
 | 
			
		||||
      if (pos == 0) {
 | 
			
		||||
        return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE,
 | 
			
		||||
                              ISOAdobeCharset);
 | 
			
		||||
@ -3889,7 +3889,10 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
 | 
			
		||||
      return new CFFCharset(false, format, charset, raw);
 | 
			
		||||
    },
 | 
			
		||||
    parseEncoding: function parseEncoding(pos, properties, strings, charset) {
 | 
			
		||||
    parseEncoding: function CFFParser_parseEncoding(pos,
 | 
			
		||||
                                                    properties,
 | 
			
		||||
                                                    strings,
 | 
			
		||||
                                                    charset) {
 | 
			
		||||
      var encoding = {};
 | 
			
		||||
      var bytes = this.bytes;
 | 
			
		||||
      var predefined = false;
 | 
			
		||||
@ -3958,7 +3961,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
			
		||||
      format = format & 0x7f;
 | 
			
		||||
      return new CFFEncoding(predefined, format, encoding, raw);
 | 
			
		||||
    },
 | 
			
		||||
    parseFDSelect: function parseFDSelect(pos, length) {
 | 
			
		||||
    parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
 | 
			
		||||
      var start = pos;
 | 
			
		||||
      var bytes = this.bytes;
 | 
			
		||||
      var format = bytes[pos++];
 | 
			
		||||
@ -4030,14 +4033,14 @@ var CFFStrings = (function CFFStringsClosure() {
 | 
			
		||||
    this.strings = [];
 | 
			
		||||
  }
 | 
			
		||||
  CFFStrings.prototype = {
 | 
			
		||||
    get: function get(index) {
 | 
			
		||||
    get: function CFFStrings_get(index) {
 | 
			
		||||
      if (index >= 0 && index <= 390)
 | 
			
		||||
        return CFFStandardStrings[index];
 | 
			
		||||
      if (index - 391 <= this.strings.length)
 | 
			
		||||
        return this.strings[index - 391];
 | 
			
		||||
      return CFFStandardStrings[0];
 | 
			
		||||
    },
 | 
			
		||||
    add: function add(value) {
 | 
			
		||||
    add: function CFFStrings_add(value) {
 | 
			
		||||
      this.strings.push(value);
 | 
			
		||||
    },
 | 
			
		||||
    get count() {
 | 
			
		||||
@ -4053,11 +4056,11 @@ var CFFIndex = (function CFFIndexClosure() {
 | 
			
		||||
    this.length = 0;
 | 
			
		||||
  }
 | 
			
		||||
  CFFIndex.prototype = {
 | 
			
		||||
    add: function add(data) {
 | 
			
		||||
    add: function CFFIndex_add(data) {
 | 
			
		||||
      this.length += data.length;
 | 
			
		||||
      this.objects.push(data);
 | 
			
		||||
    },
 | 
			
		||||
    get: function get(index) {
 | 
			
		||||
    get: function CFFIndex_get(index) {
 | 
			
		||||
      return this.objects[index];
 | 
			
		||||
    },
 | 
			
		||||
    get count() {
 | 
			
		||||
@ -4080,7 +4083,7 @@ var CFFDict = (function CFFDictClosure() {
 | 
			
		||||
  }
 | 
			
		||||
  CFFDict.prototype = {
 | 
			
		||||
    // value should always be an array
 | 
			
		||||
    setByKey: function setByKey(key, value) {
 | 
			
		||||
    setByKey: function CFFDict_setByKey(key, value) {
 | 
			
		||||
      if (!(key in this.keyToNameMap))
 | 
			
		||||
        return false;
 | 
			
		||||
      // ignore empty values
 | 
			
		||||
@ -4093,10 +4096,10 @@ var CFFDict = (function CFFDictClosure() {
 | 
			
		||||
      this.values[key] = value;
 | 
			
		||||
      return true;
 | 
			
		||||
    },
 | 
			
		||||
    hasName: function hasName(name) {
 | 
			
		||||
    hasName: function CFFDict_hasName(name) {
 | 
			
		||||
      return this.nameToKeyMap[name] in this.values;
 | 
			
		||||
    },
 | 
			
		||||
    getByName: function getByName(name) {
 | 
			
		||||
    getByName: function CFFDict_getByName(name) {
 | 
			
		||||
      if (!(name in this.nameToKeyMap))
 | 
			
		||||
        error('Invalid dictionary name "' + name + '"');
 | 
			
		||||
      var key = this.nameToKeyMap[name];
 | 
			
		||||
@ -4104,11 +4107,11 @@ var CFFDict = (function CFFDictClosure() {
 | 
			
		||||
        return this.defaults[key];
 | 
			
		||||
      return this.values[key];
 | 
			
		||||
    },
 | 
			
		||||
    removeByName: function removeByName(name) {
 | 
			
		||||
    removeByName: function CFFDict_removeByName(name) {
 | 
			
		||||
      delete this.values[this.nameToKeyMap[name]];
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  CFFDict.createTables = function createTables(layout) {
 | 
			
		||||
  CFFDict.createTables = function CFFDict_createTables(layout) {
 | 
			
		||||
    var tables = {
 | 
			
		||||
      keyToNameMap: {},
 | 
			
		||||
      nameToKeyMap: {},
 | 
			
		||||
@ -4265,20 +4268,22 @@ var CFFOffsetTracker = (function CFFOffsetTrackerClosure() {
 | 
			
		||||
    this.offsets = {};
 | 
			
		||||
  }
 | 
			
		||||
  CFFOffsetTracker.prototype = {
 | 
			
		||||
    isTracking: function isTracking(key) {
 | 
			
		||||
    isTracking: function CFFOffsetTracker_isTracking(key) {
 | 
			
		||||
      return key in this.offsets;
 | 
			
		||||
    },
 | 
			
		||||
    track: function track(key, location) {
 | 
			
		||||
    track: function CFFOffsetTracker_track(key, location) {
 | 
			
		||||
      if (key in this.offsets)
 | 
			
		||||
        error('Already tracking location of ' + key);
 | 
			
		||||
      this.offsets[key] = location;
 | 
			
		||||
    },
 | 
			
		||||
    offset: function offset(value) {
 | 
			
		||||
    offset: function CFFOffsetTracker_offset(value) {
 | 
			
		||||
      for (var key in this.offsets) {
 | 
			
		||||
        this.offsets[key] += value;
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    setEntryLocation: function setEntryLocation(key, values, output) {
 | 
			
		||||
    setEntryLocation: function CFFOffsetTracker_setEntryLocation(key,
 | 
			
		||||
                                                                 values,
 | 
			
		||||
                                                                 output) {
 | 
			
		||||
      if (!(key in this.offsets))
 | 
			
		||||
        error('Not tracking location of ' + key);
 | 
			
		||||
      var data = output.data;
 | 
			
		||||
@ -4319,12 +4324,12 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
    this.cff = cff;
 | 
			
		||||
  }
 | 
			
		||||
  CFFCompiler.prototype = {
 | 
			
		||||
    compile: function compile() {
 | 
			
		||||
    compile: function CFFCompiler_compile() {
 | 
			
		||||
      var cff = this.cff;
 | 
			
		||||
      var output = {
 | 
			
		||||
        data: [],
 | 
			
		||||
        length: 0,
 | 
			
		||||
        add: function add(data) {
 | 
			
		||||
        add: function CFFCompiler_add(data) {
 | 
			
		||||
          this.data = this.data.concat(data);
 | 
			
		||||
          this.length = this.data.length;
 | 
			
		||||
        }
 | 
			
		||||
@ -4393,13 +4398,13 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
 | 
			
		||||
      return output.data;
 | 
			
		||||
    },
 | 
			
		||||
    encodeNumber: function encodeNumber(value) {
 | 
			
		||||
    encodeNumber: function CFFCompiler_encodeNumber(value) {
 | 
			
		||||
      if (parseFloat(value) == parseInt(value) && !isNaN(value)) // isInt
 | 
			
		||||
        return this.encodeInteger(value);
 | 
			
		||||
      else
 | 
			
		||||
        return this.encodeFloat(value);
 | 
			
		||||
    },
 | 
			
		||||
    encodeFloat: function encodeFloat(value) {
 | 
			
		||||
    encodeFloat: function CFFCompiler_encodeFloat(value) {
 | 
			
		||||
      value = value.toString();
 | 
			
		||||
      // Strip off the any leading zeros.
 | 
			
		||||
      if (value.substr(0, 2) === '0.')
 | 
			
		||||
@ -4432,7 +4437,7 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
        out.push(nibbles[i] << 4 | nibbles[i + 1]);
 | 
			
		||||
      return out;
 | 
			
		||||
    },
 | 
			
		||||
    encodeInteger: function encodeInteger(value) {
 | 
			
		||||
    encodeInteger: function CFFCompiler_encodeInteger(value) {
 | 
			
		||||
      var code;
 | 
			
		||||
      if (value >= -107 && value <= 107) {
 | 
			
		||||
        code = [value + 139];
 | 
			
		||||
@ -4453,7 +4458,7 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return code;
 | 
			
		||||
    },
 | 
			
		||||
    compileHeader: function compileHeader(header) {
 | 
			
		||||
    compileHeader: function CFFCompiler_compileHeader(header) {
 | 
			
		||||
      return [
 | 
			
		||||
        header.major,
 | 
			
		||||
        header.minor,
 | 
			
		||||
@ -4461,13 +4466,13 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
        header.offSize
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
    compileNameIndex: function compileNameIndex(names) {
 | 
			
		||||
    compileNameIndex: function CFFCompiler_compileNameIndex(names) {
 | 
			
		||||
      var nameIndex = new CFFIndex();
 | 
			
		||||
      for (var i = 0, ii = names.length; i < ii; ++i)
 | 
			
		||||
        nameIndex.add(stringToArray(names[i]));
 | 
			
		||||
      return this.compileIndex(nameIndex);
 | 
			
		||||
    },
 | 
			
		||||
    compileTopDicts: function compileTopDicts(dicts, length) {
 | 
			
		||||
    compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length) {
 | 
			
		||||
      var fontDictTrackers = [];
 | 
			
		||||
      var fdArrayIndex = new CFFIndex();
 | 
			
		||||
      for (var i = 0, ii = dicts.length; i < ii; ++i) {
 | 
			
		||||
@ -4484,7 +4489,9 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
        output: fdArrayIndex
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
    compilePrivateDicts: function compilePrivateDicts(dicts, trackers, output) {
 | 
			
		||||
    compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts,
 | 
			
		||||
                                                                  trackers,
 | 
			
		||||
                                                                  output) {
 | 
			
		||||
      for (var i = 0, ii = dicts.length; i < ii; ++i) {
 | 
			
		||||
        var fontDict = dicts[i];
 | 
			
		||||
        if (!fontDict.privateDict || !fontDict.hasName('Private'))
 | 
			
		||||
@ -4507,7 +4514,7 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    compileDict: function compileDict(dict, offsetTracker) {
 | 
			
		||||
    compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
 | 
			
		||||
      var out = [];
 | 
			
		||||
      // The dictionary keys must be in a certain order.
 | 
			
		||||
      var order = dict.order;
 | 
			
		||||
@ -4558,35 +4565,35 @@ var CFFCompiler = (function CFFCompilerClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return out;
 | 
			
		||||
    },
 | 
			
		||||
    compileStringIndex: function compileStringIndex(strings) {
 | 
			
		||||
    compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
 | 
			
		||||
      var stringIndex = new CFFIndex();
 | 
			
		||||
      for (var i = 0, ii = strings.length; i < ii; ++i)
 | 
			
		||||
        stringIndex.add(stringToArray(strings[i]));
 | 
			
		||||
      return this.compileIndex(stringIndex);
 | 
			
		||||
    },
 | 
			
		||||
    compileGlobalSubrIndex: function compileGlobalSubrIndex() {
 | 
			
		||||
    compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
 | 
			
		||||
      var globalSubrIndex = this.cff.globalSubrIndex;
 | 
			
		||||
      this.out.writeByteArray(this.compileIndex(globalSubrIndex));
 | 
			
		||||
    },
 | 
			
		||||
    compileCharStrings: function compileCharStrings(charStrings) {
 | 
			
		||||
    compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
 | 
			
		||||
      return this.compileIndex(charStrings);
 | 
			
		||||
    },
 | 
			
		||||
    compileCharset: function compileCharset(charset) {
 | 
			
		||||
    compileCharset: function CFFCompiler_compileCharset(charset) {
 | 
			
		||||
      return this.compileTypedArray(charset.raw);
 | 
			
		||||
    },
 | 
			
		||||
    compileEncoding: function compileEncoding(encoding) {
 | 
			
		||||
    compileEncoding: function CFFCompiler_compileEncoding(encoding) {
 | 
			
		||||
      return this.compileTypedArray(encoding.raw);
 | 
			
		||||
    },
 | 
			
		||||
    compileFDSelect: function compileFDSelect(fdSelect) {
 | 
			
		||||
    compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
 | 
			
		||||
      return this.compileTypedArray(fdSelect);
 | 
			
		||||
    },
 | 
			
		||||
    compileTypedArray: function compileTypedArray(data) {
 | 
			
		||||
    compileTypedArray: function CFFCompiler_compileTypedArray(data) {
 | 
			
		||||
      var out = [];
 | 
			
		||||
      for (var i = 0, ii = data.length; i < ii; ++i)
 | 
			
		||||
        out[i] = data[i];
 | 
			
		||||
      return out;
 | 
			
		||||
    },
 | 
			
		||||
    compileIndex: function compileIndex(index, trackers) {
 | 
			
		||||
    compileIndex: function CFFCompiler_compileIndex(index, trackers) {
 | 
			
		||||
      trackers = trackers || [];
 | 
			
		||||
      var objects = index.objects;
 | 
			
		||||
      // First 2 bytes contains the number of objects contained into this index
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
  var CONSTRUCT_POSTSCRIPT = 4;
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    getSampleArray: function pdfFunctionGetSampleArray(size, outputSize, bps,
 | 
			
		||||
    getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps,
 | 
			
		||||
                                                       str) {
 | 
			
		||||
      var length = 1;
 | 
			
		||||
      for (var i = 0, ii = size.length; i < ii; i++)
 | 
			
		||||
@ -38,7 +38,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      return array;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getIR: function pdfFunctionGetIR(xref, fn) {
 | 
			
		||||
    getIR: function PDFFunction_getIR(xref, fn) {
 | 
			
		||||
      var dict = fn.dict;
 | 
			
		||||
      if (!dict)
 | 
			
		||||
        dict = fn;
 | 
			
		||||
@ -57,7 +57,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      return typeFn.call(this, fn, dict, xref);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    fromIR: function pdfFunctionFromIR(IR) {
 | 
			
		||||
    fromIR: function PDFFunction_fromIR(IR) {
 | 
			
		||||
      var type = IR[0];
 | 
			
		||||
      switch (type) {
 | 
			
		||||
        case CONSTRUCT_SAMPLED:
 | 
			
		||||
@ -72,12 +72,12 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    parse: function pdfFunctionParse(xref, fn) {
 | 
			
		||||
    parse: function PDFFunction_parse(xref, fn) {
 | 
			
		||||
      var IR = this.getIR(xref, fn);
 | 
			
		||||
      return this.fromIR(IR);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructSampled: function pdfFunctionConstructSampled(str, dict) {
 | 
			
		||||
    constructSampled: function PDFFunction_constructSampled(str, dict) {
 | 
			
		||||
      function toMultiArray(arr) {
 | 
			
		||||
        var inputLength = arr.length;
 | 
			
		||||
        var outputLength = arr.length / 2;
 | 
			
		||||
@ -133,7 +133,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructSampledFromIR: function pdfFunctionConstructSampledFromIR(IR) {
 | 
			
		||||
    constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
 | 
			
		||||
      // See chapter 3, page 109 of the PDF reference
 | 
			
		||||
      function interpolate(x, xmin, xmax, ymin, ymax) {
 | 
			
		||||
        return ymin + ((x - xmin) * ((ymax - ymin) / (xmax - xmin)));
 | 
			
		||||
@ -221,8 +221,8 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructInterpolated:
 | 
			
		||||
    function pdfFunctionConstructInterpolated(str, dict) {
 | 
			
		||||
    constructInterpolated: function PDFFunction_constructInterpolated(str,
 | 
			
		||||
                                                                      dict) {
 | 
			
		||||
      var c0 = dict.get('C0') || [0];
 | 
			
		||||
      var c1 = dict.get('C1') || [1];
 | 
			
		||||
      var n = dict.get('N');
 | 
			
		||||
@ -239,7 +239,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructInterpolatedFromIR:
 | 
			
		||||
    function pdfFunctionconstructInterpolatedFromIR(IR) {
 | 
			
		||||
      function PDFFunction_constructInterpolatedFromIR(IR) {
 | 
			
		||||
      var c0 = IR[1];
 | 
			
		||||
      var diff = IR[2];
 | 
			
		||||
      var n = IR[3];
 | 
			
		||||
@ -258,7 +258,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructStiched: function pdfFunctionConstructStiched(fn, dict, xref) {
 | 
			
		||||
    constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
 | 
			
		||||
      var domain = dict.get('Domain');
 | 
			
		||||
 | 
			
		||||
      if (!domain)
 | 
			
		||||
@ -279,7 +279,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructStichedFromIR: function pdfFunctionConstructStichedFromIR(IR) {
 | 
			
		||||
    constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
 | 
			
		||||
      var domain = IR[1];
 | 
			
		||||
      var bounds = IR[2];
 | 
			
		||||
      var encode = IR[3];
 | 
			
		||||
@ -325,7 +325,7 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructPostScript: function pdfFunctionConstructPostScript(fn, dict,
 | 
			
		||||
    constructPostScript: function PDFFunction_constructPostScript(fn, dict,
 | 
			
		||||
                                                                  xref) {
 | 
			
		||||
      var domain = dict.get('Domain');
 | 
			
		||||
      var range = dict.get('Range');
 | 
			
		||||
@ -343,8 +343,8 @@ var PDFFunction = (function PDFFunctionClosure() {
 | 
			
		||||
      return [CONSTRUCT_POSTSCRIPT, domain, range, code];
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    constructPostScriptFromIR:
 | 
			
		||||
                          function pdfFunctionConstructPostScriptFromIR(IR) {
 | 
			
		||||
    constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(
 | 
			
		||||
                                          IR) {
 | 
			
		||||
      var domain = IR[1];
 | 
			
		||||
      var range = IR[2];
 | 
			
		||||
      var code = IR[3];
 | 
			
		||||
@ -390,13 +390,13 @@ var FunctionCache = (function FunctionCacheClosure() {
 | 
			
		||||
    this.total = 0;
 | 
			
		||||
  }
 | 
			
		||||
  FunctionCache.prototype = {
 | 
			
		||||
    has: function has(key) {
 | 
			
		||||
    has: function FunctionCache_has(key) {
 | 
			
		||||
      return key in this.cache;
 | 
			
		||||
    },
 | 
			
		||||
    get: function get(key) {
 | 
			
		||||
    get: function FunctionCache_get(key) {
 | 
			
		||||
      return this.cache[key];
 | 
			
		||||
    },
 | 
			
		||||
    set: function set(key, value) {
 | 
			
		||||
    set: function FunctionCache_set(key, value) {
 | 
			
		||||
      if (this.total < MAX_CACHE_SIZE) {
 | 
			
		||||
        this.cache[key] = value;
 | 
			
		||||
        this.total++;
 | 
			
		||||
@ -413,28 +413,28 @@ var PostScriptStack = (function PostScriptStackClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  PostScriptStack.prototype = {
 | 
			
		||||
    push: function push(value) {
 | 
			
		||||
    push: function PostScriptStack_push(value) {
 | 
			
		||||
      if (this.stack.length >= MAX_STACK_SIZE)
 | 
			
		||||
        error('PostScript function stack overflow.');
 | 
			
		||||
      this.stack.push(value);
 | 
			
		||||
    },
 | 
			
		||||
    pop: function pop() {
 | 
			
		||||
    pop: function PostScriptStack_pop() {
 | 
			
		||||
      if (this.stack.length <= 0)
 | 
			
		||||
        error('PostScript function stack underflow.');
 | 
			
		||||
      return this.stack.pop();
 | 
			
		||||
    },
 | 
			
		||||
    copy: function copy(n) {
 | 
			
		||||
    copy: function PostScriptStack_copy(n) {
 | 
			
		||||
      if (this.stack.length + n >= MAX_STACK_SIZE)
 | 
			
		||||
        error('PostScript function stack overflow.');
 | 
			
		||||
      var stack = this.stack;
 | 
			
		||||
      for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++)
 | 
			
		||||
        stack.push(stack[i]);
 | 
			
		||||
    },
 | 
			
		||||
    index: function index(n) {
 | 
			
		||||
    index: function PostScriptStack_index(n) {
 | 
			
		||||
      this.push(this.stack[this.stack.length - n - 1]);
 | 
			
		||||
    },
 | 
			
		||||
    // rotate the last n stack elements p times
 | 
			
		||||
    roll: function roll(n, p) {
 | 
			
		||||
    roll: function PostScriptStack_roll(n, p) {
 | 
			
		||||
      var stack = this.stack;
 | 
			
		||||
      var l = stack.length - n;
 | 
			
		||||
      var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
 | 
			
		||||
@ -457,7 +457,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
 | 
			
		||||
    this.operands = operands;
 | 
			
		||||
  }
 | 
			
		||||
  PostScriptEvaluator.prototype = {
 | 
			
		||||
    execute: function execute(initialStack) {
 | 
			
		||||
    execute: function PostScriptEvaluator_execute(initialStack) {
 | 
			
		||||
      var stack = new PostScriptStack(initialStack);
 | 
			
		||||
      var counter = 0;
 | 
			
		||||
      var operators = this.operators;
 | 
			
		||||
@ -691,31 +691,31 @@ var PostScriptParser = (function PostScriptParserClosure() {
 | 
			
		||||
    this.prev;
 | 
			
		||||
  }
 | 
			
		||||
  PostScriptParser.prototype = {
 | 
			
		||||
    nextToken: function nextToken() {
 | 
			
		||||
    nextToken: function PostScriptParser_nextToken() {
 | 
			
		||||
      this.prev = this.token;
 | 
			
		||||
      this.token = this.lexer.getToken();
 | 
			
		||||
    },
 | 
			
		||||
    accept: function accept(type) {
 | 
			
		||||
    accept: function PostScriptParser_accept(type) {
 | 
			
		||||
      if (this.token.type == type) {
 | 
			
		||||
        this.nextToken();
 | 
			
		||||
        return true;
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
    },
 | 
			
		||||
    expect: function expect(type) {
 | 
			
		||||
    expect: function PostScriptParser_expect(type) {
 | 
			
		||||
      if (this.accept(type))
 | 
			
		||||
        return true;
 | 
			
		||||
      error('Unexpected symbol: found ' + this.token.type + ' expected ' +
 | 
			
		||||
            type + '.');
 | 
			
		||||
    },
 | 
			
		||||
    parse: function parse() {
 | 
			
		||||
    parse: function PostScriptParser_parse() {
 | 
			
		||||
      this.nextToken();
 | 
			
		||||
      this.expect(PostScriptTokenTypes.LBRACE);
 | 
			
		||||
      this.parseBlock();
 | 
			
		||||
      this.expect(PostScriptTokenTypes.RBRACE);
 | 
			
		||||
      return this.operators;
 | 
			
		||||
    },
 | 
			
		||||
    parseBlock: function parseBlock() {
 | 
			
		||||
    parseBlock: function PostScriptParser_parseBlock() {
 | 
			
		||||
      while (true) {
 | 
			
		||||
        if (this.accept(PostScriptTokenTypes.NUMBER)) {
 | 
			
		||||
          this.operators.push(this.prev.value);
 | 
			
		||||
@ -728,7 +728,7 @@ var PostScriptParser = (function PostScriptParserClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    parseCondition: function parseCondition() {
 | 
			
		||||
    parseCondition: function PostScriptParser_parseCondition() {
 | 
			
		||||
      // Add two place holders that will be updated later
 | 
			
		||||
      var conditionLocation = this.operators.length;
 | 
			
		||||
      this.operators.push(null, null);
 | 
			
		||||
@ -779,7 +779,7 @@ var PostScriptToken = (function PostScriptTokenClosure() {
 | 
			
		||||
 | 
			
		||||
  var opCache = {};
 | 
			
		||||
 | 
			
		||||
  PostScriptToken.getOperator = function getOperator(op) {
 | 
			
		||||
  PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
 | 
			
		||||
    var opValue = opCache[op];
 | 
			
		||||
    if (opValue)
 | 
			
		||||
      return opValue;
 | 
			
		||||
@ -802,7 +802,7 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
 | 
			
		||||
    this.stream = stream;
 | 
			
		||||
  }
 | 
			
		||||
  PostScriptLexer.prototype = {
 | 
			
		||||
    getToken: function getToken() {
 | 
			
		||||
    getToken: function PostScriptLexer_getToken() {
 | 
			
		||||
      var s = '';
 | 
			
		||||
      var ch;
 | 
			
		||||
      var comment = false;
 | 
			
		||||
@ -852,7 +852,7 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
 | 
			
		||||
          return PostScriptToken.getOperator(str);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getNumber: function getNumber(ch) {
 | 
			
		||||
    getNumber: function PostScriptLexer_getNumber(ch) {
 | 
			
		||||
      var str = ch;
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      while (true) {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								src/image.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/image.js
									
									
									
									
									
								
							@ -106,8 +106,8 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
   * Handles processing of image data and calls the callback with an argument
 | 
			
		||||
   * of a PDFImage when the image is ready to be used.
 | 
			
		||||
   */
 | 
			
		||||
  PDFImage.buildImage = function buildImage(callback, handler, xref, res,
 | 
			
		||||
                                               image, inline) {
 | 
			
		||||
  PDFImage.buildImage = function PDFImage_buildImage(callback, handler, xref,
 | 
			
		||||
                                                     res, image, inline) {
 | 
			
		||||
    var imageDataPromise = new Promise();
 | 
			
		||||
    var smaskPromise = new Promise();
 | 
			
		||||
    // The image data and smask data may not be ready yet, wait till both are
 | 
			
		||||
@ -139,7 +139,8 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
   * @param {Number} h2 New height.
 | 
			
		||||
   * @return {TypedArray} Resized image data.
 | 
			
		||||
   */
 | 
			
		||||
  PDFImage.resize = function resize(pixels, bpc, components, w1, h1, w2, h2) {
 | 
			
		||||
  PDFImage.resize = function PDFImage_resize(pixels, bpc, components,
 | 
			
		||||
                                             w1, h1, w2, h2) {
 | 
			
		||||
    var length = w2 * h2 * components;
 | 
			
		||||
    var temp = bpc <= 8 ? new Uint8Array(length) :
 | 
			
		||||
        bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
 | 
			
		||||
@ -177,7 +178,7 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
        return this.height;
 | 
			
		||||
      return Math.max(this.height, this.smask.height);
 | 
			
		||||
    },
 | 
			
		||||
    getComponents: function getComponents(buffer) {
 | 
			
		||||
    getComponents: function PDFImage_getComponents(buffer) {
 | 
			
		||||
      var bpc = this.bpc;
 | 
			
		||||
      var needsDecode = this.needsDecode;
 | 
			
		||||
      var decodeMap = this.decode;
 | 
			
		||||
@ -265,7 +266,7 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return output;
 | 
			
		||||
    },
 | 
			
		||||
    getOpacity: function getOpacity(width, height) {
 | 
			
		||||
    getOpacity: function PDFImage_getOpacity(width, height) {
 | 
			
		||||
      var smask = this.smask;
 | 
			
		||||
      var originalWidth = this.width;
 | 
			
		||||
      var originalHeight = this.height;
 | 
			
		||||
@ -285,7 +286,8 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return buf;
 | 
			
		||||
    },
 | 
			
		||||
    applyStencilMask: function applyStencilMask(buffer, inverseDecode) {
 | 
			
		||||
    applyStencilMask: function PDFImage_applyStencilMask(buffer,
 | 
			
		||||
                                                         inverseDecode) {
 | 
			
		||||
      var width = this.width, height = this.height;
 | 
			
		||||
      var bitStrideLength = (width + 7) >> 3;
 | 
			
		||||
      var imgArray = this.getImageBytes(bitStrideLength * height);
 | 
			
		||||
@ -308,7 +310,7 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    fillRgbaBuffer: function fillRgbaBuffer(buffer, width, height) {
 | 
			
		||||
    fillRgbaBuffer: function PDFImage_fillRgbaBuffer(buffer, width, height) {
 | 
			
		||||
      var numComps = this.numComps;
 | 
			
		||||
      var originalWidth = this.width;
 | 
			
		||||
      var originalHeight = this.height;
 | 
			
		||||
@ -335,7 +337,7 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
        buffer[i + 3] = opacity[opacityPos++];
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    fillGrayBuffer: function fillGrayBuffer(buffer) {
 | 
			
		||||
    fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
 | 
			
		||||
      var numComps = this.numComps;
 | 
			
		||||
      if (numComps != 1)
 | 
			
		||||
        error('Reading gray scale from a color image: ' + numComps);
 | 
			
		||||
@ -355,7 +357,7 @@ var PDFImage = (function PDFImageClosure() {
 | 
			
		||||
      for (var i = 0; i < length; ++i)
 | 
			
		||||
        buffer[i] = (scale * comps[i]) | 0;
 | 
			
		||||
    },
 | 
			
		||||
    getImageBytes: function getImageBytes(length) {
 | 
			
		||||
    getImageBytes: function PDFImage_getImageBytes(length) {
 | 
			
		||||
      this.image.reset();
 | 
			
		||||
      return this.image.getBytes(length);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2242
									
								
								src/jpx.js
									
									
									
									
									
								
							
							
						
						
									
										2242
									
								
								src/jpx.js
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -18,7 +18,7 @@ var Metadata = PDFJS.Metadata = (function MetadataClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Metadata.prototype = {
 | 
			
		||||
    parse: function() {
 | 
			
		||||
    parse: function Metadata_parse() {
 | 
			
		||||
      var doc = this.metaDocument;
 | 
			
		||||
      var rdf = doc.documentElement;
 | 
			
		||||
 | 
			
		||||
@ -53,11 +53,11 @@ var Metadata = PDFJS.Metadata = (function MetadataClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    get: function(name) {
 | 
			
		||||
    get: function Metadata_get(name) {
 | 
			
		||||
      return this.metadata[name] || null;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    has: function(name) {
 | 
			
		||||
    has: function Metadata_has(name) {
 | 
			
		||||
      return typeof this.metadata[name] !== 'undefined';
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								src/obj.js
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								src/obj.js
									
									
									
									
									
								
							@ -22,7 +22,7 @@ var Cmd = (function CmdClosure() {
 | 
			
		||||
 | 
			
		||||
  var cmdCache = {};
 | 
			
		||||
 | 
			
		||||
  Cmd.get = function cmdGet(cmd) {
 | 
			
		||||
  Cmd.get = function Cmd_get(cmd) {
 | 
			
		||||
    var cmdValue = cmdCache[cmd];
 | 
			
		||||
    if (cmdValue)
 | 
			
		||||
      return cmdValue;
 | 
			
		||||
@ -39,7 +39,7 @@ var Dict = (function DictClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Dict.prototype = {
 | 
			
		||||
    get: function dictGet(key1, key2, key3) {
 | 
			
		||||
    get: function Dict_get(key1, key2, key3) {
 | 
			
		||||
      var value;
 | 
			
		||||
      if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map ||
 | 
			
		||||
          typeof key2 == 'undefined') {
 | 
			
		||||
@ -53,15 +53,15 @@ var Dict = (function DictClosure() {
 | 
			
		||||
      return this.map[key3] || null;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    set: function dictSet(key, value) {
 | 
			
		||||
    set: function Dict_set(key, value) {
 | 
			
		||||
      this.map[key] = value;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    has: function dictHas(key) {
 | 
			
		||||
    has: function Dict_has(key) {
 | 
			
		||||
      return key in this.map;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    forEach: function dictForEach(callback) {
 | 
			
		||||
    forEach: function Dict_forEach(callback) {
 | 
			
		||||
      for (var key in this.map) {
 | 
			
		||||
        callback(key, this.map[key]);
 | 
			
		||||
      }
 | 
			
		||||
@ -90,11 +90,11 @@ var RefSet = (function RefSetClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  RefSet.prototype = {
 | 
			
		||||
    has: function refSetHas(ref) {
 | 
			
		||||
    has: function RefSet_has(ref) {
 | 
			
		||||
      return !!this.dict['R' + ref.num + '.' + ref.gen];
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    put: function refSetPut(ref) {
 | 
			
		||||
    put: function RefSet_put(ref) {
 | 
			
		||||
      this.dict['R' + ref.num + '.' + ref.gen] = ref;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -198,7 +198,7 @@ var Catalog = (function CatalogClosure() {
 | 
			
		||||
      // shadow the prototype getter
 | 
			
		||||
      return shadow(this, 'num', obj);
 | 
			
		||||
    },
 | 
			
		||||
    traverseKids: function catalogTraverseKids(pagesDict) {
 | 
			
		||||
    traverseKids: function Catalog_traverseKids(pagesDict) {
 | 
			
		||||
      var pageCache = this.pageCache;
 | 
			
		||||
      var kids = pagesDict.get('Kids');
 | 
			
		||||
      assertWellFormed(isArray(kids),
 | 
			
		||||
@ -268,7 +268,7 @@ var Catalog = (function CatalogClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return shadow(this, 'destinations', dests);
 | 
			
		||||
    },
 | 
			
		||||
    getPage: function catalogGetPage(n) {
 | 
			
		||||
    getPage: function Catalog_getPage(n) {
 | 
			
		||||
      var pageCache = this.pageCache;
 | 
			
		||||
      if (!pageCache) {
 | 
			
		||||
        pageCache = this.pageCache = [];
 | 
			
		||||
@ -304,7 +304,7 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  XRef.prototype = {
 | 
			
		||||
    readXRefTable: function readXRefTable(parser) {
 | 
			
		||||
    readXRefTable: function XRef_readXRefTable(parser) {
 | 
			
		||||
      // Example of cross-reference table:
 | 
			
		||||
      // xref
 | 
			
		||||
      // 0 1                    <-- subsection header (first obj #, obj count)
 | 
			
		||||
@ -371,7 +371,7 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
 | 
			
		||||
      return dict;
 | 
			
		||||
    },
 | 
			
		||||
    readXRefStream: function readXRefStream(stream) {
 | 
			
		||||
    readXRefStream: function XRef_readXRefStream(stream) {
 | 
			
		||||
      var streamParameters = stream.parameters;
 | 
			
		||||
      var byteWidths = streamParameters.get('W');
 | 
			
		||||
      var range = streamParameters.get('Index');
 | 
			
		||||
@ -422,7 +422,7 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return streamParameters;
 | 
			
		||||
    },
 | 
			
		||||
    indexObjects: function indexObjects() {
 | 
			
		||||
    indexObjects: function XRef_indexObjects() {
 | 
			
		||||
      // Simple scan through the PDF content to find objects,
 | 
			
		||||
      // trailers and XRef streams.
 | 
			
		||||
      function readToken(data, offset) {
 | 
			
		||||
@ -531,7 +531,7 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
      // nothing helps
 | 
			
		||||
      error('Invalid PDF structure');
 | 
			
		||||
    },
 | 
			
		||||
    readXRef: function readXref(startXRef) {
 | 
			
		||||
    readXRef: function XRef_readXRef(startXRef) {
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      stream.pos = startXRef;
 | 
			
		||||
 | 
			
		||||
@ -584,18 +584,18 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
      warn('Indexing all PDF objects');
 | 
			
		||||
      return this.indexObjects();
 | 
			
		||||
    },
 | 
			
		||||
    getEntry: function xRefGetEntry(i) {
 | 
			
		||||
    getEntry: function XRef_getEntry(i) {
 | 
			
		||||
      var e = this.entries[i];
 | 
			
		||||
      if (e === null)
 | 
			
		||||
        return null;
 | 
			
		||||
      return e.free ? null : e; // returns null is the entry is free
 | 
			
		||||
    },
 | 
			
		||||
    fetchIfRef: function xRefFetchIfRef(obj) {
 | 
			
		||||
    fetchIfRef: function XRef_fetchIfRef(obj) {
 | 
			
		||||
      if (!isRef(obj))
 | 
			
		||||
        return obj;
 | 
			
		||||
      return this.fetch(obj);
 | 
			
		||||
    },
 | 
			
		||||
    fetch: function xRefFetch(ref, suppressEncryption) {
 | 
			
		||||
    fetch: function XRef_fetch(ref, suppressEncryption) {
 | 
			
		||||
      var num = ref.num;
 | 
			
		||||
      if (num in this.cache)
 | 
			
		||||
        return this.cache[num];
 | 
			
		||||
@ -682,7 +682,7 @@ var XRef = (function XRefClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return e;
 | 
			
		||||
    },
 | 
			
		||||
    getCatalogObj: function xRefGetCatalogObj() {
 | 
			
		||||
    getCatalogObj: function XRef_getCatalogObj() {
 | 
			
		||||
      return this.fetch(this.root);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -709,7 +709,7 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
     * Ensures there is an object defined for `objId`. Stores `data` on the
 | 
			
		||||
     * object *if* it is created.
 | 
			
		||||
     */
 | 
			
		||||
    ensureObj: function pdfObjectsEnsureObj(objId, data) {
 | 
			
		||||
    ensureObj: function PDFObjects_ensureObj(objId, data) {
 | 
			
		||||
      if (this.objs[objId])
 | 
			
		||||
        return this.objs[objId];
 | 
			
		||||
      return this.objs[objId] = new Promise(objId, data);
 | 
			
		||||
@ -724,7 +724,7 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
     * function and the object is already resolved, the callback gets called
 | 
			
		||||
     * right away.
 | 
			
		||||
     */
 | 
			
		||||
    get: function pdfObjectsGet(objId, callback) {
 | 
			
		||||
    get: function PDFObjects_get(objId, callback) {
 | 
			
		||||
      // If there is a callback, then the get can be async and the object is
 | 
			
		||||
      // not required to be resolved right now
 | 
			
		||||
      if (callback) {
 | 
			
		||||
@ -747,7 +747,7 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
    /**
 | 
			
		||||
     * Resolves the object `objId` with optional `data`.
 | 
			
		||||
     */
 | 
			
		||||
    resolve: function pdfObjectsResolve(objId, data) {
 | 
			
		||||
    resolve: function PDFObjects_resolve(objId, data) {
 | 
			
		||||
      var objs = this.objs;
 | 
			
		||||
 | 
			
		||||
      // In case there is a promise already on this object, just resolve it.
 | 
			
		||||
@ -758,11 +758,11 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onData: function pdfObjectsOnData(objId, callback) {
 | 
			
		||||
    onData: function PDFObjects_onData(objId, callback) {
 | 
			
		||||
      this.ensureObj(objId).onData(callback);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    isResolved: function pdfObjectsIsResolved(objId) {
 | 
			
		||||
    isResolved: function PDFObjects_isResolved(objId) {
 | 
			
		||||
      var objs = this.objs;
 | 
			
		||||
      if (!objs[objId]) {
 | 
			
		||||
        return false;
 | 
			
		||||
@ -771,7 +771,7 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    hasData: function pdfObjectsHasData(objId) {
 | 
			
		||||
    hasData: function PDFObjects_hasData(objId) {
 | 
			
		||||
      var objs = this.objs;
 | 
			
		||||
      if (!objs[objId]) {
 | 
			
		||||
        return false;
 | 
			
		||||
@ -783,7 +783,7 @@ var PDFObjects = (function PDFObjectsClosure() {
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the data of an object but *doesn't* resolve it.
 | 
			
		||||
     */
 | 
			
		||||
    setData: function pdfObjectsSetData(objId, data) {
 | 
			
		||||
    setData: function PDFObjects_setData(objId, data) {
 | 
			
		||||
      // Watchout! If you call `this.ensureObj(objId, data)` you're going to
 | 
			
		||||
      // create a *resolved* promise which shouldn't be the case!
 | 
			
		||||
      this.ensureObj(objId).data = data;
 | 
			
		||||
 | 
			
		||||
@ -19,11 +19,11 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Parser.prototype = {
 | 
			
		||||
    refill: function parserRefill() {
 | 
			
		||||
    refill: function Parser_refill() {
 | 
			
		||||
      this.buf1 = this.lexer.getObj();
 | 
			
		||||
      this.buf2 = this.lexer.getObj();
 | 
			
		||||
    },
 | 
			
		||||
    shift: function parserShift() {
 | 
			
		||||
    shift: function Parser_shift() {
 | 
			
		||||
      if (isCmd(this.buf2, 'ID')) {
 | 
			
		||||
        this.buf1 = this.buf2;
 | 
			
		||||
        this.buf2 = null;
 | 
			
		||||
@ -34,7 +34,7 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
        this.buf2 = this.lexer.getObj();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    getObj: function parserGetObj(cipherTransform) {
 | 
			
		||||
    getObj: function Parser_getObj(cipherTransform) {
 | 
			
		||||
      if (isCmd(this.buf1, 'BI')) { // inline image
 | 
			
		||||
        this.shift();
 | 
			
		||||
        return this.makeInlineImage(cipherTransform);
 | 
			
		||||
@ -98,7 +98,7 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
      this.shift();
 | 
			
		||||
      return obj;
 | 
			
		||||
    },
 | 
			
		||||
    makeInlineImage: function parserMakeInlineImage(cipherTransform) {
 | 
			
		||||
    makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
 | 
			
		||||
      var lexer = this.lexer;
 | 
			
		||||
      var stream = lexer.stream;
 | 
			
		||||
 | 
			
		||||
@ -160,11 +160,11 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
 | 
			
		||||
      return imageStream;
 | 
			
		||||
    },
 | 
			
		||||
    fetchIfRef: function parserFetchIfRef(obj) {
 | 
			
		||||
    fetchIfRef: function Parser_fetchIfRef(obj) {
 | 
			
		||||
      // not relying on the xref.fetchIfRef -- xref might not be set
 | 
			
		||||
      return isRef(obj) ? this.xref.fetch(obj) : obj;
 | 
			
		||||
    },
 | 
			
		||||
    makeStream: function parserMakeStream(dict, cipherTransform) {
 | 
			
		||||
    makeStream: function Parser_makeStream(dict, cipherTransform) {
 | 
			
		||||
      var lexer = this.lexer;
 | 
			
		||||
      var stream = lexer.stream;
 | 
			
		||||
 | 
			
		||||
@ -192,7 +192,7 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
      stream.parameters = dict;
 | 
			
		||||
      return stream;
 | 
			
		||||
    },
 | 
			
		||||
    filter: function parserFilter(stream, dict, length) {
 | 
			
		||||
    filter: function Parser_filter(stream, dict, length) {
 | 
			
		||||
      var filter = this.fetchIfRef(dict.get('Filter', 'F'));
 | 
			
		||||
      var params = this.fetchIfRef(dict.get('DecodeParms', 'DP'));
 | 
			
		||||
      if (isName(filter))
 | 
			
		||||
@ -215,7 +215,7 @@ var Parser = (function ParserClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return stream;
 | 
			
		||||
    },
 | 
			
		||||
    makeFilter: function parserMakeFilter(stream, name, length, params) {
 | 
			
		||||
    makeFilter: function Parser_makeFilter(stream, name, length, params) {
 | 
			
		||||
      if (name == 'FlateDecode' || name == 'Fl') {
 | 
			
		||||
        if (params) {
 | 
			
		||||
          return new PredictorStream(new FlateStream(stream), params);
 | 
			
		||||
@ -265,7 +265,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
    this.stream = stream;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Lexer.isSpace = function lexerIsSpace(ch) {
 | 
			
		||||
  Lexer.isSpace = function Lexer_isSpace(ch) {
 | 
			
		||||
    return ch == ' ' || ch == '\t' || ch == '\x0d' || ch == '\x0a';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@ -300,7 +300,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Lexer.prototype = {
 | 
			
		||||
    getNumber: function lexerGetNumber(ch) {
 | 
			
		||||
    getNumber: function Lexer_getNumber(ch) {
 | 
			
		||||
      var floating = false;
 | 
			
		||||
      var str = ch;
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
@ -328,7 +328,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
        error('Invalid floating point number: ' + value);
 | 
			
		||||
      return value;
 | 
			
		||||
    },
 | 
			
		||||
    getString: function lexerGetString() {
 | 
			
		||||
    getString: function Lexer_getString() {
 | 
			
		||||
      var numParen = 1;
 | 
			
		||||
      var done = false;
 | 
			
		||||
      var str = '';
 | 
			
		||||
@ -412,7 +412,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
      } while (!done);
 | 
			
		||||
      return str;
 | 
			
		||||
    },
 | 
			
		||||
    getName: function lexerGetName(ch) {
 | 
			
		||||
    getName: function Lexer_getName(ch) {
 | 
			
		||||
      var str = '';
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) {
 | 
			
		||||
@ -439,7 +439,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
              str.length);
 | 
			
		||||
      return new Name(str);
 | 
			
		||||
    },
 | 
			
		||||
    getHexString: function lexerGetHexString(ch) {
 | 
			
		||||
    getHexString: function Lexer_getHexString(ch) {
 | 
			
		||||
      var str = '';
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      for (;;) {
 | 
			
		||||
@ -468,7 +468,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return str;
 | 
			
		||||
    },
 | 
			
		||||
    getObj: function lexerGetObj() {
 | 
			
		||||
    getObj: function Lexer_getObj() {
 | 
			
		||||
      // skip whitespace and comments
 | 
			
		||||
      var comment = false;
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
@ -541,7 +541,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
        return null;
 | 
			
		||||
      return Cmd.get(str);
 | 
			
		||||
    },
 | 
			
		||||
    skipToNextLine: function lexerSkipToNextLine() {
 | 
			
		||||
    skipToNextLine: function Lexer_skipToNextLine() {
 | 
			
		||||
      var stream = this.stream;
 | 
			
		||||
      while (true) {
 | 
			
		||||
        var ch = stream.getChar();
 | 
			
		||||
@ -554,7 +554,7 @@ var Lexer = (function LexerClosure() {
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    skip: function lexerSkip() {
 | 
			
		||||
    skip: function Lexer_skip() {
 | 
			
		||||
      this.stream.skip();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -578,7 +578,7 @@ var Linearization = (function LinearizationClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Linearization.prototype = {
 | 
			
		||||
    getInt: function linearizationGetInt(name) {
 | 
			
		||||
    getInt: function Linearization_getInt(name) {
 | 
			
		||||
      var linDict = this.linDict;
 | 
			
		||||
      var obj;
 | 
			
		||||
      if (isDict(linDict) &&
 | 
			
		||||
@ -588,7 +588,7 @@ var Linearization = (function LinearizationClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      error('"' + name + '" field in linearization table is invalid');
 | 
			
		||||
    },
 | 
			
		||||
    getHint: function linearizationGetHint(index) {
 | 
			
		||||
    getHint: function Linearization_getHint(index) {
 | 
			
		||||
      var linDict = this.linDict;
 | 
			
		||||
      var obj1, obj2;
 | 
			
		||||
      if (isDict(linDict) &&
 | 
			
		||||
 | 
			
		||||
@ -17,16 +17,16 @@ var Pattern = (function PatternClosure() {
 | 
			
		||||
  Pattern.prototype = {
 | 
			
		||||
    // Input: current Canvas context
 | 
			
		||||
    // Output: the appropriate fillStyle or strokeStyle
 | 
			
		||||
    getPattern: function pattern_getStyle(ctx) {
 | 
			
		||||
    getPattern: function Pattern_getPattern(ctx) {
 | 
			
		||||
      error('Should not call Pattern.getStyle: ' + ctx);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  Pattern.shadingFromIR = function pattern_shadingFromIR(ctx, raw) {
 | 
			
		||||
  Pattern.shadingFromIR = function Pattern_shadingFromIR(ctx, raw) {
 | 
			
		||||
    return Shadings[raw[0]].fromIR(ctx, raw);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  Pattern.parseShading = function pattern_shading(shading, matrix, xref,
 | 
			
		||||
  Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref,
 | 
			
		||||
                                                      res, ctx) {
 | 
			
		||||
 | 
			
		||||
    var dict = isStream(shading) ? shading.dict : shading;
 | 
			
		||||
@ -102,7 +102,7 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
 | 
			
		||||
    this.colorStops = colorStops;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  RadialAxial.fromIR = function radialAxialShadingGetIR(ctx, raw) {
 | 
			
		||||
  RadialAxial.fromIR = function RadialAxial_fromIR(ctx, raw) {
 | 
			
		||||
    var type = raw[1];
 | 
			
		||||
    var colorStops = raw[2];
 | 
			
		||||
    var p0 = raw[3];
 | 
			
		||||
@ -135,7 +135,7 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  RadialAxial.prototype = {
 | 
			
		||||
    getIR: function radialAxialShadingGetIR() {
 | 
			
		||||
    getIR: function RadialAxial_getIR() {
 | 
			
		||||
      var coordsArr = this.coordsArr;
 | 
			
		||||
      var type = this.shadingType;
 | 
			
		||||
      if (type == PatternType.AXIAL) {
 | 
			
		||||
@ -170,12 +170,12 @@ Shadings.Dummy = (function DummyClosure() {
 | 
			
		||||
    this.type = 'Pattern';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Dummy.fromIR = function dummyShadingFromIR() {
 | 
			
		||||
  Dummy.fromIR = function Dummy_fromIR() {
 | 
			
		||||
    return 'hotpink';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  Dummy.prototype = {
 | 
			
		||||
    getIR: function dummyShadingGetIR() {
 | 
			
		||||
    getIR: function Dummy_getIR() {
 | 
			
		||||
      return ['Dummy'];
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -264,7 +264,7 @@ var TilingPattern = (function TilingPatternClosure() {
 | 
			
		||||
    this.canvas = tmpCanvas;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  TilingPattern.getIR = function tiling_getIR(operatorList, dict, args) {
 | 
			
		||||
  TilingPattern.getIR = function TilingPattern_getIR(operatorList, dict, args) {
 | 
			
		||||
    var matrix = dict.get('Matrix');
 | 
			
		||||
    var bbox = dict.get('BBox');
 | 
			
		||||
    var xstep = dict.get('XStep');
 | 
			
		||||
@ -277,7 +277,7 @@ var TilingPattern = (function TilingPatternClosure() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  TilingPattern.prototype = {
 | 
			
		||||
    getPattern: function tiling_getPattern() {
 | 
			
		||||
    getPattern: function TilingPattern_getPattern() {
 | 
			
		||||
      var matrix = this.matrix;
 | 
			
		||||
      var curMatrix = this.curMatrix;
 | 
			
		||||
      var ctx = this.ctx;
 | 
			
		||||
 | 
			
		||||
@ -18,14 +18,14 @@ var Stream = (function StreamClosure() {
 | 
			
		||||
    get length() {
 | 
			
		||||
      return this.end - this.start;
 | 
			
		||||
    },
 | 
			
		||||
    getByte: function stream_getByte() {
 | 
			
		||||
    getByte: function Stream_getByte() {
 | 
			
		||||
      if (this.pos >= this.end)
 | 
			
		||||
        return null;
 | 
			
		||||
      return this.bytes[this.pos++];
 | 
			
		||||
    },
 | 
			
		||||
    // returns subarray of original buffer
 | 
			
		||||
    // should only be read
 | 
			
		||||
    getBytes: function stream_getBytes(length) {
 | 
			
		||||
    getBytes: function Stream_getBytes(length) {
 | 
			
		||||
      var bytes = this.bytes;
 | 
			
		||||
      var pos = this.pos;
 | 
			
		||||
      var strEnd = this.end;
 | 
			
		||||
@ -40,28 +40,28 @@ var Stream = (function StreamClosure() {
 | 
			
		||||
      this.pos = end;
 | 
			
		||||
      return bytes.subarray(pos, end);
 | 
			
		||||
    },
 | 
			
		||||
    lookChar: function stream_lookChar() {
 | 
			
		||||
    lookChar: function Stream_lookChar() {
 | 
			
		||||
      if (this.pos >= this.end)
 | 
			
		||||
        return null;
 | 
			
		||||
      return String.fromCharCode(this.bytes[this.pos]);
 | 
			
		||||
    },
 | 
			
		||||
    getChar: function stream_getChar() {
 | 
			
		||||
    getChar: function Stream_getChar() {
 | 
			
		||||
      if (this.pos >= this.end)
 | 
			
		||||
        return null;
 | 
			
		||||
      return String.fromCharCode(this.bytes[this.pos++]);
 | 
			
		||||
    },
 | 
			
		||||
    skip: function stream_skip(n) {
 | 
			
		||||
    skip: function Stream_skip(n) {
 | 
			
		||||
      if (!n)
 | 
			
		||||
        n = 1;
 | 
			
		||||
      this.pos += n;
 | 
			
		||||
    },
 | 
			
		||||
    reset: function stream_reset() {
 | 
			
		||||
    reset: function Stream_reset() {
 | 
			
		||||
      this.pos = this.start;
 | 
			
		||||
    },
 | 
			
		||||
    moveStart: function stream_moveStart() {
 | 
			
		||||
    moveStart: function Stream_moveStart() {
 | 
			
		||||
      this.start = this.pos;
 | 
			
		||||
    },
 | 
			
		||||
    makeSubStream: function stream_makeSubstream(start, length, dict) {
 | 
			
		||||
    makeSubStream: function Stream_makeSubStream(start, length, dict) {
 | 
			
		||||
      return new Stream(this.bytes.buffer, start, length, dict);
 | 
			
		||||
    },
 | 
			
		||||
    isStream: true
 | 
			
		||||
@ -94,7 +94,7 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  DecodeStream.prototype = {
 | 
			
		||||
    ensureBuffer: function decodestream_ensureBuffer(requested) {
 | 
			
		||||
    ensureBuffer: function DecodeStream_ensureBuffer(requested) {
 | 
			
		||||
      var buffer = this.buffer;
 | 
			
		||||
      var current = buffer ? buffer.byteLength : 0;
 | 
			
		||||
      if (requested < current)
 | 
			
		||||
@ -107,7 +107,7 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
        buffer2[i] = buffer[i];
 | 
			
		||||
      return (this.buffer = buffer2);
 | 
			
		||||
    },
 | 
			
		||||
    getByte: function decodestream_getByte() {
 | 
			
		||||
    getByte: function DecodeStream_getByte() {
 | 
			
		||||
      var pos = this.pos;
 | 
			
		||||
      while (this.bufferLength <= pos) {
 | 
			
		||||
        if (this.eof)
 | 
			
		||||
@ -116,7 +116,7 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return this.buffer[this.pos++];
 | 
			
		||||
    },
 | 
			
		||||
    getBytes: function decodestream_getBytes(length) {
 | 
			
		||||
    getBytes: function DecodeStream_getBytes(length) {
 | 
			
		||||
      var end, pos = this.pos;
 | 
			
		||||
 | 
			
		||||
      if (length) {
 | 
			
		||||
@ -144,7 +144,7 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
      this.pos = end;
 | 
			
		||||
      return this.buffer.subarray(pos, end);
 | 
			
		||||
    },
 | 
			
		||||
    lookChar: function decodestream_lookChar() {
 | 
			
		||||
    lookChar: function DecodeStream_lookChar() {
 | 
			
		||||
      var pos = this.pos;
 | 
			
		||||
      while (this.bufferLength <= pos) {
 | 
			
		||||
        if (this.eof)
 | 
			
		||||
@ -153,7 +153,7 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return String.fromCharCode(this.buffer[this.pos]);
 | 
			
		||||
    },
 | 
			
		||||
    getChar: function decodestream_getChar() {
 | 
			
		||||
    getChar: function DecodeStream_getChar() {
 | 
			
		||||
      var pos = this.pos;
 | 
			
		||||
      while (this.bufferLength <= pos) {
 | 
			
		||||
        if (this.eof)
 | 
			
		||||
@ -162,18 +162,18 @@ var DecodeStream = (function DecodeStreamClosure() {
 | 
			
		||||
      }
 | 
			
		||||
      return String.fromCharCode(this.buffer[this.pos++]);
 | 
			
		||||
    },
 | 
			
		||||
    makeSubStream: function decodestream_makeSubstream(start, length, dict) {
 | 
			
		||||
    makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
 | 
			
		||||
      var end = start + length;
 | 
			
		||||
      while (this.bufferLength <= end && !this.eof)
 | 
			
		||||
        this.readBlock();
 | 
			
		||||
      return new Stream(this.buffer, start, length, dict);
 | 
			
		||||
    },
 | 
			
		||||
    skip: function decodestream_skip(n) {
 | 
			
		||||
    skip: function DecodeStream_skip(n) {
 | 
			
		||||
      if (!n)
 | 
			
		||||
        n = 1;
 | 
			
		||||
      this.pos += n;
 | 
			
		||||
    },
 | 
			
		||||
    reset: function decodestream_reset() {
 | 
			
		||||
    reset: function DecodeStream_reset() {
 | 
			
		||||
      this.pos = 0;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
@ -188,14 +188,14 @@ var FakeStream = (function FakeStreamClosure() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  FakeStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
  FakeStream.prototype.readBlock = function fakeStreamReadBlock() {
 | 
			
		||||
  FakeStream.prototype.readBlock = function FakeStream_readBlock() {
 | 
			
		||||
    var bufferLength = this.bufferLength;
 | 
			
		||||
    bufferLength += 1024;
 | 
			
		||||
    var buffer = this.ensureBuffer(bufferLength);
 | 
			
		||||
    this.bufferLength = bufferLength;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  FakeStream.prototype.getBytes = function fakeStreamGetBytes(length) {
 | 
			
		||||
  FakeStream.prototype.getBytes = function FakeStream_getBytes(length) {
 | 
			
		||||
    var end, pos = this.pos;
 | 
			
		||||
 | 
			
		||||
    if (length) {
 | 
			
		||||
@ -368,7 +368,7 @@ var FlateStream = (function FlateStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  FlateStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  FlateStream.prototype.getBits = function flateStreamGetBits(bits) {
 | 
			
		||||
  FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
 | 
			
		||||
    var codeSize = this.codeSize;
 | 
			
		||||
    var codeBuf = this.codeBuf;
 | 
			
		||||
    var bytes = this.bytes;
 | 
			
		||||
@ -388,7 +388,7 @@ var FlateStream = (function FlateStreamClosure() {
 | 
			
		||||
    return b;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  FlateStream.prototype.getCode = function flateStreamGetCode(table) {
 | 
			
		||||
  FlateStream.prototype.getCode = function FlateStream_getCode(table) {
 | 
			
		||||
    var codes = table[0];
 | 
			
		||||
    var maxLen = table[1];
 | 
			
		||||
    var codeSize = this.codeSize;
 | 
			
		||||
@ -453,7 +453,7 @@ var FlateStream = (function FlateStreamClosure() {
 | 
			
		||||
    return [codes, maxLen];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  FlateStream.prototype.readBlock = function flateStreamReadBlock() {
 | 
			
		||||
  FlateStream.prototype.readBlock = function FlateStream_readBlock() {
 | 
			
		||||
    // read block header
 | 
			
		||||
    var hdr = this.getBits(3);
 | 
			
		||||
    if (hdr & 1)
 | 
			
		||||
@ -823,7 +823,7 @@ var JpegStream = (function JpegStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  JpegStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  JpegStream.prototype.ensureBuffer = function jpegStreamEnsureBuffer(req) {
 | 
			
		||||
  JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
 | 
			
		||||
    if (this.bufferLength)
 | 
			
		||||
      return;
 | 
			
		||||
    try {
 | 
			
		||||
@ -840,18 +840,18 @@ var JpegStream = (function JpegStreamClosure() {
 | 
			
		||||
      error('JPEG error: ' + e);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  JpegStream.prototype.getIR = function jpegStreamGetIR() {
 | 
			
		||||
  JpegStream.prototype.getIR = function JpegStream_getIR() {
 | 
			
		||||
    return bytesToString(this.bytes);
 | 
			
		||||
  };
 | 
			
		||||
  JpegStream.prototype.getChar = function jpegStreamGetChar() {
 | 
			
		||||
  JpegStream.prototype.getChar = function JpegStream_getChar() {
 | 
			
		||||
    error('internal error: getChar is not valid on JpegStream');
 | 
			
		||||
  };
 | 
			
		||||
  /**
 | 
			
		||||
   * Checks if the image can be decoded and displayed by the browser without any
 | 
			
		||||
   * further processing such as color space conversions.
 | 
			
		||||
   */
 | 
			
		||||
  JpegStream.prototype.isNativelySupported = function isNativelySupported(xref,
 | 
			
		||||
                                                                          res) {
 | 
			
		||||
  JpegStream.prototype.isNativelySupported =
 | 
			
		||||
    function JpegStream_isNativelySupported(xref, res) {
 | 
			
		||||
    var cs = ColorSpace.parse(this.dict.get('ColorSpace'), xref, res);
 | 
			
		||||
    // when bug 674619 lands, let's check if browser can do
 | 
			
		||||
    // normal cmyk and then we won't need to decode in JS
 | 
			
		||||
@ -865,8 +865,8 @@ var JpegStream = (function JpegStreamClosure() {
 | 
			
		||||
  /**
 | 
			
		||||
   * Checks if the image can be decoded by the browser.
 | 
			
		||||
   */
 | 
			
		||||
  JpegStream.prototype.isNativelyDecodable = function isNativelyDecodable(xref,
 | 
			
		||||
                                                                          res) {
 | 
			
		||||
  JpegStream.prototype.isNativelyDecodable =
 | 
			
		||||
    function JpegStream_isNativelyDecodable(xref, res) {
 | 
			
		||||
    var cs = ColorSpace.parse(this.dict.get('ColorSpace'), xref, res);
 | 
			
		||||
    var numComps = cs.numComps;
 | 
			
		||||
    if (numComps == 1 || numComps == 3)
 | 
			
		||||
@ -892,7 +892,7 @@ var JpxStream = (function JpxStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  JpxStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  JpxStream.prototype.ensureBuffer = function jpxStreamEnsureBuffer(req) {
 | 
			
		||||
  JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
 | 
			
		||||
    if (this.bufferLength)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
@ -972,7 +972,7 @@ var JpxStream = (function JpxStreamClosure() {
 | 
			
		||||
    this.buffer = data;
 | 
			
		||||
    this.bufferLength = data.length;
 | 
			
		||||
  };
 | 
			
		||||
  JpxStream.prototype.getChar = function jpxStreamGetChar() {
 | 
			
		||||
  JpxStream.prototype.getChar = function JpxStream_getChar() {
 | 
			
		||||
    error('internal error: getChar is not valid on JpxStream');
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@ -992,7 +992,7 @@ var DecryptStream = (function DecryptStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  DecryptStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  DecryptStream.prototype.readBlock = function decryptStreamReadBlock() {
 | 
			
		||||
  DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
 | 
			
		||||
    var chunk = this.str.getBytes(chunkSize);
 | 
			
		||||
    if (!chunk || chunk.length == 0) {
 | 
			
		||||
      this.eof = true;
 | 
			
		||||
@ -1023,7 +1023,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
 | 
			
		||||
 | 
			
		||||
  Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  Ascii85Stream.prototype.readBlock = function ascii85StreamReadBlock() {
 | 
			
		||||
  Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
 | 
			
		||||
    var tildaCode = '~'.charCodeAt(0);
 | 
			
		||||
    var zCode = 'z'.charCodeAt(0);
 | 
			
		||||
    var str = this.str;
 | 
			
		||||
@ -1118,7 +1118,7 @@ var AsciiHexStream = (function AsciiHexStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  AsciiHexStream.prototype.readBlock = function asciiHexStreamReadBlock() {
 | 
			
		||||
  AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
 | 
			
		||||
    var gtCode = '>'.charCodeAt(0), bytes = this.str.getBytes(), c, n,
 | 
			
		||||
        decodeLength, buffer, bufferLength, i, length;
 | 
			
		||||
 | 
			
		||||
@ -1161,7 +1161,7 @@ var RunLengthStream = (function RunLengthStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  RunLengthStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  RunLengthStream.prototype.readBlock = function runLengthStreamReadBlock() {
 | 
			
		||||
  RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
 | 
			
		||||
    // The repeatHeader has following format. The first byte defines type of run
 | 
			
		||||
    // and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes
 | 
			
		||||
    // (in addition to the second byte from the header), n = 129 through 255 -
 | 
			
		||||
@ -1671,7 +1671,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  CCITTFaxStream.prototype.readBlock = function ccittFaxStreamReadBlock() {
 | 
			
		||||
  CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
 | 
			
		||||
    while (!this.eof) {
 | 
			
		||||
      var c = this.lookChar();
 | 
			
		||||
      this.buf = EOF;
 | 
			
		||||
@ -1729,7 +1729,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
 | 
			
		||||
    this.codingPos = codingPos;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  CCITTFaxStream.prototype.lookChar = function ccittFaxStreamLookChar() {
 | 
			
		||||
  CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
 | 
			
		||||
    if (this.buf != EOF)
 | 
			
		||||
      return this.buf;
 | 
			
		||||
 | 
			
		||||
@ -2140,7 +2140,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
 | 
			
		||||
    return 1;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  CCITTFaxStream.prototype.lookBits = function ccittFaxStreamLookBits(n) {
 | 
			
		||||
  CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
 | 
			
		||||
    var c;
 | 
			
		||||
    while (this.inputBits < n) {
 | 
			
		||||
      if ((c = this.str.getByte()) == null) {
 | 
			
		||||
@ -2155,7 +2155,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
 | 
			
		||||
    return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n));
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  CCITTFaxStream.prototype.eatBits = function ccittFaxStreamEatBits(n) {
 | 
			
		||||
  CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
 | 
			
		||||
    if ((this.inputBits -= n) < 0)
 | 
			
		||||
      this.inputBits = 0;
 | 
			
		||||
  };
 | 
			
		||||
@ -2192,7 +2192,7 @@ var LZWStream = (function LZWStreamClosure() {
 | 
			
		||||
 | 
			
		||||
  LZWStream.prototype = Object.create(DecodeStream.prototype);
 | 
			
		||||
 | 
			
		||||
  LZWStream.prototype.readBits = function lzwStreamReadBits(n) {
 | 
			
		||||
  LZWStream.prototype.readBits = function LZWStream_readBits(n) {
 | 
			
		||||
    var bitsCached = this.bitsCached;
 | 
			
		||||
    var cachedData = this.cachedData;
 | 
			
		||||
    while (bitsCached < n) {
 | 
			
		||||
@ -2210,7 +2210,7 @@ var LZWStream = (function LZWStreamClosure() {
 | 
			
		||||
    return (cachedData >>> bitsCached) & ((1 << n) - 1);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  LZWStream.prototype.readBlock = function lzwStreamReadBlock() {
 | 
			
		||||
  LZWStream.prototype.readBlock = function LZWStream_readBlock() {
 | 
			
		||||
    var blockSize = 512;
 | 
			
		||||
    var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
 | 
			
		||||
    var i, j, q;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								src/util.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/util.js
									
									
									
									
									
								
							@ -79,19 +79,19 @@ var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
 | 
			
		||||
var Util = (function UtilClosure() {
 | 
			
		||||
  function Util() {}
 | 
			
		||||
 | 
			
		||||
  Util.makeCssRgb = function makergb(r, g, b) {
 | 
			
		||||
  Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
 | 
			
		||||
    var ri = (255 * r) | 0, gi = (255 * g) | 0, bi = (255 * b) | 0;
 | 
			
		||||
    return 'rgb(' + ri + ',' + gi + ',' + bi + ')';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  Util.makeCssCmyk = function makecmyk(c, m, y, k) {
 | 
			
		||||
  Util.makeCssCmyk = function Util_makeCssCmyk(c, m, y, k) {
 | 
			
		||||
    c = (new DeviceCmykCS()).getRgb([c, m, y, k]);
 | 
			
		||||
    var ri = (255 * c[0]) | 0, gi = (255 * c[1]) | 0, bi = (255 * c[2]) | 0;
 | 
			
		||||
    return 'rgb(' + ri + ',' + gi + ',' + bi + ')';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  // For 2d affine transforms
 | 
			
		||||
  Util.applyTransform = function apply(p, m) {
 | 
			
		||||
  Util.applyTransform = function Util_applyTransform(p, m) {
 | 
			
		||||
    var xt = p[0] * m[0] + p[1] * m[2] + m[4];
 | 
			
		||||
    var yt = p[0] * m[1] + p[1] * m[3] + m[5];
 | 
			
		||||
    return [xt, yt];
 | 
			
		||||
@ -103,7 +103,7 @@ var Util = (function UtilClosure() {
 | 
			
		||||
  //   | g h i |   | Z |
 | 
			
		||||
  // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],
 | 
			
		||||
  // with v as [X,Y,Z]
 | 
			
		||||
  Util.apply3dTransform = function apply3d(m, v) {
 | 
			
		||||
  Util.apply3dTransform = function Util_apply3dTransform(m, v) {
 | 
			
		||||
    return [
 | 
			
		||||
      m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
 | 
			
		||||
      m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
 | 
			
		||||
@ -115,7 +115,7 @@ var Util = (function UtilClosure() {
 | 
			
		||||
  // For coordinate systems whose origin lies in the bottom-left, this
 | 
			
		||||
  // means normalization to (BL,TR) ordering. For systems with origin in the
 | 
			
		||||
  // top-left, this means (TL,BR) ordering.
 | 
			
		||||
  Util.normalizeRect = function normalizeRect(rect) {
 | 
			
		||||
  Util.normalizeRect = function Util_normalizeRect(rect) {
 | 
			
		||||
    var r = rect.slice(0); // clone rect
 | 
			
		||||
    if (rect[0] > rect[2]) {
 | 
			
		||||
      r[0] = rect[2];
 | 
			
		||||
@ -131,7 +131,7 @@ var Util = (function UtilClosure() {
 | 
			
		||||
  // Returns a rectangle [x1, y1, x2, y2] corresponding to the
 | 
			
		||||
  // intersection of rect1 and rect2. If no intersection, returns 'false'
 | 
			
		||||
  // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
 | 
			
		||||
  Util.intersect = function intersect(rect1, rect2) {
 | 
			
		||||
  Util.intersect = function Util_intersect(rect1, rect2) {
 | 
			
		||||
    function compare(a, b) {
 | 
			
		||||
      return a - b;
 | 
			
		||||
    };
 | 
			
		||||
@ -167,7 +167,7 @@ var Util = (function UtilClosure() {
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Util.sign = function sign(num) {
 | 
			
		||||
  Util.sign = function Util_sign(num) {
 | 
			
		||||
    return num < 0 ? -1 : 1;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@ -304,7 +304,7 @@ var Promise = (function PromiseClosure() {
 | 
			
		||||
   * @param {Promise[]} promises Array of promises to wait for.
 | 
			
		||||
   * @return {Promise} New dependant promise.
 | 
			
		||||
   */
 | 
			
		||||
  Promise.all = function(promises) {
 | 
			
		||||
  Promise.all = function Promise_all(promises) {
 | 
			
		||||
    var deferred = new Promise();
 | 
			
		||||
    var unresolved = promises.length;
 | 
			
		||||
    var results = [];
 | 
			
		||||
@ -351,7 +351,7 @@ var Promise = (function PromiseClosure() {
 | 
			
		||||
      return this._data;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onData: function promiseOnData(callback) {
 | 
			
		||||
    onData: function Promise_onData(callback) {
 | 
			
		||||
      if (this._data !== EMPTY_PROMISE) {
 | 
			
		||||
        callback(this._data);
 | 
			
		||||
      } else {
 | 
			
		||||
@ -359,7 +359,7 @@ var Promise = (function PromiseClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    resolve: function promiseResolve(data) {
 | 
			
		||||
    resolve: function Promise_resolve(data) {
 | 
			
		||||
      if (this.isResolved) {
 | 
			
		||||
        error('A Promise can be resolved only once ' + this.name);
 | 
			
		||||
      }
 | 
			
		||||
@ -376,7 +376,7 @@ var Promise = (function PromiseClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    reject: function proimseReject(reason) {
 | 
			
		||||
    reject: function Promise_reject(reason) {
 | 
			
		||||
      if (this.isRejected) {
 | 
			
		||||
        error('A Promise can be rejected only once ' + this.name);
 | 
			
		||||
      }
 | 
			
		||||
@ -393,7 +393,7 @@ var Promise = (function PromiseClosure() {
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    then: function promiseThen(callback, errback) {
 | 
			
		||||
    then: function Promise_then(callback, errback) {
 | 
			
		||||
      if (!callback) {
 | 
			
		||||
        error('Requiring callback' + this.name);
 | 
			
		||||
      }
 | 
			
		||||
@ -428,14 +428,14 @@ var StatTimer = (function StatTimerClosure() {
 | 
			
		||||
    this.enabled = true;
 | 
			
		||||
  }
 | 
			
		||||
  StatTimer.prototype = {
 | 
			
		||||
    time: function statTimerTime(name) {
 | 
			
		||||
    time: function StatTimer_time(name) {
 | 
			
		||||
      if (!this.enabled)
 | 
			
		||||
        return;
 | 
			
		||||
      if (name in this.started)
 | 
			
		||||
        throw 'Timer is already running for ' + name;
 | 
			
		||||
      this.started[name] = Date.now();
 | 
			
		||||
    },
 | 
			
		||||
    timeEnd: function statTimerTimeEnd(name) {
 | 
			
		||||
    timeEnd: function StatTimer_timeEnd(name) {
 | 
			
		||||
      if (!this.enabled)
 | 
			
		||||
        return;
 | 
			
		||||
      if (!(name in this.started))
 | 
			
		||||
@ -448,7 +448,7 @@ var StatTimer = (function StatTimerClosure() {
 | 
			
		||||
      // Remove timer from started so it can be called again.
 | 
			
		||||
      delete this.started[name];
 | 
			
		||||
    },
 | 
			
		||||
    toString: function statTimerToString() {
 | 
			
		||||
    toString: function StatTimer_toString() {
 | 
			
		||||
      var times = this.times;
 | 
			
		||||
      var out = '';
 | 
			
		||||
      // Find the longest name for padding purposes.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user