How to load a font dynamically using next/font
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I’m building a landing page generator where users can choose a font for their landing. I store the font name in the database and planned to use next/font to load the selected font dynamically.
However, next/font doesn’t support this approach. Currently, I have a file font-loader.ts which includes all fonts, and a getFont() function retrieves the selected one. The problem is that all fonts are being loaded, impacting performance, and I haven’t found a way to load only the selected font.
However, next/font doesn’t support this approach. Currently, I have a file font-loader.ts which includes all fonts, and a getFont() function retrieves the selected one. The problem is that all fonts are being loaded, impacting performance, and I haven’t found a way to load only the selected font.