Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -3052,11 +3052,11 @@ class CanvasGraphics {
const textHScale = current.textHScale * fontDirection;
const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
const glyphsLength = glyphs.length;
const isTextInvisible =
current.textRenderingMode === TextRenderingMode.INVISIBLE;
const isTextVisible =
current.textRenderingMode !== TextRenderingMode.INVISIBLE;
let i, glyph, width, spacingLength;

if (isTextInvisible || fontSize === 0) {
if (fontSize === 0) {
return;
}
this._cachedScaleForStroking[0] = -1;
Expand Down Expand Up @@ -3092,17 +3092,16 @@ class CanvasGraphics {
);
if (!operatorList) {
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
} else if (this.contentVisible) {
} else if (this.contentVisible && isTextVisible) {
this.save();
ctx.scale(fontSize, fontSize);
ctx.transform(...fontMatrix);
this.executeOperatorList(operatorList);
this.restore();
}

const p = [glyph.width, 0];
Util.applyTransform(p, fontMatrix);
width = p[0] * fontSize + spacing;
width =
glyph.width * fontMatrix[0] * fontSize + spacing * fontDirection;

ctx.translate(width, 0);
current.x += width * textHScale;
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -979,3 +979,4 @@
!tiling_pattern_cell_state.pdf
!issue_cmap12.pdf
!pattern_fill_pending_state.pdf
!type3_advance.pdf
Binary file added test/pdfs/type3_advance.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14783,5 +14783,13 @@
"rounds": 1,
"type": "eq",
"about": "Single-tile patterns with pending clips and even-odd fills."
},
{
"id": "type3_advance",
"file": "pdfs/type3_advance.pdf",
"md5": "700b0da25aeb1b5d22e5c139d80e86db",
"rounds": 1,
"type": "eq",
"about": "Type3 advances: invisible text, character spacing at negative font sizes, and font matrix translation."
}
]
Loading