Hof*_*off 13
通过使用potrace而不是autotrace解决了这个问题.
供参考,这些是以下步骤:
将位图转换为svg(linux命令行):
potrace -s sourceimg.bmp
Run Code Online (Sandbox Code Playgroud)
使用svg作为字形(python):
import fontforge
font = fontforge.open('blank.sfd')
glyph = font.createMappedChar('A')
glyph.importOutlines('sourceimg.svg')
font.generate('testfont.ttf')
Run Code Online (Sandbox Code Playgroud)
就是这样,以下结果在网站上使用:
CSS:
@font-face
{
font-family: testfont;
src: url('testfont.ttf');
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<span style="font-family:testfont; font-weight:normal; color:green;">A</span>
<span style="font-family:testfont; font-weight:bold; color:green;">A</span>
Run Code Online (Sandbox Code Playgroud)
