mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Build paths for glyph accents when drawing text as curves
This commit is contained in:
parent
44cd0f4a76
commit
b907e15a90
5 changed files with 26 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue