From 5e14383a591be420a98ab22b1666f7cadf7cf480 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 3 Sep 2014 14:47:57 -0400 Subject: [PATCH] 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. --- unpacked/jax/output/SVG/jax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index 32925abd8..c5f397d52 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -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;} }