Extracting SVG from Font Awesome

前端 未结 8 582
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 22:37

I want to get the SVG path data from Font Awesome glyphs so that I can use them straight up as SVG in my HTML. I thought it would be as easy as copy-pasting the path data fr

相关标签:
8条回答
  • 2020-11-28 23:06

    You can just download any Font-Awesome svg you need from their repo at Github

    https://github.com/FortAwesome/Font-Awesome/tree/master/svgs

    0 讨论(0)
  • 2020-11-28 23:13

    You can download them from flaticon.com here:

    http://www.flaticon.com/packs/font-awesome

    0 讨论(0)
  • 2020-11-28 23:16

    All per the SVG specification...

    Unlike standard graphics in SVG, where the initial coordinate system has the y-axis pointing downward, the design grid for SVG fonts, along with the initial coordinate system for the glyphs, has the y-axis pointing upward for consistency with accepted industry practice for many popular font formats.

    As per this comment, Changing the wrapper to <svg height="179.2" width="179.2"><path transform="scale(0.1,-0.1) translate(0,-1536)" d="..." /></svg> seems to do the trick, where 1792 is the units-per-em and 1536 is the ascent on font-face element

    0 讨论(0)
  • 2020-11-28 23:16

    Use fontforge script. There is a script I found online here:

    fontforge -lang=ff -c 'Open($1); SelectWorthOutputting(); foreach Export("svg"); endloop;' font.ttf 
    

    See: http://fontforge.sourceforge.net/scripting.html

    0 讨论(0)
  • 2020-11-28 23:23

    IcoMoon app makes this dead simple.

    0 讨论(0)
  • 2020-11-28 23:25

    Just get the ready svg icons from this github repo
    They are already flipped and centered as needed

    enter image description here

    Press any file and then "Raw" enter image description here

    0 讨论(0)
提交回复
热议问题