|
120 | 120 | }
|
121 | 121 | },
|
122 | 122 | settings: HUB.config.menuSettings,
|
123 |
| - ex: 1, // filled in later |
| 123 | + ex: 1, scale: 1, // filled in later |
| 124 | + adjustWidths: [], // array of elements to have their widths adjusted |
124 | 125 |
|
125 | 126 | Config: function () {
|
126 | 127 | this.SUPER(arguments).Config.call(this);
|
|
258 | 259 | if (ex === 0 || ex === "NaN") {ex = this.defaultEx; mex = this.defaultMEx}
|
259 | 260 | scale = (mex > 1 ? ex/mex : 1) * this.config.scale;
|
260 | 261 | scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale));
|
261 |
| - jax.NativeMML.ex = ex; |
| 262 | + jax.NativeMML.ex = ex; jax.NativeMML.scale = scale/100; |
262 | 263 | } else {scale = 100}
|
263 | 264 | jax.NativeMML.fontSize = scale+"%";
|
264 | 265 | }
|
|
287 | 288 | container = span.firstChild, mspan = container.firstChild;
|
288 | 289 | span.style.fontSize = jax.NativeMML.fontSize;
|
289 | 290 | this.ex = jax.NativeMML.ex || this.defaultEx;
|
| 291 | + this.scale = jax.NativeMML.scale || 1; |
290 | 292 | //
|
291 | 293 | // Convert to MathML (if restarted, remove any partial math)
|
292 | 294 | //
|
|
814 | 816 | toNativeMML: function (parent) {
|
815 | 817 | var tag = parent.appendChild(this.NativeMMLelement(this.type));
|
816 | 818 | this.NativeMMLattributes(tag);
|
817 |
| - if (nMML.widthBug) {tag = tag.appendChild(this.NativeMMLelement("mrow"))} |
| 819 | + if (nMML.mtdWidthBug) { |
| 820 | + nMML.adjustWidths.push(tag); |
| 821 | + tag = tag.appendChild(this.NativeMMLelement("mrow")); |
| 822 | + } |
818 | 823 | for (var i = 0, m = this.data.length; i < m; i++) {
|
819 | 824 | if (this.data[i]) {this.data[i].toNativeMML(tag)}
|
820 | 825 | else {tag.appendChild(this.NativeMMLelement("mrow"))}
|
821 |
| - } |
| 826 | + } |
822 | 827 | }
|
823 | 828 | });
|
824 | 829 |
|
|
890 | 895 | MML.math.Augment({
|
891 | 896 | toNativeMML: function (parent) {
|
892 | 897 | var tag = this.NativeMMLelement(this.type), math = tag;
|
| 898 | + nMML.adjustWidths = []; |
893 | 899 | //
|
894 | 900 | // Some browsers don't seem to add the xmlns attribute, so do it by hand.
|
895 | 901 | //
|
|
936 | 942 | // parent element to match. Even if we set the <math> width properly,
|
937 | 943 | // it doesn't seem to propagate up to the <span> correctly.
|
938 | 944 | //
|
939 |
| - if (nMML.widthBug && !mtable.nMMLforceWidth && mtable.nMMLlaMatch) { |
| 945 | + if (nMML.widthBug && |
| 946 | + !(mtable.nMMLhasLabels && (mtable.nMMLforceWidth || !mtable.nMMLlaMatch))) { |
940 | 947 | //
|
941 | 948 | // Convert size to ex's so that it scales properly if the print media
|
942 | 949 | // has a different font size.
|
943 | 950 | //
|
944 |
| - parent.style.width = (math.firstChild.scrollWidth/nMML.ex).toFixed(3) + "ex"; |
| 951 | + parent.style.width = (math.firstChild.scrollWidth/nMML.ex/nMML.scale).toFixed(3) + "ex"; |
| 952 | + } |
| 953 | + for (var i = 0, m = nMML.adjustWidths.length; i < m; i++) { |
| 954 | + var tag = nMML.adjustWidths[i]; |
| 955 | + var style = tag.getAttribute("style") || ""; |
| 956 | + if (!style.match(/(^|;)\s*width:/)) { |
| 957 | + var width = tag.scrollWidth/nMML.ex; |
| 958 | + if (style !== "") {style += "; "} |
| 959 | + tag.setAttribute("style",style+"width:"+width+"ex"); |
| 960 | + } |
945 | 961 | }
|
946 | 962 | }
|
947 | 963 | });
|
|
1131 | 1147 | // correctly and thus the element is displayed incorrectly in <mtable>.
|
1132 | 1148 | nMML.spaceWidthBug = !browser.versionAtLeast("20.0");
|
1133 | 1149 |
|
| 1150 | + nMML.mtdWidthBug = true; // <mtd> widths not properly determined |
| 1151 | + |
1134 | 1152 | nMML.tableSpacingBug = true; // mtable@rowspacing/mtable@columnspacing not
|
1135 | 1153 | // supported.
|
1136 | 1154 | nMML.tableLabelBug = true; // mlabeledtr is not implemented.
|
|
0 commit comments