Fix the native platform using the wrong FontFace (#13932)

This commit is contained in:
bofeng-song
2022-12-28 14:46:42 +08:00
committed by GitHub
parent 6f308289b9
commit 26bd717d0f
+3 -2
View File
@@ -24,6 +24,7 @@
THE SOFTWARE.
****************************************************************************/
const jsbWindow = require('../jsbWindow');
const cacheManager = require('./jsb-cache-manager');
const { downloadFile, readText, readArrayBuffer, readJson, getUserDataPath, initJsbDownloader } = require('./jsb-fs-utils');
@@ -259,8 +260,8 @@ function downloadArrayBuffer (url, options, onComplete) {
function loadFont (url, options, onComplete) {
const fontFamilyName = _getFontFamily(url);
const fontFace = new FontFace(fontFamilyName, `url('${url}')`);
document.fonts.add(fontFace);
const fontFace = new jsbWindow.FontFace(fontFamilyName, `url('${url}')`);
jsbWindow.document.fonts.add(fontFace);
fontFace.load();
fontFace.loaded.then(() => {