Skip to content

Commit 699a2a2

Browse files
committed
1 parent 0c9f26d commit 699a2a2

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

packages/project-editor/features/font/font.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,23 +2327,33 @@ export class Font extends EezObject {
23272327
let result;
23282328

23292329
const projectStore = ProjectEditor.getProjectStore(this);
2330+
23302331
result =
23312332
projectStore.fontsCacheStore.getCachedFontDefinition(
23322333
extractFontParams
23332334
);
2335+
23342336
if (!result) {
2335-
result = await extractFont(extractFontParams);
2337+
try {
2338+
result = await extractFont(extractFontParams);
2339+
} catch (err) {
2340+
}
23362341
}
23372342

23382343
if (result && result.lvglBinFile && result.lvglSourceFile) {
23392344
const binFile = result.lvglBinFile;
23402345
const sourceFile = result.lvglSourceFile;
23412346

23422347
runInAction(() => {
2343-
this._lvglFontDefinition = {
2344-
binFile,
2345-
sourceFile
2346-
};
2348+
if (this._lvglFontDefinition) {
2349+
this._lvglFontDefinition.binFile = binFile;
2350+
this._lvglFontDefinition.sourceFile = sourceFile;
2351+
} else {
2352+
this._lvglFontDefinition = {
2353+
binFile,
2354+
sourceFile
2355+
};
2356+
}
23472357
});
23482358
} else {
23492359
runInAction(() => {

packages/project-editor/store/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ export class ProjectStore {
690690
async doSave() {
691691
if (!this.project._isDashboardBuild) {
692692
await save(this, this.filePath!);
693+
694+
if (this.fontsCacheStore) {
695+
await this.fontsCacheStore.save();
696+
}
693697
}
694698

695699
runInAction(() => {
@@ -910,10 +914,6 @@ export class ProjectStore {
910914
await this.uiStateStore.save();
911915
}
912916

913-
if (this.fontsCacheStore) {
914-
await this.fontsCacheStore.save();
915-
}
916-
917917
if (this.project) {
918918
return await this.saveModified();
919919
}

0 commit comments

Comments
 (0)