Issue #644: bypassing identity cmap translation loading; resetting color space when stroke/fill color set
This commit is contained in:
parent
4bdc252cb3
commit
ef58ccd284
@ -594,27 +594,45 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
|
setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
|
||||||
|
if (!(this.current.strokeColorSpace instanceof DeviceGrayCS))
|
||||||
|
this.current.strokeColorSpace = new DeviceGrayCS();
|
||||||
|
|
||||||
this.setStrokeRGBColor(gray, gray, gray);
|
this.setStrokeRGBColor(gray, gray, gray);
|
||||||
},
|
},
|
||||||
setFillGray: function canvasGraphicsSetFillGray(gray) {
|
setFillGray: function canvasGraphicsSetFillGray(gray) {
|
||||||
|
if (!(this.current.fillColorSpace instanceof DeviceGrayCS))
|
||||||
|
this.current.fillColorSpace = new DeviceGrayCS();
|
||||||
|
|
||||||
this.setFillRGBColor(gray, gray, gray);
|
this.setFillRGBColor(gray, gray, gray);
|
||||||
},
|
},
|
||||||
setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
|
setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
|
||||||
|
if (!(this.current.strokeColorSpace instanceof DeviceRgbCS))
|
||||||
|
this.current.strokeColorSpace = new DeviceRgbCS();
|
||||||
|
|
||||||
var color = Util.makeCssRgb(r, g, b);
|
var color = Util.makeCssRgb(r, g, b);
|
||||||
this.ctx.strokeStyle = color;
|
this.ctx.strokeStyle = color;
|
||||||
this.current.strokeColor = color;
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
|
setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
|
||||||
|
if (!(this.current.fillColorSpace instanceof DeviceRgbCS))
|
||||||
|
this.current.fillColorSpace = new DeviceRgbCS();
|
||||||
|
|
||||||
var color = Util.makeCssRgb(r, g, b);
|
var color = Util.makeCssRgb(r, g, b);
|
||||||
this.ctx.fillStyle = color;
|
this.ctx.fillStyle = color;
|
||||||
this.current.fillColor = color;
|
this.current.fillColor = color;
|
||||||
},
|
},
|
||||||
setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
|
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);
|
var color = Util.makeCssCmyk(c, m, y, k);
|
||||||
this.ctx.strokeStyle = color;
|
this.ctx.strokeStyle = color;
|
||||||
this.current.strokeColor = color;
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
|
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);
|
var color = Util.makeCssCmyk(c, m, y, k);
|
||||||
this.ctx.fillStyle = color;
|
this.ctx.fillStyle = color;
|
||||||
this.current.fillColor = color;
|
this.current.fillColor = color;
|
||||||
|
@ -522,7 +522,9 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var cmapObj = xref.fetchIfRef(toUnicode);
|
var cmapObj = xref.fetchIfRef(toUnicode);
|
||||||
var charToUnicode = [];
|
var charToUnicode = [];
|
||||||
if (isName(cmapObj)) {
|
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)) {
|
} else if (isStream(cmapObj)) {
|
||||||
var tokens = [];
|
var tokens = [];
|
||||||
var token = '';
|
var token = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user