commit 6c50f1dae87c04908879917874d4bdb40f33abcc
parent 67ee149dd2007b15796a6b85b897ac60a7e14e28
Author: Davide P. Cervone <dpvc@union.edu>
Date: Thu, 6 Feb 2014 14:02:41 -0500
Clear font test div so that its width doesn't affect the page size. resolves issue #681.
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js
@@ -84,19 +84,22 @@
this.div.style.fontStyle = (font.style||"normal");
}
var W = this.getComparisonWidths(font.testString,font.noStyleChar);
+ var found = false;
if (W) {
this.div.style.fontFamily = "'"+font.family+"',"+this.comparisonFont[0];
if (this.div.offsetWidth == W[0]) {
this.div.style.fontFamily = "'"+font.family+"',"+this.comparisonFont[W[2]];
- if (this.div.offsetWidth == W[1]) {return false}
+ if (this.div.offsetWidth == W[1]) {found = true}
}
- if (this.div.offsetWidth != W[3] || this.div.offsetHeight != W[4]) {
- if (font.noStyleChar || !HTMLCSS.FONTDATA || !HTMLCSS.FONTDATA.hasStyleChar) {return true}
- for (var i = 0, m = this.testSize.length; i < m; i++)
- {if (this.testStyleChar(font,this.testSize[i])) {return true}}
+ if (!found && (this.div.offsetWidth != W[3] || this.div.offsetHeight != W[4])) {
+ if (!font.noStyleChar && HTMLCSS.FONTDATA && HTMLCSS.FONTDATA.hasStyleChar) {
+ for (var i = 0, m = this.testSize.length; i < m; i++)
+ {if (this.testStyleChar(font,this.testSize[i])) {found = true; m = 0}}
+ } else {found = true}
}
}
- return false;
+ if (HTMLCSS.safariTextNodeBug) {this.div.innerHTML = ""} else {this.text.nodeValue = ""}
+ return found;
},
styleChar: "\uEFFD", // width encodes style