nuxt / fonts

Plug-and-play web font optimization and configuration for Nuxt apps.
https://nuxt.com
MIT License
369 stars 4 forks source link

Adobe font provider does not support dynamic subset #105

Closed dungsil closed 1 month ago

dungsil commented 1 month ago

@nuxt/font is fetching CSS files from Adobe Typekit. However, for fonts with East Asian languages, it is unable to fetch the CSS extensions.

https://github.com/nuxt/fonts/blob/22ae0b124095a8381971d1bf531ceff3eed53024/src/providers/adobe.ts#L109

Below is the difference in the Adobe fonts screen:

Inter Variable ( css file include ) image

Pretendard ( javascript file include ) image

East Asian characters (especially CJK) seem to have a large size, so Adobe can't import the entire font by default or all characters. image

If you look at the actual API being called, you'll see that East Asian languages don't come with css files.

Can you add support for these areas? If not, you can update the documentation to avoid confusing Asian users.

In the logs, it looks like this, making it difficult to determine the cause. image

Reference:

  1. Adobe fonts docs: https://helpx.adobe.com/kr/fonts/using/dynamic-subsetting.html
  2. Test font (Pretendard): https://fonts.adobe.com/fonts/pretendard
qwerzl commented 1 month ago

This is tricky - adding support for east Asian characters is indeed possible, actually I've already figured out a bit, but I don't think Adobe will be happy with this as the code they provide is clearly obfuscated and is not documented anywhere. So I guess we should just add a note in the docs to either directly use the script or use the local provider in such cases. @danielroe What do you think? If we do need to implement this feature, I would be interested to work on it.