Skip to content

Commit

Permalink
fix LVGL font creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 28, 2024
1 parent 8a50321 commit b46e95a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/project-editor/features/font/font.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
: [
Expand All @@ -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<Font>(
projectStore,
fontProperties as any,
Expand Down

0 comments on commit b46e95a

Please sign in to comment.