如何添加也使用字体显示的字体名称下拉列表,以便用户可以预览字体?

How can I add a dropdown of font names that also uses the font for display, so users can preview the font?

我的 CMS 的一部分允许用户指定用于显示字段的字体。字体列表永远不会超过 10 种字体,通常情况下会更少。

我想知道是否有一种方法可以显示下拉列表,以便为每个字体名称使用实际字体。

如果这不可能(或者需要太多自定义),我很乐意提供字体在表单旁边的外观预览(所以如果您不能回答第一个问题,也许你可以回答第二个问题。

提前致谢。

你可以create a custom field in Backpack for this purpose, and in that blade file you can use any JS you like. I found https://www.jqueryscript.net/other/system-google-font-picker.html which looks like it's exactly what you want, from its demo.