Merge branch 'fix-linebreaks' into develop
This commit is contained in:
commit
4d316d7f1a
|
@ -92,7 +92,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
var stack = HTMLCSS.createStack(span);
|
var stack = HTMLCSS.createStack(span);
|
||||||
var state = {
|
var state = {
|
||||||
n: 0, Y: 0,
|
n: 0, Y: 0,
|
||||||
scale: this.scale,
|
scale: this.scale || 1,
|
||||||
isTop: isTop,
|
isTop: isTop,
|
||||||
values: {},
|
values: {},
|
||||||
VALUES: VALUES
|
VALUES: VALUES
|
||||||
|
@ -108,7 +108,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
broken = false;
|
broken = false;
|
||||||
|
|
||||||
while (this.HTMLbetterBreak(end,state) &&
|
while (this.HTMLbetterBreak(end,state) &&
|
||||||
(end.scanW >= HTMLCSS.linebreakWidth || end.penalty == PENALTY.newline)) {
|
(end.scanW >= HTMLCSS.linebreakWidth || end.penalty === PENALTY.newline)) {
|
||||||
this.HTMLaddLine(stack,start,end.index,state,end.values,broken);
|
this.HTMLaddLine(stack,start,end.index,state,end.values,broken);
|
||||||
start = end.index.slice(0); broken = true;
|
start = end.index.slice(0); broken = true;
|
||||||
align = this.HTMLgetAlign(state,end.values);
|
align = this.HTMLgetAlign(state,end.values);
|
||||||
|
@ -252,7 +252,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast}
|
else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast}
|
||||||
else {shift = prev.indentshift || def.indentshift}
|
else {shift = prev.indentshift || def.indentshift}
|
||||||
if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift}
|
if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift}
|
||||||
if (shift === "auto" || shift === "") {shift = (state.isTSop ? this.displayIndent : "0")}
|
if (shift === MML.INDENTSHIFT.AUTO || shift === "") {shift = (state.isTSop ? this.displayIndent : "0")}
|
||||||
return HTMLCSS.length2em(shift,0);
|
return HTMLCSS.length2em(shift,0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -655,7 +655,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
var span = mo.HTMLspanElement(), w = span.bbox.w;
|
var span = mo.HTMLspanElement(), w = span.bbox.w;
|
||||||
if (span.style.paddingLeft) {w += HTMLCSS.unEm(span.style.paddingLeft)}
|
if (span.style.paddingLeft) {w += HTMLCSS.unEm(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 && values.linebreak !== MML.LINEBREAK.NEWLINE)
|
||||||
|
{return false} // don't break at zero width (FIXME?)
|
||||||
var offset = HTMLCSS.linebreakWidth - W;
|
var offset = HTMLCSS.linebreakWidth - W;
|
||||||
// Adjust offest for explicit first-line indent and align
|
// Adjust offest for explicit first-line indent and align
|
||||||
if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst ||
|
if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst ||
|
||||||
|
|
|
@ -96,7 +96,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
|
|
||||||
var state = {
|
var state = {
|
||||||
n: 0, Y: 0,
|
n: 0, Y: 0,
|
||||||
scale: this.scale,
|
scale: this.scale || 1,
|
||||||
isTop: isTop,
|
isTop: isTop,
|
||||||
values: {},
|
values: {},
|
||||||
VALUES: VALUES
|
VALUES: VALUES
|
||||||
|
@ -115,7 +115,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
// Break the expression at its best line breaks
|
// Break the expression at its best line breaks
|
||||||
//
|
//
|
||||||
while (this.SVGbetterBreak(end,state) &&
|
while (this.SVGbetterBreak(end,state) &&
|
||||||
(end.scanW >= SVG.linebreakWidth || end.penalty == PENALTY.newline)) {
|
(end.scanW >= SVG.linebreakWidth || end.penalty === PENALTY.newline)) {
|
||||||
this.SVGaddLine(svg,start,end.index,state,end.values,broken);
|
this.SVGaddLine(svg,start,end.index,state,end.values,broken);
|
||||||
start = end.index.slice(0); broken = true;
|
start = end.index.slice(0); broken = true;
|
||||||
align = this.SVGgetAlign(state,end.values);
|
align = this.SVGgetAlign(state,end.values);
|
||||||
|
@ -255,7 +255,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast}
|
else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast}
|
||||||
else {shift = prev.indentshift || def.indentshift}
|
else {shift = prev.indentshift || def.indentshift}
|
||||||
if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift}
|
if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift}
|
||||||
if (shift === "auto" || shift === "") {shift = (state.isTSop ? this.displayIndent : "0")}
|
if (shift === MML.INDENTSHIFT.AUTO || shift === "") {shift = (state.isTSop ? this.displayIndent : "0")}
|
||||||
return SVG.length2em(shift,0);
|
return SVG.length2em(shift,0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -584,7 +584,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
if (!mo || !mo.SVGdata) {mo = this}
|
if (!mo || !mo.SVGdata) {mo = this}
|
||||||
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 && values.linebreak !== MML.LINEBREAK.NEWLINE)
|
||||||
|
{return false} // don't break at zero width (FIXME?)
|
||||||
var offset = SVG.linebreakWidth - W;
|
var offset = SVG.linebreakWidth - W;
|
||||||
// adjust offest for explicit first-line indent and align
|
// adjust offest for explicit first-line indent and align
|
||||||
if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst ||
|
if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user