Add full support for unicode planes 1 through 10 (both in \unicode{}, as input, and in HTML-CSS and SVG output)
This commit is contained in:
parent
266360e9d2
commit
bb35eb004c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -213,8 +213,7 @@ MathJax.ElementJax.mml.Augment({
|
||||||
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
||||||
"color", "background",
|
"color", "background",
|
||||||
"id", "class", "href", "style"
|
"id", "class", "href", "style"
|
||||||
],
|
]
|
||||||
PLANE1: "\uD835"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(function (MML) {
|
(function (MML) {
|
||||||
|
@ -419,7 +418,8 @@ MathJax.ElementJax.mml.Augment({
|
||||||
autoDefault: function (name) {
|
autoDefault: function (name) {
|
||||||
if (name === "mathvariant") {
|
if (name === "mathvariant") {
|
||||||
var mi = (this.data[0]||"").toString();
|
var mi = (this.data[0]||"").toString();
|
||||||
return (mi.length === 1 || (mi.length === 2 && mi.charCodeAt(0) === this.PLANE1) ?
|
return (mi.length === 1 ||
|
||||||
|
(mi.length === 2 && mi.charCodeAt(0) >= 0xD800 && mi.charCodeAt(0) < 0xDC00) ?
|
||||||
MML.VARIANT.ITALIC : MML.VARIANT.NORMAL);
|
MML.VARIANT.ITALIC : MML.VARIANT.NORMAL);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -520,7 +520,7 @@ MathJax.ElementJax.mml.Augment({
|
||||||
},
|
},
|
||||||
CheckRange: function (mo) {
|
CheckRange: function (mo) {
|
||||||
var n = mo.charCodeAt(0);
|
var n = mo.charCodeAt(0);
|
||||||
if (mo.charAt(0) === MML.PLANE1) {n = mo.charCodeAt(1) + 0x1D400 - 0xDC00}
|
if (n >= 0xD800 && n < 0xDC00) {n = (((n-0xD800)<<10)+(mo.charCodeAt(1)-0xDC00))+0x10000}
|
||||||
for (var i = 0, m = this.RANGES.length; i < m && this.RANGES[i][0] <= n; i++) {
|
for (var i = 0, m = this.RANGES.length; i < m && this.RANGES[i][0] <= n; i++) {
|
||||||
if (n <= this.RANGES[i][1]) {
|
if (n <= this.RANGES[i][1]) {
|
||||||
if (this.RANGES[i][3]) {
|
if (this.RANGES[i][3]) {
|
||||||
|
@ -528,7 +528,7 @@ MathJax.ElementJax.mml.Augment({
|
||||||
this.RANGES[i][3] = null;
|
this.RANGES[i][3] = null;
|
||||||
MathJax.Hub.RestartAfter(MathJax.Ajax.Require(file));
|
MathJax.Hub.RestartAfter(MathJax.Ajax.Require(file));
|
||||||
}
|
}
|
||||||
var data = (["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER"])[this.RANGES[i][2]];
|
var data = MML.TEXCLASSNAMES[this.RANGES[i][2]];
|
||||||
data = this.OPTABLE.infix[mo] = MML.mo.OPTYPES[data === "BIN" ? "BIN3" : data];
|
data = this.OPTABLE.infix[mo] = MML.mo.OPTYPES[data === "BIN" ? "BIN3" : data];
|
||||||
return this.makeDef(data);
|
return this.makeDef(data);
|
||||||
}
|
}
|
||||||
|
@ -1198,7 +1198,9 @@ MathJax.ElementJax.mml.Augment({
|
||||||
toString: function () {
|
toString: function () {
|
||||||
var n = this.value();
|
var n = this.value();
|
||||||
if (n <= 0xFFFF) {return String.fromCharCode(n)}
|
if (n <= 0xFFFF) {return String.fromCharCode(n)}
|
||||||
return this.PLANE1 + String.fromCharCode(n-0x1D400+0xDC00);
|
n -= 0x10000;
|
||||||
|
return String.fromCharCode((n>>10)+0xD800)
|
||||||
|
+ String.fromCharCode((n&0x3FF)+0xDC00);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -966,9 +966,10 @@
|
||||||
this.Parse(); this.Push(STACKITEM.stop());
|
this.Parse(); this.Push(STACKITEM.stop());
|
||||||
},
|
},
|
||||||
Parse: function () {
|
Parse: function () {
|
||||||
var c;
|
var c, n;
|
||||||
while (this.i < this.string.length) {
|
while (this.i < this.string.length) {
|
||||||
c = this.string.charAt(this.i++);
|
c = this.string.charAt(this.i++); n = c.charCodeAt(0);
|
||||||
|
if (n >= 0xD800 && n < 0xDC00) {c += this.string.charAt(this.i++)}
|
||||||
if (TEXDEF.special[c]) {this[TEXDEF.special[c]](c)}
|
if (TEXDEF.special[c]) {this[TEXDEF.special[c]](c)}
|
||||||
else if (TEXDEF.letter.test(c)) {this.Variable(c)}
|
else if (TEXDEF.letter.test(c)) {this.Variable(c)}
|
||||||
else if (TEXDEF.digit.test(c)) {this.Number(c)}
|
else if (TEXDEF.digit.test(c)) {this.Number(c)}
|
||||||
|
|
|
@ -1214,8 +1214,8 @@
|
||||||
for (var i = 0, m = text.length; i < m; i++) {
|
for (var i = 0, m = text.length; i < m; i++) {
|
||||||
variant = VARIANT;
|
variant = VARIANT;
|
||||||
n = text.charCodeAt(i); c = text.charAt(i);
|
n = text.charCodeAt(i); c = text.charAt(i);
|
||||||
if (c === this.PLANE1) {
|
if (n >= 0xD800 && n < 0xDBFF) {
|
||||||
i++; n = text.charCodeAt(i) + 0x1D400 - 0xDC00;
|
i++; n = (((n-0xD800)<<10)+(text.charCodeAt(i)-0xDC00))+0x10000;
|
||||||
if (this.FONTDATA.RemapPlane1) {
|
if (this.FONTDATA.RemapPlane1) {
|
||||||
var nv = this.FONTDATA.RemapPlane1(n,variant);
|
var nv = this.FONTDATA.RemapPlane1(n,variant);
|
||||||
n = nv.n; variant = nv.variant;
|
n = nv.n; variant = nv.variant;
|
||||||
|
@ -1295,8 +1295,11 @@
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (C.c == null) {
|
if (C.c == null) {
|
||||||
if (n <= 0xFFFF) {C.c = String.fromCharCode(n)}
|
if (n <= 0xFFFF) {C.c = String.fromCharCode(n)} else {
|
||||||
else {C.c = this.PLANE1 + String.fromCharCode(n-0x1D400+0xDC00)}
|
var N = n - 0x10000;
|
||||||
|
C.c = String.fromCharCode((N>>10)+0xD800)
|
||||||
|
+ String.fromCharCode((N&0x3FF)+0xDC00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (C.rfix) {this.addText(span,C.c); HTMLCSS.createShift(span,C.rfix/1000); return ""}
|
if (C.rfix) {this.addText(span,C.c); HTMLCSS.createShift(span,C.rfix/1000); return ""}
|
||||||
if (c[2] || !this.msieAccentBug || text.length) {return text + C.c}
|
if (c[2] || !this.msieAccentBug || text.length) {return text + C.c}
|
||||||
|
@ -1458,7 +1461,6 @@
|
||||||
min_rule_thickness: 1.25 // in pixels
|
min_rule_thickness: 1.25 // in pixels
|
||||||
},
|
},
|
||||||
|
|
||||||
PLANE1: "\uD835",
|
|
||||||
NBSP: "\u00A0",
|
NBSP: "\u00A0",
|
||||||
|
|
||||||
rfuzz: 0 // adjustment to rule placements in roots
|
rfuzz: 0 // adjustment to rule placements in roots
|
||||||
|
|
|
@ -463,7 +463,7 @@
|
||||||
|
|
||||||
HandleVariant: function (variant,scale,text) {
|
HandleVariant: function (variant,scale,text) {
|
||||||
var svg = BBOX.G();
|
var svg = BBOX.G();
|
||||||
var n, c, font, VARIANT, i, m, id, M, RANGES;
|
var n, N, c, font, VARIANT, i, m, id, M, RANGES;
|
||||||
if (!variant) {variant = this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]}
|
if (!variant) {variant = this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]}
|
||||||
if (variant.forceFamily) {
|
if (variant.forceFamily) {
|
||||||
text = BBOX.TEXT(scale,text,variant.font);
|
text = BBOX.TEXT(scale,text,variant.font);
|
||||||
|
@ -474,8 +474,8 @@
|
||||||
for (i = 0, m = text.length; i < m; i++) {
|
for (i = 0, m = text.length; i < m; i++) {
|
||||||
variant = VARIANT;
|
variant = VARIANT;
|
||||||
n = text.charCodeAt(i); c = text.charAt(i);
|
n = text.charCodeAt(i); c = text.charAt(i);
|
||||||
if (c === this.PLANE1) {
|
if (n >= 0xD800 && n < 0xDBFF) {
|
||||||
i++; n = text.charCodeAt(i) + 0x1D400 - 0xDC00;
|
i++; n = (((n-0xD800)<<10)+(text.charCodeAt(i)-0xDC00))+0x10000;
|
||||||
if (this.FONTDATA.RemapPlane1) {
|
if (this.FONTDATA.RemapPlane1) {
|
||||||
var nv = this.FONTDATA.RemapPlane1(n,variant);
|
var nv = this.FONTDATA.RemapPlane1(n,variant);
|
||||||
n = nv.n; variant = nv.variant;
|
n = nv.n; variant = nv.variant;
|
||||||
|
@ -484,7 +484,7 @@
|
||||||
RANGES = this.FONTDATA.RANGES;
|
RANGES = this.FONTDATA.RANGES;
|
||||||
for (id = 0, M = RANGES.length; id < M; id++) {
|
for (id = 0, M = RANGES.length; id < M; id++) {
|
||||||
if (RANGES[id].name === "alpha" && variant.noLowerCase) continue;
|
if (RANGES[id].name === "alpha" && variant.noLowerCase) continue;
|
||||||
var N = variant["offset"+RANGES[id].offset];
|
N = variant["offset"+RANGES[id].offset];
|
||||||
if (N && n >= RANGES[id].low && n <= RANGES[id].high) {
|
if (N && n >= RANGES[id].low && n <= RANGES[id].high) {
|
||||||
if (RANGES[id].remap && RANGES[id].remap[n]) {
|
if (RANGES[id].remap && RANGES[id].remap[n]) {
|
||||||
n = N + RANGES[id].remap[n];
|
n = N + RANGES[id].remap[n];
|
||||||
|
@ -515,7 +515,12 @@
|
||||||
} else if (this.FONTDATA.DELIMITERS[n]) {
|
} else if (this.FONTDATA.DELIMITERS[n]) {
|
||||||
svg.Add(this.createDelimiter(n,0,1,font),svg.w,0);
|
svg.Add(this.createDelimiter(n,0,1,font),svg.w,0);
|
||||||
} else {
|
} else {
|
||||||
text = BBOX.TEXT(scale,String.fromCharCode(n),{
|
if (n <= 0xFFFF) {c = String.fromCharCode(n)} else {
|
||||||
|
N = n - 0x10000;
|
||||||
|
c = String.fromCharCode((N>>10)+0xD800)
|
||||||
|
+ String.fromCharCode((N&0x3FF)+0xDC00);
|
||||||
|
}
|
||||||
|
text = BBOX.TEXT(scale,c,{
|
||||||
"font-family":variant.defaultFamily||SVG.config.MISSINGFONT,
|
"font-family":variant.defaultFamily||SVG.config.MISSINGFONT,
|
||||||
"font-style":(variant.italic?"italic":""),
|
"font-style":(variant.italic?"italic":""),
|
||||||
"font-weight":(variant.bold?"bold":"")
|
"font-weight":(variant.bold?"bold":"")
|
||||||
|
@ -714,7 +719,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
BIGDIMEN: 10000000,
|
BIGDIMEN: 10000000,
|
||||||
PLANE1: "\uD835",
|
|
||||||
NBSP: "\u00A0"
|
NBSP: "\u00A0"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user