Inverted glyph: bitmap > SVG via autotrace > glyph via fontforge

后端 未结 4 1422
我寻月下人不归
我寻月下人不归 2021-02-06 11:37

I am trying to create a font/glyph by:

  • taking a bitmap image
  • creating an SVG with autotrace (on Linux)
  • importing the outline as a glyph with pyt
4条回答
  •  遇见更好的自我
    2021-02-06 12:04

    solved this simply by using potrace instead of autotrace.

    for reference, these are the steps:

    convert bitmap to svg (linux command line):

    potrace -s sourceimg.bmp
    

    use svg as glyph (python):

    import fontforge
    font = fontforge.open('blank.sfd')
    glyph = font.createMappedChar('A')
    glyph.importOutlines('sourceimg.svg')
    font.generate('testfont.ttf')
    

    That's it, result below for use on a website:

    css:

    @font-face
    {
    font-family: testfont;
    src: url('testfont.ttf');
    }
    

    html:

    A
    A
    

    enter image description here

提交回复
热议问题