diff --git a/common/Drawings/Externals.js b/common/Drawings/Externals.js index 5cf3142fef..395b36c1cd 100644 --- a/common/Drawings/Externals.js +++ b/common/Drawings/Externals.js @@ -630,6 +630,9 @@ function checkAllFonts() { + if (undefined === window["__fonts_files"]) + return; + let g_font_files, g_font_infos; var files = window["__fonts_files"]; @@ -710,7 +713,7 @@ window['AscFonts'].ImageLoadStatus = ImageLoadStatus; window['AscFonts'].CImage = CImage; - window['AscFonts'].checkAllFonts = checkAllFonts; + window['AscFonts']['checkAllFonts'] = window['AscFonts'].checkAllFonts = checkAllFonts; window['AscFonts'].g_font_infos_embed = []; window['AscFonts'].g_map_font_index_embed = {}; diff --git a/common/Native/native.js b/common/Native/native.js index f31c166d41..49be02acd4 100644 --- a/common/Native/native.js +++ b/common/Native/native.js @@ -241,13 +241,21 @@ document.documentElement = _null_object; document.body = _null_object; // NATIVE OBJECT -window.native = native; function GetNativeEngine() { return window.native; } var Api = null; // main builder object window.devicePixelRatio = 1; -if (window.native && window.native.GetDevicePixelRatio) - window.devicePixelRatio = window.native.GetDevicePixelRatio(); + +window.InitNativeObject = function() +{ + window.native = native; + window.devicePixelRatio = 1; + if (window.native && window.native.GetDevicePixelRatio) + window.devicePixelRatio = window.native.GetDevicePixelRatio(); +}; + +if (undefined !== native) + window.InitNativeObject(); // OPEN function NativeCreateApi(options) diff --git a/common/libfont/engine.js b/common/libfont/engine.js index ad24e61919..b4e3a92977 100644 --- a/common/libfont/engine.js +++ b/common/libfont/engine.js @@ -775,7 +775,10 @@ function onLoadFontsModule(window, undefined) if (AscCommon["CZLibEngineJS"]) AscCommon["CZLibEngineJS"].prototype["isModuleInit"] = true; - window.nativeZlibEngine = new ZLib(); + if (window["NATIVE_EDITOR_ENJINE"]) + window["InitNativeZLib"] = function() { window.nativeZlibEngine = new ZLib(); }; + else + window.nativeZlibEngine = new ZLib(); function Hyphenation() { diff --git a/common/libfont/engine/fonts_native.js b/common/libfont/engine/fonts_native.js index 27d3e765e3..933da591de 100644 --- a/common/libfont/engine/fonts_native.js +++ b/common/libfont/engine/fonts_native.js @@ -35,7 +35,7 @@ window['AscFonts'] = window['AscFonts'] || {}; var AscFonts = window['AscFonts']; -var g_native_engine = CreateEmbedObject("CTextMeasurerEmbed"); +var g_native_engine = null; function CReturnObject() { @@ -236,4 +236,6 @@ AscFonts.Hyphen_Word = function(lang, word) AscFonts.onLoadModule(); AscFonts.onLoadModule(); +window["InitNativeTextMeasurer"] = function() { g_native_engine = CreateEmbedObject("CTextMeasurerEmbed"); }; + })(window, undefined);