For glyphs with empty paths (e.g., space characters), just move the x position by the width of the character. Resolves mathjax/MathJax-node#3.

This commit is contained in:
Davide P. Cervone 2014-09-03 14:47:57 -04:00
parent 4a4d88c26f
commit 5e14383a59

View File

@ -605,7 +605,7 @@
}
font = this.lookupChar(variant,n); c = font[n];
if (c) {
if (c[5] && c[5].space) {svg.w += c[2]} else {
if ((c[5] && c[5].space) || (c[5] === "" && c[0]+c[1] === 0)) {svg.w += c[2]} else {
c = [scale,font.id+"-"+n.toString(16).toUpperCase()].concat(c);
svg.Add(BBOX.GLYPH.apply(BBOX,c),svg.w,0);
}
@ -1038,7 +1038,7 @@
if (!cache || !GLYPH.glyphs[id]) {
def = {"stroke-width":t};
if (cache) {def.id = id} else if (transform) {def.transform = transform}
if (p !== "") {def.d = "M"+p+"Z"}
def.d = (p ? "M"+p+"Z" : "");
this.SUPER(arguments).Init.call(this,def);
if (cache) {GLYPH.defs.appendChild(this.element); GLYPH.glyphs[id] = true;}
}