Skip to content

Commit 47e78f5

Browse files
committed
Merge branch stretchy-chars into master
2 parents d8629db + 72d42e6 commit 47e78f5

File tree

11 files changed

+790
-130
lines changed

11 files changed

+790
-130
lines changed

mathjax3-ts/output/chtml.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import {MmlNode} from '../core/MmlTree/MmlNode.js';
2929
import {HTMLNodes} from '../util/HTMLNodes.js';
3030
import {CHTMLWrapper} from './chtml/Wrapper.js';
3131
import {CHTMLWrapperFactory} from './chtml/WrapperFactory.js';
32+
import {FontData} from './chtml/FontData.js';
33+
import {TeXFont} from './chtml/fonts/tex.js';
3234
import {percent} from '../util/lengths.js';
35+
import {BBox} from './chtml/BBox.js';
3336

3437
/*****************************************************************/
3538
/*
@@ -43,14 +46,16 @@ export class CHTML extends AbstractOutputJax {
4346
...AbstractOutputJax.OPTIONS,
4447
scale: 1, // Global scaling factor for all expressions
4548
skipAttributes: {}, // RFDa and other attributes NOT to copy to CHTML output
46-
CHTMLWrapperFactory: null // The CHTMLWrapper factory to use
49+
CHTMLWrapperFactory: null, // The CHTMLWrapper factory to use
50+
font: null // The FontData object to use
4751
};
4852

4953
/*
50-
* Used to store the HTMLNodes factory and the CHTMLWraper factory.
54+
* Used to store the HTMLNodes factory, the CHTMLWraper factory, and FontData object.
5155
*/
5256
public nodes: HTMLNodes;
5357
public factory: CHTMLWrapperFactory;
58+
public font: FontData;
5459

5560
/*
5661
* The MathDocument for the math we find
@@ -78,6 +83,7 @@ export class CHTML extends AbstractOutputJax {
7883
this.factory = this.options.CHTMLWrapperFactory || new CHTMLWrapperFactory();
7984
this.factory.chtml = this;
8085
this.nodes = new HTMLNodes();
86+
this.font = this.options.font || new TeXFont();
8187
}
8288

8389
/*
@@ -105,6 +111,21 @@ export class CHTML extends AbstractOutputJax {
105111
return node;
106112
}
107113

114+
/*
115+
* @param{MathItem} math The MathItem to get the bounding box for
116+
* @param{MathDocument} html The MathDocument for the math
117+
*/
118+
public getBBox(math: MathItem, html: MathDocument) {
119+
this.document = html;
120+
this.math = math;
121+
this.nodes.document = html.document;
122+
math.root.setTeXclass(null);
123+
this.nodeMap = new Map<MmlNode, CHTMLWrapper>();
124+
let bbox = this.factory.wrap(math.root).getBBox();
125+
this.nodeMap = null;
126+
return bbox;
127+
}
128+
108129
/*
109130
* @override
110131
*/

mathjax3-ts/output/chtml/BBox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class BBox {
144144
this.h = scale * cbox.h;
145145
}
146146
if (scale * cbox.d > this.d) {
147-
this.d = scale*cbox.d;
147+
this.d = scale * cbox.d;
148148
}
149149
}
150150

0 commit comments

Comments
 (0)