-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering bug when Chinese chars in \text block #3224
Comments
Thanks for the report. The easiest solution is to set the MathJax = {
output: {
mtextInheritFont: true
}
}; If you want the non-Chinese text to be in the default MathJax font, then you can use the following patch instead: MathJax = {
startup: {
ready() {
const {SvgWrapper} = MathJax._.output.svg.Wrapper;
SvgWrapper.prototype.placeChar = function (n, x, y, parent, variant = null, buffer = false) {
if (variant === null) {
variant = this.variant;
}
const C = n.toString(16).toUpperCase();
const [ , , w, data] = this.getVariantChar(variant, n);
if (data.unknown) {
this.utext += String.fromCodePoint(n);
return (buffer ? 0 : this.addUtext(x, y, parent, variant));
}
const dx = this.addUtext(x, y, parent, variant);
if ('p' in data) {
x += dx;
const path = (data.p ? 'M' + data.p + 'Z' : '');
this.place(x, y, this.adaptor.append(parent, this.charNode(variant, C, path)));
return w + dx;
}
if ('c' in data) {
const g = this.adaptor.append(parent, this.svg('g', {'data-c': C}));
this.place(x, y, g);
x = 0;
for (const n of this.unicodeChars(data.c, variant)) {
x += this.placeChar(n, x, y, g, variant);
}
return w + x + dx;
}
return w;
};
MathJax.startup.defaultReady();
}
}
}; The problem was that the I will make a PR to fix the problem in the next release. |
Sorry, I had mistyped |
Fix handling of unknown characters in SVG output. (mathjax/MathJax#3224)
Issue Summary
There is a rendering bug when Chinese chars in \text block. The affected version is 4.0.0-beta.6. And the 3.2.2 version is fine.
Steps to Reproduce:
Technical details:
I am using the default MathJax configuration:
and loading MathJax via
Supporting information:
The text was updated successfully, but these errors were encountered: