0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-03 05:10:13 -05:00

Find missing fonts in all the document (#170)

* Find missing fonts in all the document

* add changelog
This commit is contained in:
Jordi Sala Morales 2024-06-17 16:33:01 +02:00 committed by GitHub
parent 5f884985b9
commit ebad146d7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fix fonts detection traversal on the whole document

View file

@ -1,6 +1,5 @@
import { isGoogleFont } from '@plugin/translators/text/font/gfonts';
import { isLocalFont } from '@plugin/translators/text/font/local';
import { sleep } from '@plugin/utils';
import { registerChange } from './registerChange';
@ -10,12 +9,10 @@ export const findAllTextNodes = async () => {
for (const page of figma.root.children) {
await page.loadAsync();
for (const node of page.children) {
if (node.type === 'TEXT') {
extractMissingFonts(node, fonts);
}
const nodes = page.findAll(node => node.type === 'TEXT') as TextNode[];
await sleep(0);
for (const node of nodes) {
extractMissingFonts(node, fonts);
}
}