를 사용하여 시스템 글꼴을 얻습니다
<code class="language-javascript">try { // 向页面添加swf并读取字体 $('body').append(''); $('#flashcontent').flash({ "src": "resources/FontList.swf", "width": "1", "height": "1", "swliveconnect": "true", "id": "flashfontshelper", "name": "flashfontshelper" }, { update: false }); // swf稳定需要超时。 setTimeout(function() { console.log(window.fonts); return window.fonts; }, _this.settings.flashDelay); } catch (ex) { _this.errors.push('未检测到字体。'); return fonts; }</code>
<code class="language-javascript">try { // 向页面添加swf并读取字体 $('body').append('').flash({ "src": "resources/fonts.swf", "width": "1", "height": "1", "swliveconnect": "true", "id": "flashfontshelper", "name": "flashfontshelper" }, { update: false }); // swf稳定需要超时。 setTimeout(function() { var fonts = "", obj = document.getElementById("flashfontshelper"); // 获取字体 if (obj && typeof(obj.GetVariable) != "undefined") { fonts = obj.GetVariable("/:user_fonts").replace(/,/g,", "); } if (!fonts) { fonts = "未检测到Flash或Java字体"; _this.errors.push('未检测到Flash或Java字体。'); } console.log(fonts); return fonts; }, 100); return true; } catch (ex) { fonts = this.errors.push('未检测到Flash或Java字体。'); }</code>
위 내용은 JavaScript를 사용하여 시스템 글꼴을 얻습니다의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!