www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1763ac7188cc4ff70faacab8133c9821c1988543
parent 4ef56bb0074a5db997a9830490086578376a186c
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Sun, 22 Feb 2015 10:59:35 -0500

Handle propagation of bounding box sizes better.

Diffstat:
Munpacked/jax/output/CommonHTML/jax.js | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -539,6 +539,7 @@ this.CHTMLhandleColor(span); if (this.isToken) this.CHTMLhandleToken(span); for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLaddChild(span,i,options); + if (!options.noMargins && !options.noBBox) this.CHTMLhandleMargins(span); return span; }, CHTMLaddChild: function (span,i,options) { @@ -613,6 +614,20 @@ } }, + CHTMLhandleMargins: function (span,box) { + var bbox = this.CHTML; + // ### FIXME: should these be FONTDATA values? + if (bbox.h < .9 || bbox.d < .25) { + if (box == null) { + box = HTML.Element("span",{className:"MJXc-box"}); + while (span.firstChild) box.appendChild(span.firstChild); + span.appendChild(box); + } + if (bbox.h < .9) box.style.marginTop = CHTML.Em(bbox.h-.9); + if (bbox.d < .25) box.style.marginBottom = CHTML.Em(bbox.d-.25); + } + }, + CHTMLhandleText: function (span,text,variant) { var c, n; var H = 0, D = 0, W = 0;