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

Feature request: get fonts data or url #2

Open
florian-lefebvre opened this issue Dec 15, 2023 · 6 comments
Open

Feature request: get fonts data or url #2

florian-lefebvre opened this issue Dec 15, 2023 · 6 comments

Comments

@florian-lefebvre
Copy link
Contributor

When using tools like Satori, we need to load fonts. It would be great to be able to access the data loaded in an endpoint

@rishi-raj-jain
Copy link
Owner

Hey @florian-lefebvre,

With the recently released version, now all the font files are present in a astro-font specific directory: https://github.com/rishi-raj-jain/astro-font/blob/master/packages/astro-font/utils.ts#L89

Does this solve your use case?

@rishi-raj-jain
Copy link
Owner

Btw, love the support! Happy to improve the library.

@florian-lefebvre
Copy link
Contributor Author

I can't try it now but it sounds good! It may be great to provide a little utility function to retrieve the data like:

export const getFontData = (fontName: string): ArrayBuffer => {
	// ...
}

@rishi-raj-jain
Copy link
Owner

Looking into this. Reading upon how can I do this.

@rishi-raj-jain
Copy link
Owner

@florian-lefebvre

I can use your direction here, how ideally would this function work?

@florian-lefebvre
Copy link
Contributor Author

I already shared the type signature above. Regarding its behavior, you're currently fonts files inside your cache. This function would retrieve the right font data (just reading the file content really) from the font family name

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

2 participants