Suppress invisible text (#799)
This commit is contained in:
parent
c0291e9fa3
commit
00d1204705
@ -23,6 +23,7 @@ var CanvasExtraState = (function canvasExtraState() {
|
|||||||
this.charSpacing = 0;
|
this.charSpacing = 0;
|
||||||
this.wordSpacing = 0;
|
this.wordSpacing = 0;
|
||||||
this.textHScale = 1;
|
this.textHScale = 1;
|
||||||
|
this.textRenderingMode = 0;
|
||||||
// Color spaces
|
// Color spaces
|
||||||
this.fillColorSpace = new DeviceGrayCS();
|
this.fillColorSpace = new DeviceGrayCS();
|
||||||
this.fillColorSpaceObj = null;
|
this.fillColorSpaceObj = null;
|
||||||
@ -543,7 +544,9 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
this.ctx.font = rule;
|
this.ctx.font = rule;
|
||||||
},
|
},
|
||||||
setTextRenderingMode: function canvasGraphicsSetTextRenderingMode(mode) {
|
setTextRenderingMode: function canvasGraphicsSetTextRenderingMode(mode) {
|
||||||
TODO('text rendering mode: ' + mode);
|
if (mode != 0 && mode != 3)
|
||||||
|
TODO('unsupported text rendering mode: ' + mode);
|
||||||
|
this.current.textRenderingMode = mode;
|
||||||
},
|
},
|
||||||
setTextRise: function canvasGraphicsSetTextRise(rise) {
|
setTextRise: function canvasGraphicsSetTextRise(rise) {
|
||||||
TODO('text rise: ' + rise);
|
TODO('text rise: ' + rise);
|
||||||
@ -637,6 +640,7 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
var textLayer = this.textLayer;
|
var textLayer = this.textLayer;
|
||||||
var text = {str: '', length: 0, canvasWidth: 0, geom: {}};
|
var text = {str: '', length: 0, canvasWidth: 0, geom: {}};
|
||||||
var textSelection = textLayer && !skipTextSelection ? true : false;
|
var textSelection = textLayer && !skipTextSelection ? true : false;
|
||||||
|
var textRenderingMode = current.textRenderingMode;
|
||||||
|
|
||||||
if (textSelection) {
|
if (textSelection) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
@ -693,7 +697,15 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
|
|
||||||
var char = glyph.fontChar;
|
var char = glyph.fontChar;
|
||||||
var charWidth = glyph.width * fontSize * 0.001 + charSpacing;
|
var charWidth = glyph.width * fontSize * 0.001 + charSpacing;
|
||||||
ctx.fillText(char, width, 0);
|
|
||||||
|
switch (textRenderingMode) {
|
||||||
|
default: // unsupported rendering mode
|
||||||
|
case 0: // fill
|
||||||
|
ctx.fillText(char, width, 0);
|
||||||
|
break;
|
||||||
|
case 3: // invisible
|
||||||
|
}
|
||||||
|
|
||||||
width += charWidth;
|
width += charWidth;
|
||||||
|
|
||||||
text.str += glyph.unicode === ' ' ? ' ' : glyph.unicode;
|
text.str += glyph.unicode === ' ' ? ' ' : glyph.unicode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user