diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 5f9c30312..70fcc6ad3 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -290,11 +290,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG); if (font.data && (isAddToPathSet || PDFJS.disableFontFace)) { - for (var i = 0; i < glyphs.length; i++) { - if (glyphs[i] === null) { - continue; - } - var fontChar = glyphs[i].fontChar; + var buildPath = function (fontChar) { if (!font.renderer.hasBuiltPath(fontChar)) { var path = font.renderer.getPathJs(fontChar); this.handler.send('commonobj', [ @@ -303,6 +299,21 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { 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); + } } } diff --git a/src/display/canvas.js b/src/display/canvas.js index cb568032e..646f8a343 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -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 current = this.current; var font = current.font; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 353e93993..efd18259a 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -43,6 +43,7 @@ !type4psfunc.pdf !issue1350.pdf !S2.pdf +!glyph_accent.pdf !personwithdog.pdf !helloworld-bad.pdf !zerowidthline.pdf diff --git a/test/pdfs/glyph_accent.pdf b/test/pdfs/glyph_accent.pdf new file mode 100644 index 000000000..23aa1d714 Binary files /dev/null and b/test/pdfs/glyph_accent.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index eefa9ec3a..0db9c348c 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -520,6 +520,14 @@ "rounds": 1, "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", "file": "pdfs/simpletype3font.pdf", "md5": "b374c7543920840c61999e9e86939f99",