Доделки по загрузке шрифтов
This commit is contained in:
@@ -257,15 +257,32 @@ class TextPage extends Vue {
|
|||||||
this.pageChangeTransitionSpeed = settings.pageChangeTransitionSpeed; //0-100%
|
this.pageChangeTransitionSpeed = settings.pageChangeTransitionSpeed; //0-100%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async calcPropsAndLoadFonts(omitLoadFonts) {
|
||||||
|
this.calcDrawProps();
|
||||||
|
|
||||||
|
if (!omitLoadFonts)
|
||||||
|
await this.loadFonts();
|
||||||
|
|
||||||
|
//this.draw();
|
||||||
|
|
||||||
|
// шрифты хрен знает когда подгружаются, поэтому
|
||||||
|
if (!this.parsed.force) {
|
||||||
|
let i = 0;
|
||||||
|
this.parsed.force = true;
|
||||||
|
while (i < 10) {
|
||||||
|
this.draw();
|
||||||
|
await sleep(1000);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
this.parsed.force = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadSettings() {
|
loadSettings() {
|
||||||
(async() => {
|
(async() => {
|
||||||
let fontName = this.fontName;
|
let fontName = this.fontName;
|
||||||
|
|
||||||
this.getSettings();
|
this.getSettings();
|
||||||
this.calcDrawProps();
|
await this.calcPropsAndLoadFonts(fontName == this.fontName);
|
||||||
|
|
||||||
if (fontName != this.fontName)
|
|
||||||
await this.loadFonts();
|
|
||||||
|
|
||||||
this.draw();
|
this.draw();
|
||||||
})();
|
})();
|
||||||
@@ -311,22 +328,7 @@ class TextPage extends Vue {
|
|||||||
|
|
||||||
this.parsed = this.book.parsed;
|
this.parsed = this.book.parsed;
|
||||||
|
|
||||||
this.calcDrawProps();
|
this.calcPropsAndLoadFonts();
|
||||||
|
|
||||||
await this.loadFonts();
|
|
||||||
|
|
||||||
//this.draw();
|
|
||||||
|
|
||||||
// шрифты хрен знает когда подгружаются, поэтому
|
|
||||||
let i = 0;
|
|
||||||
this.parsed.force = true;
|
|
||||||
while (i < 10) {
|
|
||||||
this.draw();
|
|
||||||
await sleep(1000);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
this.parsed.force = false;
|
|
||||||
|
|
||||||
this.refreshTime();
|
this.refreshTime();
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ const fonts = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const webFonts = [
|
const webFonts = [
|
||||||
{css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: 0},
|
{css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: -20},
|
||||||
{css: 'https://fonts.googleapis.com/css?family=Lobster', name: 'Lobster', fontVertShift: 0},
|
{css: 'https://fonts.googleapis.com/css?family=Lobster', name: 'Lobster', fontVertShift: 0},
|
||||||
{css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: 0},
|
{css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: -40},
|
||||||
{css: 'https://fonts.googleapis.com/css?family=Comfortaa', name: 'Comfortaa', fontVertShift: 0},
|
{css: 'https://fonts.googleapis.com/css?family=Comfortaa', name: 'Comfortaa', fontVertShift: 10},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user