Menu

using custom ttf fonts in svg -- afm and pfb required?

Help
Erik
2015-11-19
2015-11-20
  • Erik

    Erik - 2015-11-19

    I am trying to get gm to render some custom ttf fonts from an svg file.

    This posting
    http://comments.gmane.org/gmane.comp.video.graphicsmagick.help/1585
    suggests I could modify my type.mgk file.

    Looking in that file and at this reference
    http://www.graphicsmagick.org/1.1/www/import.html
    it seems I need to convert my ttf to an afm and pfb file?

    Before I begin such conversions, wanted to ensure there was an easier way to do this, hopefully using the existing ttf files.

    Thanks!

     
    • Bob Friesenhahn

      Bob Friesenhahn - 2015-11-19

      On Thu, 19 Nov 2015, Erik wrote:

      I am trying to get gm to render some custom ttf fonts from an svg file.

      This posting http://comments.gmane.org/gmane.comp.video.graphicsmagick.help/1585 suggests I could modify my type.mgk
      file.

      Looking in that file and at this reference http://www.graphicsmagick.org/1.1/www/import.html it seems I need to convert
      my ttf to an afm and pfb file?

      This is documentation for 1.1, which is a very old release branch.

      Before I begin such conversions, wanted to ensure there was an easier way to do this, hopefully using the existing ttf
      files.

      using custom ttf fonts in svg -- afm and pfb required?

      There is no need to convert anything. GraphicsMagick uses FreeType,
      which supports many types of fonts. The example you found is for
      Postscript fonts which use a separate Adobe Font Metrics (AFM) file.

      It is necessary to create a type.mkg, or extend the existing type.mgk
      via an include statement to include your fonts.

      The hard part is to determine the properties of the fonts you have so
      that they are properly described and will be automatically selected
      based on their properties from your SVG. Each font requires a 'type'
      specification:

      <?xml version="1.0"?>
      <typemap>
         <type
           name="Arial"
           fullname="Arial"
           family="Arial"
           weight="400"
           style="normal"
           stretch="normal"
           glyphs="/my/font/dir/arial.ttf"
           />
           .
           .
           .
      </typemap>
      

      Use

      gm convert -list type
      

      To make sure that your .mgk file is being used and the descriptions
      are ok.

      Bob

      --
      Bob Friesenhahn
      bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
      GraphicsMagick Maintainer, http://www.GraphicsMagick.org/

       

Log in to post a comment.