Build paths for glyph accents when drawing text as curves
This commit is contained in:
parent
44cd0f4a76
commit
b907e15a90
@ -290,11 +290,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
var isAddToPathSet = !!(state.textRenderingMode &
|
var isAddToPathSet = !!(state.textRenderingMode &
|
||||||
TextRenderingMode.ADD_TO_PATH_FLAG);
|
TextRenderingMode.ADD_TO_PATH_FLAG);
|
||||||
if (font.data && (isAddToPathSet || PDFJS.disableFontFace)) {
|
if (font.data && (isAddToPathSet || PDFJS.disableFontFace)) {
|
||||||
for (var i = 0; i < glyphs.length; i++) {
|
var buildPath = function (fontChar) {
|
||||||
if (glyphs[i] === null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var fontChar = glyphs[i].fontChar;
|
|
||||||
if (!font.renderer.hasBuiltPath(fontChar)) {
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
||||||
var path = font.renderer.getPathJs(fontChar);
|
var path = font.renderer.getPathJs(fontChar);
|
||||||
this.handler.send('commonobj', [
|
this.handler.send('commonobj', [
|
||||||
@ -303,6 +299,21 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
path
|
path
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
||||||
|
var glyph = glyphs[i];
|
||||||
|
if (glyph === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
buildPath(glyph.fontChar);
|
||||||
|
|
||||||
|
// If the glyph has an accent we need to build a path for its
|
||||||
|
// fontChar too, otherwise CanvasGraphics_paintChar will fail.
|
||||||
|
var accent = glyph.accent;
|
||||||
|
if (accent && accent.fontChar) {
|
||||||
|
buildPath(accent.fontChar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1253,7 +1253,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
paintChar: function (character, x, y) {
|
paintChar: function CanvasGraphics_paintChar(character, x, y) {
|
||||||
var ctx = this.ctx;
|
var ctx = this.ctx;
|
||||||
var current = this.current;
|
var current = this.current;
|
||||||
var font = current.font;
|
var font = current.font;
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -43,6 +43,7 @@
|
|||||||
!type4psfunc.pdf
|
!type4psfunc.pdf
|
||||||
!issue1350.pdf
|
!issue1350.pdf
|
||||||
!S2.pdf
|
!S2.pdf
|
||||||
|
!glyph_accent.pdf
|
||||||
!personwithdog.pdf
|
!personwithdog.pdf
|
||||||
!helloworld-bad.pdf
|
!helloworld-bad.pdf
|
||||||
!zerowidthline.pdf
|
!zerowidthline.pdf
|
||||||
|
BIN
test/pdfs/glyph_accent.pdf
Normal file
BIN
test/pdfs/glyph_accent.pdf
Normal file
Binary file not shown.
@ -520,6 +520,14 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "glyph_accent",
|
||||||
|
"file": "pdfs/glyph_accent.pdf",
|
||||||
|
"md5": "1526e4edaa3ec439ebf156d0a0b385aa",
|
||||||
|
"link": false,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq",
|
||||||
|
"about": "Glyph accent drawn as curves."
|
||||||
|
},
|
||||||
{ "id": "simpletype3font",
|
{ "id": "simpletype3font",
|
||||||
"file": "pdfs/simpletype3font.pdf",
|
"file": "pdfs/simpletype3font.pdf",
|
||||||
"md5": "b374c7543920840c61999e9e86939f99",
|
"md5": "b374c7543920840c61999e9e86939f99",
|
||||||
|
Loading…
Reference in New Issue
Block a user