Skip to content

Commit d553f18

Browse files
committed
Merge branch 'issue576' into develop. Issue mathjax#576.
2 parents e67c01c + 2de09d8 commit d553f18

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

unpacked/extensions/MatchWebFonts.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929

3030
(function (HUB,AJAX) {
31-
var VERSION = "2.3";
31+
var VERSION = "2.3.1";
3232

3333
var CONFIG = MathJax.Hub.CombineConfig("MatchWebFonts",{
3434
matchFor: {
@@ -98,9 +98,10 @@
9898
//
9999
// Remove markers
100100
//
101+
scripts = scripts.concat(size); // some scripts have been moved to the size array
101102
for (i = 0, m = scripts.length; i < m; i++) {
102103
script = scripts[i];
103-
if (script.parentNode && script.MathJax.elementJax) {
104+
if (script && script.parentNode && script.MathJax.elementJax) {
104105
script.parentNode.removeChild(script.previousSibling);
105106
}
106107
}
@@ -164,6 +165,7 @@
164165
//
165166
// Remove markers
166167
//
168+
scripts = scripts.concat(size); // some scripts have been moved to the size array
167169
for (i = 0, m = scripts.length; i < m; i++) {
168170
script = scripts[i];
169171
if (script.parentNode && script.MathJax.elementJax) {
@@ -303,7 +305,7 @@
303305
});
304306
});
305307

306-
HUB.Startup.signal.Post("MathWebFont Extension Ready");
308+
HUB.Startup.signal.Post("MatchWebFonts Extension Ready");
307309
AJAX.loadComplete("[MathJax]/extensions/MatchWebFonts.js");
308310

309311
})(MathJax.Hub,MathJax.Ajax);

unpacked/jax/output/HTML-CSS/jax.js

+17
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,23 @@
469469
//
470470
InitializeHTML: function () {
471471
this.PreloadWebFonts();
472+
this.getDefaultExEm();
473+
//
474+
// If the defaultEm size is zero, it might be that a web font hasn't
475+
// arrived yet, so try to wait for it, but don't wait too long.
476+
//
477+
if (this.defaultEm) return;
478+
var ready = MathJax.Callback();
479+
AJAX.timer.start(AJAX,function (check) {
480+
if (check.time(ready)) {HUB.signal.Post("HTML-CSS Jax - no default em size"); return}
481+
HTMLCSS.getDefaultExEm();
482+
if (HTMLCSS.defaultEm) {ready()} else {setTimeout(check,check.delay)}
483+
},this.defaultEmDelay,this.defaultEmTimeout);
484+
return ready;
485+
},
486+
defaultEmDelay: 100, // initial delay when checking for defaultEm
487+
defaultEmTimeout: 1000, // when to stop looking for defaultEm
488+
getDefaultExEm: function () {
472489
//
473490
// Get the default sizes (need styles in place to do this)
474491
//

0 commit comments

Comments
 (0)