Fix problem with linebreaking where the incorrect width was being used to determine breakpoint penalties, so some long lines were not being broken
This commit is contained in:
parent
b08db7d93e
commit
93e68cc254
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
var VERSION = "2.0";
|
var VERSION = "2.0.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||||
|
|
||||||
|
@ -149,12 +149,12 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
m = this.data.length, W, scanW = info.W,
|
m = this.data.length, W, scanW = info.W,
|
||||||
broken = (info.index.length > 0), better = false;
|
broken = (info.index.length > 0), better = false;
|
||||||
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w};
|
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w};
|
||||||
info.w = 0; info.nest++;
|
info.w = 0; info.nest++; info.scanW = scanW;
|
||||||
//
|
//
|
||||||
// Look through the line for breakpoints,
|
// Look through the line for breakpoints,
|
||||||
// (as long as we are not too far past the breaking width)
|
// (as long as we are not too far past the breaking width)
|
||||||
//
|
//
|
||||||
while (i < m && info.W < 1.33*HTMLCSS.linebreakWidth) {
|
while (i < m && info.scanW < 1.33*HTMLCSS.linebreakWidth) {
|
||||||
if (this.data[i]) {
|
if (this.data[i]) {
|
||||||
if (this.data[i].HTMLbetterBreak(info,state)) {
|
if (this.data[i].HTMLbetterBreak(info,state)) {
|
||||||
better = true; index = [i].concat(info.index); W = info.W;
|
better = true; index = [i].concat(info.index); W = info.W;
|
||||||
|
@ -392,7 +392,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
//
|
//
|
||||||
// Get the default penalty for this location
|
// Get the default penalty for this location
|
||||||
//
|
//
|
||||||
var W = info.W, mo = (info.embellished||this); delete info.embellished;
|
var W = info.scanW, mo = (info.embellished||this); delete info.embellished;
|
||||||
var span = mo.HTMLspanElement(), w = span.bbox.w;
|
var span = mo.HTMLspanElement(), w = span.bbox.w;
|
||||||
if (span.style.paddingLeft) {w += parseFloat(span.style.paddingLeft)}
|
if (span.style.paddingLeft) {w += parseFloat(span.style.paddingLeft)}
|
||||||
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
||||||
|
@ -444,7 +444,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
//
|
//
|
||||||
// Get the default penalty for this location
|
// Get the default penalty for this location
|
||||||
//
|
//
|
||||||
var W = info.W, span = this.HTMLspanElement(), w = span.bbox.w;
|
var W = info.scanW, span = this.HTMLspanElement(), w = span.bbox.w;
|
||||||
if (span.style.paddingLeft) {w += parseFloat(span.style.paddingLeft)}
|
if (span.style.paddingLeft) {w += parseFloat(span.style.paddingLeft)}
|
||||||
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
||||||
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
var VERSION = "2.0";
|
var VERSION = "2.0.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
SVG = MathJax.OutputJax.SVG,
|
SVG = MathJax.OutputJax.SVG,
|
||||||
BBOX = SVG.BBOX;
|
BBOX = SVG.BBOX;
|
||||||
|
@ -152,12 +152,12 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
m = this.data.length, W, scanW = info.W,
|
m = this.data.length, W, scanW = info.W,
|
||||||
broken = (info.index.length > 0), better = false;
|
broken = (info.index.length > 0), better = false;
|
||||||
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w};
|
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w};
|
||||||
info.w = 0; info.nest++;
|
info.w = 0; info.nest++; info.scanW = scanW;
|
||||||
//
|
//
|
||||||
// Look through the line for breakpoints,
|
// Look through the line for breakpoints,
|
||||||
// (as long as we are not too far past the breaking width)
|
// (as long as we are not too far past the breaking width)
|
||||||
//
|
//
|
||||||
while (i < m && info.W < 1.33*SVG.linebreakWidth) {
|
while (i < m && info.scanW < 1.33*SVG.linebreakWidth) {
|
||||||
if (this.data[i]) {
|
if (this.data[i]) {
|
||||||
if (this.data[i].SVGbetterBreak(info,state)) {
|
if (this.data[i].SVGbetterBreak(info,state)) {
|
||||||
better = true; index = [i].concat(info.index); W = info.W;
|
better = true; index = [i].concat(info.index); W = info.W;
|
||||||
|
@ -350,7 +350,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
//
|
//
|
||||||
// Get the default penalty for this location
|
// Get the default penalty for this location
|
||||||
//
|
//
|
||||||
var W = info.W, mo = (info.embellished||this); delete info.embellished;
|
var W = info.scanW, mo = (info.embellished||this); delete info.embellished;
|
||||||
var svg = mo.SVGdata, w = svg.w + svg.x;
|
var svg = mo.SVGdata, w = svg.w + svg.x;
|
||||||
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
||||||
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
||||||
|
@ -401,7 +401,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
//
|
//
|
||||||
// Get the default penalty for this location
|
// Get the default penalty for this location
|
||||||
//
|
//
|
||||||
var W = info.W, svg = this.SVGdata, w = svg.w + svg.x;
|
var W = info.scanW, svg = this.SVGdata, w = svg.w + svg.x;
|
||||||
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
|
||||||
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
|
||||||
var offset = SVG.linebreakWidth - W;
|
var offset = SVG.linebreakWidth - W;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user