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

Issues with fetching fonts while using the addon. #216

Open
irumvanselme opened this issue Sep 30, 2024 · 0 comments
Open

Issues with fetching fonts while using the addon. #216

irumvanselme opened this issue Sep 30, 2024 · 0 comments

Comments

@irumvanselme
Copy link

irumvanselme commented Sep 30, 2024

[Issue]

I am working on a React project that involves fetching fonts on demand. Everything works perfectly on the frontend. However, when running the same components in Storybook, the fonts are not loading correctly due to the Storybook addon, which intercepts HTTP requests.

When we removed the addon, the fonts loaded correctly in Storybook.

The fonts being returned are different from what is expected, and certain font data (such as the cmap table) is missing. This was discovered during debugging and could provide a clue to the issue.

The Problem:

The fonts returned are not identical to the ones served from the server.

[Steps to Reproduce]

Create a simple React project.
Add Storybook and the storybook-addon-mock addon.
Add @react-pdf/renderer.
Use custom fonts.
Try to download the PDF generated in Storybook.
The fonts in the PDF will be invalid or incomplete.

[screenshots]
image
requestes fetched over using fetch works perfectly, but ones with xhr api are failing, the ones for fonts.

image

Error in particular, I am facing, Font does not have cmap.tables.

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

No branches or pull requests

1 participant