From 6aee902e3422076890804f871a46a7ce6680c7ab Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 17 Jan 2019 01:46:41 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D1=85=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/TextPage/TextPage.vue | 1 + client/components/Reader/share/BookParser.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 4c83d807..0949b802 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -47,6 +47,7 @@ class TextPage extends Vue { this.canvas = this.$refs.canvas; this.context = this.canvas.getContext('2d'); this.context.textAlign = 'left'; + this.context.textBaseline = 'bottom'; } calcDrawProps() { diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 64cc2445..8c3ee874 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -237,7 +237,7 @@ export default class BookParser { 'Б', 'В', 'Г', 'Д', 'Ж', 'З', 'Й', 'К', 'Л', 'М', 'Н', 'П', 'Р', 'С', 'Т', 'Ф', 'Х', 'Ч', 'Ц', 'Ш', 'Щ' ]); const znak = new Set(['ь', 'Ь', 'ъ', 'Ъ', 'й', 'Й']); - const alpha = new Set([...glas, ...soglas, ...znak, ' ']); + const alpha = new Set([...glas, ...soglas, ...znak]); let slog = ''; let slogLen = 0; @@ -260,13 +260,18 @@ export default class BookParser { alpha.has(word[i + 1]) && alpha.has(word[i + 2]) ) || //мягкий или твердый знак или Й - (znak.has(word[i])) + (znak.has(word[i])) || + (word[i] == '-') ) && //нельзя оставлять окончания на ь, ъ, й !(znak.has(word[i + 2]) && !alpha.has(word[i + 3])) ) { - result.push(slog); + if (word[i] != '-') + result.push(slog); + else { + result.push(slog.substr(0, slog.length - 1)); + } slog = ''; slogLen = 0; } @@ -343,7 +348,7 @@ export default class BookParser { pw = ww; slogi.shift(); } - + if (pw) { prevW = pw; prevPart = s + '-';