diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue index 98973eaa..9277a7f5 100644 --- a/client/components/Reader/SettingsPage/SettingsPage.vue +++ b/client/components/Reader/SettingsPage/SettingsPage.vue @@ -92,7 +92,7 @@ import Vue from 'vue'; import Component from 'vue-class-component'; import Window from '../../share/Window.vue'; -import reader from '../../../store/modules/reader'; +import rstore from '../../../store/modules/reader'; const propsData = { textColor: '#000000', @@ -147,6 +147,7 @@ class SettingsPage extends Vue { fontItalic = false; webFonts = []; + fonts = []; created() { this.commit = this.$store.commit; @@ -161,7 +162,9 @@ class SettingsPage extends Vue { } this.fontBold = (this.fontWeight == 'bold'); this.fontItalic = (this.fontStyle == 'italic'); - this.webFonts = reader.webFonts; + + this.fonts = rstore.fonts; + this.webFonts = rstore.webFonts; } get settings() { diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 7419d4bd..721de613 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -32,7 +32,7 @@ import {sleep} from '../../../share/utils'; import bookManager from '../share/bookManager'; import DrawHelper from './DrawHelper'; -import reader from '../../../store/modules/reader'; +import rstore from '../../../store/modules/reader'; const minLayoutWidth = 100; export default @Component({ @@ -90,6 +90,11 @@ class TextPage extends Vue { this.$root.$on('resize', () => {this.$nextTick(this.onResize)}); this.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent); + + this.fontShifts = {}; + for (const font of rstore.fonts) { + this.fontShifts[font.name] = font.fontVertShift; + } } mounted() { @@ -103,15 +108,6 @@ class TextPage extends Vue { calcDrawProps() { //preloaded fonts - this.fontShifts = {//% - ReaderDefault: 0, - Roboto: 0, - OpenSans: 0, - Rubik: 0, - Avrile: -10, - Arimo: 0, - GEO_1: 10, - } if (!this.fontShifts.hasOwnProperty(this.fontName)) this.fontShifts[this.fontName] = this.fontVertShift; this.fontList = []; @@ -238,11 +234,11 @@ class TextPage extends Vue { this.fontName = settings.fontName; const wf = settings.webFontName; - const i = _.findIndex(reader.webFonts, ['name', wf]); + const i = _.findIndex(rstore.webFonts, ['name', wf]); if (wf && i >= 0) { this.fontName = wf; - this.fontCssUrl = reader.webFonts[i].css; - this.fontVertShift = reader.webFonts[i].fontVertShift; + this.fontCssUrl = rstore.webFonts[i].css; + this.fontVertShift = rstore.webFonts[i].fontVertShift; } this.lineInterval = settings.lineInterval;// px, межстрочный интервал diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index aff63692..2993d3f2 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -1,5 +1,15 @@ import Vue from 'vue'; +const fonts = [ + {name: 'ReaderDefault', label: 'По-умолчанию', fontVertShift: 0}, + {name: 'GEO_1', label: 'BPG Arial', fontVertShift: 10}, + {name: 'Arimo', fontVertShift: 0}, + {name: 'Avrile', fontVertShift: -10}, + {name: 'OpenSans', fontVertShift: 0}, + {name: 'Roboto', fontVertShift: 0}, + {name: 'Rubik', fontVertShift: 0}, +]; + const webFonts = [ {css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: 0}, {css: 'https://fonts.googleapis.com/css?family=Lobster', name: 'Lobster', fontVertShift: 0}, @@ -100,6 +110,7 @@ const mutations = { }; export default { + fonts, webFonts, namespaced: true, state,