Skip to content

Commit

Permalink
Merge pull request #102 from suresh-gangumalla/font-construction
Browse files Browse the repository at this point in the history
Updated SDF and Web Font Construction
  • Loading branch information
michielvandergeest authored Jun 5, 2024
2 parents e82073a + 24275cf commit 58c2f5a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@lightningjs/msdf-generator": "^1.0.1",
"@lightningjs/renderer": "^0.8.4",
"@lightningjs/renderer": "^0.9.1",
"@lightningjs/vite-plugin-import-chunk-url": "^0.3.0",
"execa": "^8.0.1",
"kolorist": "^1.8.0",
Expand Down
18 changes: 16 additions & 2 deletions src/engines/L3/fontLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,24 @@ export default () => {
font.json = font.file.replace(/\.[^.]+$/, `.${font.type}.json`)
}
stage.fontManager.addFontFace(
new SdfTrFontFace(font.family, {}, font.type, stage, font.png, font.json)
new SdfTrFontFace(font.type, {
fontFamily: font.family,
descriptors: {},
atlasUrl: font.png,
atlasDataUrl: font.json,
stage,
metrics: font.metrics,
})
)
} else if (font.type === 'web') {
stage.fontManager.addFontFace(new WebTrFontFace(font.family, {}, font.file))
stage.fontManager.addFontFace(
new WebTrFontFace({
fontFamily: font.family,
fontUrl: font.file,
descriptors: {},
metrics: font.metrics,
})
)
}
})
}

0 comments on commit 58c2f5a

Please sign in to comment.