Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External fonts are rendered inconsistently #303

Closed
1 task done
dalechyn opened this issue May 4, 2024 · 5 comments · Fixed by #324
Closed
1 task done

External fonts are rendered inconsistently #303

dalechyn opened this issue May 4, 2024 · 5 comments · Fixed by #324

Comments

@dalechyn
Copy link
Collaborator

dalechyn commented May 4, 2024

Describe the bug

ref: #215 (comment)

Looks like fonts are not applied when fetched inside frame handler.

Link to Minimal Reproducible Example

https://github.com/dalechyn/frog-font-inconsistency

Steps To Reproduce

No response

Frog Version

0.9.2

TypeScript Version

5.4.5

Check existing issues

Anything else?

No response

@tmm
Copy link
Member

tmm commented May 15, 2024

Can we close this now?

@dalechyn
Copy link
Collaborator Author

Can we close this now?

No, still reproducible. taking a look at it rn.

@dalechyn
Copy link
Collaborator Author

The core issue arises from the fact that ArrayBuffer is not serializable by nature.

Since fonts is an accepted property in frame handler's imageOptions, there's no way local fonts can be supported there as we cannot serialize the ArrayBuffer.

See:
https://github.com/dalechyn/frog-font-inconsistency/blob/379511685f1421ae24c55203097152c052b78c8a/api/index.tsx#L63-L71.

Moreover, trying to pass non-local fonts would not also work because of this:

frog/src/frog-base.tsx

Lines 580 to 581 in a98f567

// TODO: Remove once `fonts` is removed from `imageOptions`.
fonts: undefined,
.

considering the mentioned above, I don't think it's worth making it work since user can define fonts in Frog constructor which would not have to be needed to be serialized, and if one needs multiple fonts he better would have to import his fonts there.

@scottrepreneur
Copy link
Contributor

Thanks for digging into this guys. Can you also clarify in the docs where this overlaps with using a local/custom font within Frog UI here? Seems the same implementation works over there.

https://frog.fm/ui/createSystem#fonts

@madroneropaulo
Copy link

I can confirm that declaring fonts in the Frog constructor works. To me that's enough since fonts can be imported there and used everywhere. I can't think of an scenario where that wouldn't be enough. I'd only suggest making it VERY clear in the docs and that's it. Thanks!

dalechyn added a commit that referenced this issue May 23, 2024
* fix: delete `font` from frame response `imageOptions`

Closes #303

* chore: changesets

* fix: types

* fix: build

* nit: prettify 💅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants