Skip to content

Commit

Permalink
Merge pull request #8785 from Rob--W/svg-ignore-missing-glyph
Browse files Browse the repository at this point in the history
SVG: Don't render missing glyphs
  • Loading branch information
timvandermeij authored Aug 17, 2017
2 parents 3a017b4 + f07ce2b commit 50e10fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/display/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,23 @@ SVGGraphics = (function SVGGraphicsClosure() {
x += -glyph * fontSize * 0.001;
continue;
}
current.xcoords.push(current.x + x * textHScale);

var width = glyph.width;
var character = glyph.fontChar;
var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
var charWidth = width * widthAdvanceScale + spacing * fontDirection;
x += charWidth;

if (!glyph.isInFont && !font.missingFile) {
x += charWidth;
// TODO: To assist with text selection, we should replace the missing
// character with a space character if charWidth is not zero.
// But we cannot just do "character = ' '", because the ' ' character
// might actually map to a different glyph.
continue;
}
current.xcoords.push(current.x + x * textHScale);
current.tspan.textContent += character;
x += charWidth;
}
if (vertical) {
current.y -= x * textHScale;
Expand Down

0 comments on commit 50e10fd

Please sign in to comment.