Issue #644: bypassing identity cmap translation loading; resetting color space when stroke/fill color set

This commit is contained in:
notmasteryet 2011-11-15 18:23:45 -06:00
parent 4bdc252cb3
commit ef58ccd284
2 changed files with 21 additions and 1 deletions

View File

@ -594,27 +594,45 @@ var CanvasGraphics = (function canvasGraphics() {
}
},
setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
if (!(this.current.strokeColorSpace instanceof DeviceGrayCS))
this.current.strokeColorSpace = new DeviceGrayCS();
this.setStrokeRGBColor(gray, gray, gray);
},
setFillGray: function canvasGraphicsSetFillGray(gray) {
if (!(this.current.fillColorSpace instanceof DeviceGrayCS))
this.current.fillColorSpace = new DeviceGrayCS();
this.setFillRGBColor(gray, gray, gray);
},
setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
if (!(this.current.strokeColorSpace instanceof DeviceRgbCS))
this.current.strokeColorSpace = new DeviceRgbCS();
var color = Util.makeCssRgb(r, g, b);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
if (!(this.current.fillColorSpace instanceof DeviceRgbCS))
this.current.fillColorSpace = new DeviceRgbCS();
var color = Util.makeCssRgb(r, g, b);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
if (!(this.current.strokeColorSpace instanceof DeviceCmykCS))
this.current.strokeColorSpace = new DeviceCmykCS();
var color = Util.makeCssCmyk(c, m, y, k);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
if (!(this.current.fillColorSpace instanceof DeviceCmykCS))
this.current.fillColorSpace = new DeviceCmykCS();
var color = Util.makeCssCmyk(c, m, y, k);
this.ctx.fillStyle = color;
this.current.fillColor = color;

View File

@ -522,7 +522,9 @@ var PartialEvaluator = (function partialEvaluator() {
var cmapObj = xref.fetchIfRef(toUnicode);
var charToUnicode = [];
if (isName(cmapObj)) {
error('ToUnicode file cmap translation not implemented');
var isIdentityMap = cmapObj.name.substr(0, 9) == 'Identity-';
if (!isIdentityMap)
error('ToUnicode file cmap translation not implemented');
} else if (isStream(cmapObj)) {
var tokens = [];
var token = '';