(idx)
| 2770 | candidates.push(fontUrl.substring('assets/'.length)); |
| 2771 | } |
| 2772 | var tryLoad = function(idx) { |
| 2773 | if (idx >= candidates.length) { |
| 2774 | resolve({ loaded: false, path: 'FontFace', error: 'all candidate paths failed' }); |
| 2775 | return; |
| 2776 | } |
| 2777 | var candidate = candidates[idx]; |
| 2778 | var descriptor = "url('" + cssStringEscape(candidate) + "') format('" |
| 2779 | + cssStringEscape(fontFormat) + "')"; |
| 2780 | var ff = new FontFace(fontName, descriptor); |
| 2781 | ff.load().then(function(loaded) { |
| 2782 | try { document.fonts.add(loaded); } catch (_err) {} |
| 2783 | resolve({ loaded: true, path: 'FontFace' }); |
| 2784 | }, function(err) { |
| 2785 | if (typeof console !== 'undefined' && typeof console.warn === 'function') { |
| 2786 | console.warn('PARPAR:DIAG:HOST:loadTrueTypeFont:FontFace:fail:fontName=' + fontName |
| 2787 | + ':url=' + candidate |
| 2788 | + ':error=' + String(err && err.message ? err.message : err)); |
| 2789 | } |
| 2790 | tryLoad(idx + 1); |
| 2791 | }); |
| 2792 | }; |
| 2793 | tryLoad(0); |
| 2794 | return; |
| 2795 | } |
no test coverage detected