From 56c2da92d5c3221a052a63c66fd26c199263b8c6 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 3 Sep 2014 10:22:22 -0400 Subject: [PATCH 1/3] Add font data for spaces from U+2000 to U+200B. Resolves issue #898. --- unpacked/jax/output/SVG/fonts/TeX/fontdata.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unpacked/jax/output/SVG/fonts/TeX/fontdata.js b/unpacked/jax/output/SVG/fonts/TeX/fontdata.js index e0999ad79..a2812c560 100644 --- a/unpacked/jax/output/SVG/fonts/TeX/fontdata.js +++ b/unpacked/jax/output/SVG/fonts/TeX/fontdata.js @@ -1565,6 +1565,16 @@ // Add some spacing characters (more will come later) // MathJax.Hub.Insert(SVG.FONTDATA.FONTS['MathJax_Main'],{ + 0x2000: [0,0,500,0,0], // en quad + 0x2001: [0,0,1000,0,0], // em quad + 0x2002: [0,0,500,0,0], // en space + 0x2003: [0,0,1000,0,0], // em space + 0x2004: [0,0,333,0,0], // 3-per-em space + 0x2005: [0,0,250,0,0], // 4-per-em space + 0x2006: [0,0,167,0,0], // 6-per-em space + 0x2009: [0,0,167,0,0], // thin space + 0x200A: [0,0,83,0,0], // hair space + 0x200B: [0,0,0,0,0], // zero-width space 0xEEE0: [0,0,-575,0,0,{space:1}], 0xEEE1: [0,0,-300,0,0,{space:1}], 0xEEE8: [0,0,25,0,0,{space:1}] From e090b7821a2746dc6be53ff05b3d2458ed5b9f87 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 3 Sep 2014 10:23:10 -0400 Subject: [PATCH 2/3] Make SVG output not include emtpy attributes for unknown characters. Issue #898 and mathjax/MathJax-node#6. --- unpacked/jax/output/SVG/jax.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index 32925abd8..6cf59c775 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -1006,6 +1006,8 @@ type: "text", removeable: false, Init: function (scale,text,def) { if (!def) {def = {}}; def.stroke = "none"; + if (def["font-style"] === "") delete def["font-style"]; + if (def["font-weight"] === "") delete def["font-weight"]; this.SUPER(arguments).Init.call(this,def); SVG.addText(this.element,text); SVG.textSVG.appendChild(this.element); From 5de7fdea28a8a45c839c6768c5b8d0451237d568 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 3 Sep 2014 10:36:13 -0400 Subject: [PATCH 3/3] Add space characters to STIX font data for HTML-CSS output. --- .../output/HTML-CSS/fonts/STIX/fontdata.js | 16 +++++++++++++++ unpacked/jax/output/SVG/fonts/TeX/fontdata.js | 20 +++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/fonts/STIX/fontdata.js b/unpacked/jax/output/HTML-CSS/fonts/STIX/fontdata.js index b38322033..dc2eaff22 100644 --- a/unpacked/jax/output/HTML-CSS/fonts/STIX/fontdata.js +++ b/unpacked/jax/output/HTML-CSS/fonts/STIX/fontdata.js @@ -1515,6 +1515,22 @@ HTMLCSS.FONTDATA.FONTS['STIXVariants'][0x20][5] = {rfix:275}; // fix error in character width }); + // + // Add some spacing characters (more will come later) + // + MathJax.Hub.Insert(HTMLCSS.FONTDATA.FONTS['STIXGeneral'],{ + 0x2000: [0,0,500,0,0,{space:1}], // en quad + 0x2001: [0,0,1000,0,0,{space:1}], // em quad + 0x2002: [0,0,500,0,0,{space:1}], // en space + 0x2003: [0,0,1000,0,0,{space:1}], // em space + 0x2004: [0,0,333,0,0,{space:1}], // 3-per-em space + 0x2005: [0,0,250,0,0,{space:1}], // 4-per-em space + 0x2006: [0,0,167,0,0,{space:1}], // 6-per-em space + 0x2009: [0,0,167,0,0,{space:1}], // thin space + 0x200A: [0,0,83,0,0,{space:1}], // hair space + 0x200B: [0,0,0,0,0,{space:1}] // zero-width space + }); + MathJax.Hub.Browser.Select({ MSIE: function (browser) { if (!browser.versionAtLeast("8.0") || document.documentMode < 8) { diff --git a/unpacked/jax/output/SVG/fonts/TeX/fontdata.js b/unpacked/jax/output/SVG/fonts/TeX/fontdata.js index a2812c560..395fafcbd 100644 --- a/unpacked/jax/output/SVG/fonts/TeX/fontdata.js +++ b/unpacked/jax/output/SVG/fonts/TeX/fontdata.js @@ -1565,16 +1565,16 @@ // Add some spacing characters (more will come later) // MathJax.Hub.Insert(SVG.FONTDATA.FONTS['MathJax_Main'],{ - 0x2000: [0,0,500,0,0], // en quad - 0x2001: [0,0,1000,0,0], // em quad - 0x2002: [0,0,500,0,0], // en space - 0x2003: [0,0,1000,0,0], // em space - 0x2004: [0,0,333,0,0], // 3-per-em space - 0x2005: [0,0,250,0,0], // 4-per-em space - 0x2006: [0,0,167,0,0], // 6-per-em space - 0x2009: [0,0,167,0,0], // thin space - 0x200A: [0,0,83,0,0], // hair space - 0x200B: [0,0,0,0,0], // zero-width space + 0x2000: [0,0,500,0,0,{space:1}], // en quad + 0x2001: [0,0,1000,0,0,{space:1}], // em quad + 0x2002: [0,0,500,0,0,{space:1}], // en space + 0x2003: [0,0,1000,0,0,{space:1}], // em space + 0x2004: [0,0,333,0,0,{space:1}], // 3-per-em space + 0x2005: [0,0,250,0,0,{space:1}], // 4-per-em space + 0x2006: [0,0,167,0,0,{space:1}], // 6-per-em space + 0x2009: [0,0,167,0,0,{space:1}], // thin space + 0x200A: [0,0,83,0,0,{space:1}], // hair space + 0x200B: [0,0,0,0,0,{space:1}], // zero-width space 0xEEE0: [0,0,-575,0,0,{space:1}], 0xEEE1: [0,0,-300,0,0,{space:1}], 0xEEE8: [0,0,25,0,0,{space:1}]