mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #140 from cgjones/font-loading
Improve font loading check by using onload in subdocument
This commit is contained in:
commit
a9e2115b3a
4 changed files with 137 additions and 109 deletions
|
@ -115,25 +115,18 @@ function nextPage() {
|
|||
failure = 'page setup: '+ e.toString();
|
||||
}
|
||||
|
||||
var fontLoaderTimer = null;
|
||||
function checkFontsLoaded() {
|
||||
if (!failure) {
|
||||
try {
|
||||
if (!FontLoader.bind(fonts)) {
|
||||
fontLoaderTimer = window.setTimeout(checkFontsLoaded, 10);
|
||||
return;
|
||||
}
|
||||
FontLoader.bind(fonts, function() { snapshotCurrentPage(gfx); });
|
||||
} catch(e) {
|
||||
failure = 'fonts: '+ e.toString();
|
||||
}
|
||||
snapshotCurrentPage(gfx);
|
||||
}
|
||||
|
||||
if (failure) {
|
||||
// Skip font loading if there was a failure, since the fonts might
|
||||
// be in an inconsistent state.
|
||||
// Skip right to snapshotting if there was a failure, since the
|
||||
// fonts might be in an inconsistent state.
|
||||
snapshotCurrentPage(gfx);
|
||||
} else {
|
||||
checkFontsLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue