How to create custom Font Awesome 5 SVG definition?

£可爱£侵袭症+ 提交于 2019-12-03 16:47:12

The whole object you would feed to fontawesome.library.add(…iconDefinitions) actually looks like this:

{
  "prefix": "fa",  // probably better to use a custom one
  "iconName": "user",
  "icon": [
    512,          // viewBox width
    512,          // viewBox height
    [],           // ligatures
    "f007",       // unicode codepoint - private use area
    "M962…-112z"  // path
  ]
}

I can't point out documentation to support the interpretation, but in the source code fields are used accordingly.

The symbol viewBox is always rendered as "0 0 <width> <height>", so no x/y offsets are possible.

I haven't found any js code actually rendering ligatures, or icons defining them, so I am not sure what the content of that array would be. As they would be used for a search order, probably its meant to take a list of iconNames or codepoints. If this is related to the desktop ligature support, it is moot outside DTP applications and having the .otf files installed, anyway.

Unicode codepoints are used for the CSS Pseudo-elements method. and should be unique. All fontawesome codepoints seem to be above U+F000, so the range U+E000…U+EFFF looks to be good for custom entries.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!