Skip to content

Commit 2bc19fc

Browse files
authored
Merge pull request #723 from mathjax/fix-char-usage
Fix several issues with CHTML adaptive CSS.
2 parents 807a123 + fa836fe commit 2bc19fc

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

ts/output/chtml/FontData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ export class CHTMLFontData extends FontData<CHTMLCharOptions, CHTMLVariantData,
230230
* @param {CHTMLDelimiterData} data The data for the delimiter whose CSS is to be added
231231
*/
232232
protected addDelimiterStyles(styles: StyleList, n: number, data: CHTMLDelimiterData) {
233-
const c = this.charSelector(n);
233+
let c = this.charSelector(n);
234234
if (data.c && data.c !== n) {
235+
c = this.charSelector(data.c);
235236
styles['.mjx-stretched mjx-c' + c + '::before'] = {
236237
content: this.charContent(data.c)
237238
};

ts/output/chtml/Wrappers/TextNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ CommonTextNodeMixin<CHTMLConstructor<any, any, any>>(CHTMLWrapper) {
8787
this.jax.unknownText(String.fromCodePoint(n), variant) :
8888
this.html('mjx-c', {class: this.char(n) + font}));
8989
adaptor.append(parent, node);
90-
this.font.charUsage.add([variant, n]);
90+
!data.unknown && this.font.charUsage.add([variant, n]);
9191
}
9292
}
9393
}

ts/output/chtml/Wrappers/mo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ CommonMoMixin<CHTMLConstructor<any, any, any>>(CHTMLWrapper) {
158158
protected stretchHTML(chtml: N) {
159159
const c = this.getText().codePointAt(0);
160160
this.font.delimUsage.add(c);
161+
this.childNodes[0].markUsed();
161162
const delim = this.stretch;
162163
const stretch = delim.stretch;
163164
const content: N[] = [];

0 commit comments

Comments
 (0)