Web应用中多个字体的动态导入/选择

发布于 2025-01-31 11:39:50 字数 304 浏览 0 评论 0原文

我有一个带有前端存储库和自定义CMS(Java API后端)的VUE应用程序,您可以从CMS更改颜色和资产,我想从CMS添加动态字体选择。 我的问题是,这是根据干净的代码和性能实现这一目标的最佳方法。

我的想法是加载一堆流行字体,并让用户从CMS中进行选择。在这种情况下 (缺点用户将无法上传/使用另一种自定义字体)

从CMS上传TTF/WOFF2文件并从Frontend下载并使用它们。(缺点初始请求和加载时间)

使用Google字体并在CMS中添加选择器用户可以选择。(缺点初始请求和加载时间)

其他任何想法或某人在其他情况下做过吗?

I have a vue app with a frontend repo and a custom CMS (JAVA API backend), you can change colors and assets from CMS and I want to add dynamic font selection from CMS.
My question is, which is the best way to achieve that based on clean code and performance.

My thoughts were, to load a bunch of popular fonts and let the User choose from CMS. In that case I will add all fonts to the frontend repo and lazy-load them based on selection
(Drawback the user will not be able to upload/use another custom font)

Upload the ttf/woff2 files from CMS and download them from frontend and use them.(Drawback initial request and load time)

Use Google Fonts and add a selector in CMS for the user to choose.(Drawback initial request and load time)

Any other ideas or someone that has done it before otherwise?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文