title: Import a sequence of .svg files into FontForge as glyphs and output a font file
body: <p>I want to create a font with a large volume of glyphs. Think Japanese kanji, in the thousands. So there will definitely be some scripting / batch processing required. Luckily FontForge supports python scripting! Unluckily I haven't been able to get it working. [sadface]</p>
  
  <p>Firstly, thanks to the user <a href="https://stackoverflow.com/users/102181/hoff">Hoff</a> for posting code <a href="https://stackoverflow.com/questions/12713444/inverted-glyph-bitmap-svg-via-autotrace-glyph-via-fontforge">here</a> that answered a big part of my question. But upon running his script I encounter problems which raise more questions: </p>
  
  <pre><code>Failed to find NameList: AGL For New Fonts
  Warning: Font contained no glyphs
  </code></pre>
  
  <p><em>Updates:</em></p>
  
  <ul>
  <li>The "font contained no glyphs" error is apparently a bug in FontForge that occurs when the font contains one or less glyph. Adding a second glyph 'B' resolved this.</li>
  <li>I found the same syntax can be used whether saving .ttf .sfd .otf etc.</li>
  <li>The NameList failure actually doesn't prevent the font file from being written. I was happy to discover this, but still don't understand how to provide the NameList it wants.</li>
  </ul>
  
  <p>Here is Hoff's code:</p>
  
  <pre><code>import fontforge
  font = fontforge.open('blank.sfd')
  glyph = font.createMappedChar('A')
  glyph.importOutlines('sourceimg.svg')
  font.generate('testfont.ttf')
  </code></pre>
  
  <p>After five hours of struggling yesterday with building FontForge (a confusing process on a Mac). I appear to have it up and running properly. I had at first installed a pre-built version from a .dmg only to find it lacked python support. But since Hoff seemed not to encounter the same error I did, I'm not ruling out a build issue.</p>
  
  <p>Either way, I don't understand the error involving AGL. What is AGL? <a href="http://fontforge.org/encodingmenu.html#namelist" rel="noreferrer">I looked it up</a>: "Adobe Glyph List - a standard glyph naming convention". Sounds like FontForge tried to map Unicode values to glyph names and couldn't. </p>
  
  <p>So, why the AGL NameList problem?
  Thanks in advance for any help.</p>