vercel / geist-font

https://vercel.com/font
SIL Open Font License 1.1
2.13k stars 54 forks source link

[Next] Allow importing font files directly #93

Open mwskwong opened 3 months ago

mwskwong commented 3 months ago

This is not a bug, but a RFC. Since there isn't a way to open a GitHub issue or discussion for topics other than bugs, I guess this is the only way.

I would like to propose allowing users to directly import the font files. i.e. .ttf and .woff2 files in the geist package. This can be done by adding a new entry on the package.json, e.g.:

diff --git a/node_modules/geist/package.json b/node_modules/geist/package.json
index a18fe0d..6860b2c 100644
--- a/node_modules/geist/package.json
+++ b/node_modules/geist/package.json
@@ -49,7 +49,8 @@
       "import": "./dist/sans-non-variable.js",
       "require": "./dist/sans-non-variable.js",
       "default": "./dist/index.d.ts"
-    }
+    },
+    "./assets/fonts/*": "./dist/fonts/*"
   },
   "license": "SIL OPEN FONT LICENSE",
   "peerDependencies": {

This is beneficial when the users need to refer to the font files themselves. e.g. when creating opengraph-image.tsx.