open-design-sdk icon indicating copy to clipboard operation
open-design-sdk copied to clipboard

Fallback fonts not working

Open xorb opened this issue 3 years ago • 4 comments

Hi guys, seems like fallback fonts are not being recognized. Systems fonts are working fine.

"@opendesign/sdk": "^0.4.5" node: v14.19.3

Error message:

(node:105008) UnhandledPromiseRejectionWarning: Error: Unknown font format
    at Object.fontkit.create (/home/xorb/Projects/ProgPack/parse-ai/node_modules/@avocode/fontkit/src/base.js:99:9)
    at SystemFontManager.<anonymous> (/home/xorb/Projects/ProgPack/parse-ai/node_modules/@opendesign/sdk/src/local/system-font-manager.ts:287:52)
    at Generator.next (<anonymous>)

Project structure:

.
├── fonts
│   └── Inter-Regular.otf
├── package.json
├── Preview_text_multi.ai
├── src
│   ├── fonts
│   │   └── Inter-Regular.otf
│   └── index.ts
├── tsconfig.json
└── yarn.lock

Config:

 const sdk = createSdk({ token: OPEN_DESIGN_TOKEN });
 sdk.setGlobalFontDirectory("./fonts");
 sdk.setGlobalFallbackFonts(["Inter-Regular"]);

Sample repo: https://github.com/xorb/opendesign-text-issue

xorb avatar Jun 09 '22 17:06 xorb

I have been testing it on another linux distributions. No issues with Manjaro. Probably some package missing on the other linux distribution. Previously using Garuda Linux.

xorb avatar Jun 09 '22 19:06 xorb

Seems like issue is back. Facing that issue again. It worked once.

xorb avatar Jun 10 '22 04:06 xorb

Hi @xorb - very sorry for the late reply on this. I opened your sample repository and tested it in a Docker container (Debian GNU/Linux 11 (bullseye)) and everything worked fine 🤔 Specifically, I used the VS Code Remote Workspaces image for Node + TypeScript.

I certainly haven't tested this with Garuda or Manjaro and you're right that it could be some missing packages. What does your production environment look like? Is it Debian/Ubuntu or something else?

rhefner1 avatar Jun 20 '22 09:06 rhefner1

In production, we are using Amazon ami linux 2. It works fine inside vagrant. Probably we need to do some adjustments in our side.

xorb avatar Jun 27 '22 17:06 xorb