Skip to content

Commit 7446453

Browse files
authored
Merge pull request #1905 from dpvc/issue1855
Handle default border width properly in SVG and HTML-CSS. #1855
2 parents 257b62c + bd69c5e commit 7446453

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

unpacked/jax/output/HTML-CSS/jax.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,10 +1074,16 @@
10741074
thickness2em: function (length,mu) {
10751075
var thick = HTMLCSS.TeX.rule_thickness;
10761076
if (length === MML.LINETHICKNESS.MEDIUM) {return thick}
1077-
if (length === MML.LINETHICKNESS.THIN) {return .67*thick}
1078-
if (length === MML.LINETHICKNESS.THICK) {return 1.67*thick}
1077+
if (length === MML.LINETHICKNESS.THIN) {return .67*thick}
1078+
if (length === MML.LINETHICKNESS.THICK) {return 1.67*thick}
10791079
return this.length2em(length,mu,thick);
10801080
},
1081+
border2em: function (length,mu) {
1082+
if (length === MML.LINETHICKNESS.THIN) {length = "1px"}
1083+
if (length === MML.LINETHICKNESS.MEDIUM) {length = "3px"}
1084+
if (length === MML.LINETHICKNESS.THICK) {length = "5px"}
1085+
return this.length2em(length,mu);
1086+
},
10811087

10821088
getPadding: function (span) {
10831089
var padding = {top:0, right:0, bottom:0, left:0}, has = false;
@@ -1094,7 +1100,7 @@
10941100
var style = span.style[ID+"Style"];
10951101
if (style) {
10961102
has = true;
1097-
border[id] = this.length2em(span.style[ID+"Width"]);
1103+
border[id] = this.border2em(span.style[ID+"Width"] || MML.LINETHICKNESS.MEDIUM);
10981104
css[ID] = [span.style[ID+"Width"],span.style[ID+"Style"],span.style[ID+"Color"]].join(" ");
10991105
}
11001106
}}

unpacked/jax/output/SVG/jax.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,12 @@
558558
if (length === MML.LINETHICKNESS.THICK) {return 1.67*thick}
559559
return this.length2em(length,mu,thick);
560560
},
561+
border2em: function (length,mu) {
562+
if (length === MML.LINETHICKNESS.THIN) {length = "1px"}
563+
if (length === MML.LINETHICKNESS.MEDIUM) {length = "3px"}
564+
if (length === MML.LINETHICKNESS.THICK) {length = "5px"}
565+
return this.length2em(length,mu);
566+
},
561567

562568
getPadding: function (styles) {
563569
var padding = {top:0, right:0, bottom:0, left:0}, has = false;
@@ -574,7 +580,7 @@
574580
var style = styles[ID+"Style"];
575581
if (style && style !== "none") {
576582
has = true;
577-
border[id] = this.length2em(styles[ID+"Width"]);
583+
border[id] = this.border2em(styles[ID+"Width"] || MML.LINETHICKNESS.MEDIUM);
578584
border[id+"Style"] = styles[ID+"Style"];
579585
border[id+"Color"] = styles[ID+"Color"];
580586
if (border[id+"Color"] === "initial") {border[id+"Color"] = ""}

0 commit comments

Comments
 (0)