|
1623 | 1623 | span.bbox.h *= span.scale; span.bbox.d *= span.scale;
|
1624 | 1624 | span.bbox.w *= span.scale; span.bbox.lw *= span.scale; span.bbox.rw *= span.scale;
|
1625 | 1625 | }
|
1626 |
| - if (text.length == 1 && font.skew && font.skew[n]) {span.bbox.skew = font.skew[n]} |
| 1626 | + if (HTMLCSS.isChar(text) && font.skew && font.skew[n]) {span.bbox.skew = font.skew[n]} |
1627 | 1627 | },
|
1628 | 1628 | checkFont: function (font,style) {
|
1629 | 1629 | var weight = (style.fontWeight||"normal");
|
|
1726 | 1726 | HUB.signal.Post(["HTML-CSS Jax - unknown char",n,variant]);
|
1727 | 1727 | return unknown;
|
1728 | 1728 | },
|
| 1729 | + |
| 1730 | + isChar: function (text) { |
| 1731 | + if (text.length === 1) return true; |
| 1732 | + if (text.length !== 2) return false; |
| 1733 | + var n = text.charCodeAt(0); |
| 1734 | + return (n >= 0xD800 && n < 0xDBFF); |
| 1735 | + }, |
1729 | 1736 |
|
1730 | 1737 | findBlock: function (font,c) {
|
1731 | 1738 | if (font.Ranges) {
|
|
2293 | 2300 | {if (this.data[i]) {this.data[i].toHTML(span,variant)}}
|
2294 | 2301 | if (!span.bbox) {span.bbox = this.HTMLzeroBBox()}
|
2295 | 2302 | var text = this.data.join(""), bbox = span.bbox;
|
2296 |
| - if (bbox.skew && text.length !== 1) {delete bbox.skew} |
2297 |
| - if (bbox.rw > bbox.w && text.length === 1 && !variant.noIC) { |
| 2303 | + if (bbox.skew && !HTMLCSS.isChar(text)) {delete bbox.skew} |
| 2304 | + if (bbox.rw > bbox.w && HTMLCSS.isChar(text) && !variant.noIC) { |
2298 | 2305 | bbox.ic = bbox.rw - bbox.w;
|
2299 | 2306 | HTMLCSS.createBlank(span,bbox.ic/this.mscale);
|
2300 | 2307 | bbox.w = bbox.rw;
|
|
2319 | 2326 | }
|
2320 | 2327 | }
|
2321 | 2328 | if (!span.bbox) {span.bbox = this.HTMLzeroBBox()}
|
2322 |
| - if (this.data.join("").length !== 1) {delete span.bbox.skew} |
| 2329 | + if (!HTMLCSS.isChar(this.data.join(""))) {delete span.bbox.skew} |
2323 | 2330 | this.HTMLhandleSpace(span);
|
2324 | 2331 | this.HTMLhandleColor(span);
|
2325 | 2332 | this.HTMLhandleDir(span);
|
|
2345 | 2352 | var parent = this.CoreParent(),
|
2346 | 2353 | isScript = (parent && parent.isa(MML.msubsup) && this !== parent.data[parent.base]),
|
2347 | 2354 | mapchars = (isScript?this.remapChars:null);
|
2348 |
| - if (text.length === 1 && parent && parent.isa(MML.munderover) && |
2349 |
| - this.CoreText(parent.data[parent.base]).length === 1) { |
| 2355 | + if (HTMLCSS.isChar(text) && parent && parent.isa(MML.munderover) && |
| 2356 | + HTMLCSS.isChar(his.CoreText(parent.data[parent.base]))) { |
2350 | 2357 | var over = parent.data[parent.over], under = parent.data[parent.under];
|
2351 | 2358 | if (over && this === over.CoreMO() && parent.Get("accent")) {mapchars = HTMLCSS.FONTDATA.REMAPACCENT}
|
2352 | 2359 | else if (under && this === under.CoreMO() && parent.Get("accentunder")) {mapchars = HTMLCSS.FONTDATA.REMAPACCENTUNDER}
|
|
2362 | 2369 | for (var i = 0, m = this.data.length; i < m; i++)
|
2363 | 2370 | {if (this.data[i]) {this.data[i].toHTML(span,variant,this.remap,mapchars)}}
|
2364 | 2371 | if (!span.bbox) {span.bbox = this.HTMLzeroBBox()}
|
2365 |
| - if (text.length !== 1) {delete span.bbox.skew} |
| 2372 | + if (!HTMLCSS.isChar(text)) {delete span.bbox.skew} |
2366 | 2373 |
|
2367 | 2374 | //
|
2368 | 2375 | // Handle combining character bugs
|
2369 | 2376 | //
|
2370 |
| - if (HTMLCSS.AccentBug && span.bbox.w === 0 && text.length === 1 && span.firstChild) { |
| 2377 | + if (HTMLCSS.AccentBug && span.bbox.w === 0 && HTMLCSS.isChar(text) && span.firstChild) { |
2371 | 2378 | //
|
2372 | 2379 | // adding a non-breaking space and removing that width
|
2373 | 2380 | //
|
|
2411 | 2418 | if (c.length > 1) {return false}
|
2412 | 2419 | var parent = this.CoreParent();
|
2413 | 2420 | if (parent && parent.isa(MML.munderover) &&
|
2414 |
| - this.CoreText(parent.data[parent.base]).length === 1) { |
| 2421 | + HTMLCSS.isChar(this.CoreText(parent.data[parent.base]))) { |
2415 | 2422 | var over = parent.data[parent.over], under = parent.data[parent.under];
|
2416 | 2423 | if (over && this === over.CoreMO() && parent.Get("accent")) {c = HTMLCSS.FONTDATA.REMAPACCENT[c]||c}
|
2417 | 2424 | else if (under && this === under.CoreMO() && parent.Get("accentunder")) {c = HTMLCSS.FONTDATA.REMAPACCENTUNDER[c]||c}
|
|
2473 | 2480 | for (var i = 0, m = this.data.length; i < m; i++)
|
2474 | 2481 | {if (this.data[i]) {this.data[i].toHTML(span,variant)}}
|
2475 | 2482 | if (!span.bbox) {span.bbox = this.HTMLzeroBBox()}
|
2476 |
| - if (this.data.join("").length !== 1) {delete span.bbox.skew} |
| 2483 | + if (!HTMLCSS.isChar(this.data.join(""))) {delete span.bbox.skew} |
2477 | 2484 | this.HTMLhandleSpace(span);
|
2478 | 2485 | this.HTMLhandleColor(span);
|
2479 | 2486 | this.HTMLhandleDir(span);
|
|
2939 | 2946 | }
|
2940 | 2947 | if (this.data[this.base] && HW == null && D == null &&
|
2941 | 2948 | (this.data[this.base].type === "mi" || this.data[this.base].type === "mo")) {
|
2942 |
| - if (this.data[this.base].data.join("").length === 1 && children[0].scale === 1 && |
| 2949 | + if (HTMLCSS.isChar(this.data[this.base].data.join("")) && children[0].scale === 1 && |
2943 | 2950 | !this.data[this.base].Get("largeop")) {u = v = 0}
|
2944 | 2951 | }
|
2945 | 2952 | var min = this.getValues("subscriptshift","superscriptshift");
|
|
0 commit comments