From cac333ec551ada27fc03be43669ae80cece6a981 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Feb 2019 15:01:47 +0300 Subject: [PATCH] [PE] Add option for font rendering --- .../main/app/controller/LeftMenu.js | 4 +++ .../main/app/controller/Main.js | 5 ++++ .../main/app/view/FileMenuPanels.js | 25 +++++++++++++++++++ apps/presentationeditor/main/locale/en.json | 4 +++ apps/presentationeditor/main/locale/ru.json | 4 +++ 5 files changed, 42 insertions(+) diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 59a776d9b..55024b657 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -307,6 +307,10 @@ define([ } /** coauthoring end **/ + value = Common.localStorage.getItem("pe-settings-fontrender"); + Common.Utils.InternalSettings.set("pe-settings-fontrender", value); + this.api.SetFontRenderingMode(parseInt(value)); + if (this.mode.isEdit) { value = parseInt(Common.localStorage.getItem("pe-settings-autosave")); Common.Utils.InternalSettings.set("pe-settings-autosave", value); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ac6732cee..aef8fd72f 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -121,6 +121,10 @@ define([ return; } + var value = Common.localStorage.getItem("pe-settings-fontrender"); + if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; + Common.Utils.InternalSettings.set("pe-settings-fontrender", value); + // Initialize api window["flat_desine"] = true; @@ -161,6 +165,7 @@ define([ if (this.api){ this.api.SetDrawingFreeze(true); this.api.SetThemesPath("../../../../sdkjs/slide/themes/"); + this.api.SetFontRenderingMode(parseInt(value)); this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this)); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index f8a4ca404..c3d19f6ce 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -200,6 +200,10 @@ define([ '', '
', '','', + '', + '', + '', + '','', '', '', '', @@ -293,6 +297,18 @@ define([ labelText: this.strAlignGuides }); + this.cmbFontRender = new Common.UI.ComboBox({ + el : $('#fms-cmb-font-render'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling, displayValue: this.txtWin }, + { value: Asc.c_oAscFontRenderingModeType.noHinting, displayValue: this.txtMac }, + { value: Asc.c_oAscFontRenderingModeType.hinting, displayValue: this.txtNative } + ] + }); + this.cmbUnit = new Common.UI.ComboBox({ el : $('#fms-cmb-unit'), style : 'width: 160px;', @@ -358,6 +374,10 @@ define([ this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast); /** coauthoring end **/ + value = Common.Utils.InternalSettings.get("pe-settings-fontrender"); + item = this.cmbFontRender.store.findWhere({value: parseInt(value)}); + this.cmbFontRender.setValue(item ? item.get('value') : (window.devicePixelRatio > 1 ? Asc.c_oAscFontRenderingModeType.noHinting : Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling)); + value = Common.Utils.InternalSettings.get("pe-settings-unit"); item = this.cmbUnit.store.findWhere({value: value}); this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric()); @@ -383,6 +403,7 @@ define([ Common.localStorage.setItem("pe-settings-coauthmode", this.cmbCoAuthMode.getValue()); } /** coauthoring end **/ + Common.localStorage.setItem("pe-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("pe-settings-unit", this.cmbUnit.getValue()); Common.localStorage.setItem("pe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) @@ -404,6 +425,10 @@ define([ okButtonText: 'Apply', txtFitSlide: 'Fit to Slide', txtInput: 'Alternate Input', + txtWin: 'as Windows', + txtMac: 'as OS X', + txtNative: 'Native', + strFontRender: 'Font Hinting', strUnit: 'Unit of Measurement', txtCm: 'Centimeter', txtPt: 'Point', diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 901fa8479..8a5fbd7a0 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1198,6 +1198,10 @@ "PE.Views.FileMenuPanels.Settings.txtLast": "View Last", "PE.Views.FileMenuPanels.Settings.txtPt": "Point", "PE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking", + "PE.Views.FileMenuPanels.Settings.strFontRender": "Font Hinting", + "PE.Views.FileMenuPanels.Settings.txtMac": "as OS X", + "PE.Views.FileMenuPanels.Settings.txtNative": "Native", + "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "PE.Views.HyperlinkSettingsDialog.cancelButtonText": "Cancel", "PE.Views.HyperlinkSettingsDialog.okButtonText": "OK", "PE.Views.HyperlinkSettingsDialog.strDisplay": "Display", diff --git a/apps/presentationeditor/main/locale/ru.json b/apps/presentationeditor/main/locale/ru.json index 98bc6b247..961f8a4d0 100644 --- a/apps/presentationeditor/main/locale/ru.json +++ b/apps/presentationeditor/main/locale/ru.json @@ -1193,6 +1193,10 @@ "PE.Views.FileMenuPanels.Settings.txtLast": "Последние", "PE.Views.FileMenuPanels.Settings.txtPt": "Пункт", "PE.Views.FileMenuPanels.Settings.txtSpellCheck": "Проверка орфографии", + "PE.Views.FileMenuPanels.Settings.strFontRender": "Хинтинг шрифтов", + "PE.Views.FileMenuPanels.Settings.txtMac": "как OS X", + "PE.Views.FileMenuPanels.Settings.txtNative": "Собственный", + "DE.Views.FileMenuPanels.Settings.txtWin": "как Windows", "PE.Views.HyperlinkSettingsDialog.cancelButtonText": "Отмена", "PE.Views.HyperlinkSettingsDialog.okButtonText": "OK", "PE.Views.HyperlinkSettingsDialog.strDisplay": "Отображать",