Web应用中多个字体的动态导入/选择
我有一个带有前端存储库和自定义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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论