From b46e95a7c74a9952fe95d01db484fe64d11ec3af Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Thu, 28 Nov 2024 19:42:28 +0100 Subject: [PATCH] fix LVGL font creation --- .../project-editor/features/font/font.tsx | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/project-editor/features/font/font.tsx b/packages/project-editor/features/font/font.tsx index c3f6f9f2..e3739fe3 100644 --- a/packages/project-editor/features/font/font.tsx +++ b/packages/project-editor/features/font/font.tsx @@ -1440,6 +1440,9 @@ export class Font extends EezObject { try { let result; + let lvglRanges; + let lvglSymbols; + if (projectStore.projectTypeTraits.isLVGL) { result = await showGenericDialog(projectStore, { dialogDefinition: { @@ -1518,9 +1521,12 @@ export class Font extends EezObject { result.values.ranges ); - const { encodings, symbols } = removeDuplicates( - result.values.encodings, - result.values.symbols + lvglRanges = result.values.ranges; + lvglSymbols = result.values.symbols; + + const { encodings, symbols } = getLvglEncodingsAndSymbols( + lvglRanges, + lvglSymbols ); result.values.encodings = encodings; result.values.symbols = symbols; @@ -1637,7 +1643,9 @@ export class Font extends EezObject { size: result.values.size, threshold: result.values.threshold, createGlyphs: result.values.createGlyphs, - encodings: result.values.createGlyphs + encodings: projectStore.projectTypeTraits.isLVGL + ? result.values.encodings + : result.values.createGlyphs ? result.values.encodings ? result.values.encodings : [ @@ -1653,9 +1661,17 @@ export class Font extends EezObject { lvglVersion: projectStore.project.settings.general.lvglVersion, lvglInclude: - projectStore.project.settings.build.lvglInclude + projectStore.project.settings.build.lvglInclude, + getAllGlyphs: projectStore.projectTypeTraits.isLVGL + ? true + : undefined }); + if (projectStore.projectTypeTraits.isLVGL) { + (fontProperties as Font).lvglRanges = lvglRanges; + (fontProperties as Font).lvglSymbols = lvglSymbols; + } + const font = createObject( projectStore, fontProperties as any,