From 3848ac329be0eadb7482a402025530411bb72ebf Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sun, 24 Aug 2014 18:23:37 -0400 Subject: [PATCH] Fix scaling for text when mtextFontInherit is in effect and Scale All Math is not 100%. Issue #826 --- unpacked/jax/output/HTML-CSS/jax.js | 4 ++-- unpacked/jax/output/SVG/jax.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 8790e69ef..00a6d3c12 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -2042,7 +2042,7 @@ var text = this.data.join("").replace(/[\u2061-\u2064]/g,""); // remove invisibles if (remap) {text = remap(text,chars)} if (variant.fontInherit) { - var scale = Math.floor(100/HTMLCSS.scale+.5) + "%"; + var scale = Math.floor(HTMLCSS.config.scale/HTMLCSS.scale+.5) + "%"; HTMLCSS.addElement(span,"span",{style:{"font-size":scale}},[text]); if (variant.bold) {span.lastChild.style.fontWeight = "bold"} if (variant.italic) {span.lastChild.style.fontStyle = "italic"} @@ -2058,7 +2058,7 @@ var text = this.toString().replace(/[\u2061-\u2064]/g,""); // remove invisibles if (remap) {text = remap(text,chars)} if (variant.fontInherit) { - var scale = Math.floor(100/HTMLCSS.scale+.5) + "%"; + var scale = Math.floor(HTMLCSS.config.scale/HTMLCSS.scale+.5) + "%"; HTMLCSS.addElement(span,"span",{style:{"font-size":scale}},[text]); if (variant.bold) {span.lastChild.style.fontWeight = "bold"} if (variant.italic) {span.lastChild.style.fontStyle = "italic"} diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index f81c53106..32925abd8 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -1528,7 +1528,7 @@ variant = this.Get("mathvariant"); if (variant === "monospace") {def["class"] = "MJX-monospace"} else if (variant.match(/sans-serif/)) {def["class"] = "MJX-sans-serif"} - svg.Add(BBOX.TEXT(scale,this.data.join(""),def)); svg.Clean(); + svg.Add(BBOX.TEXT(scale*100/SVG.config.scale,this.data.join(""),def)); svg.Clean(); this.SVGhandleColor(svg); this.SVGsaveData(svg); return svg;