@hackage SVGFonts0.4

Fonts from the SVG-Font format

SVGFonts

This library parses the SVG-Fonts format which is in XML, so it is easy to manipulate by hand (See http://www.w3.org/TR/SVG/fonts.html).

Features:

  • Complete implementation of the SVG-Font format
  • Outline generation with elimination of holes for easy extrusion
  • Kerning (i.e. the two characters in "VA" have a shorter distance than in "VV")
  • Rasterization with with antialiasing (subsampling with 256 grey values) (soon)
  • Font-Cache

Usage: You can convert your favourite font (i.e. .ttf) into a .svg file with fontforge (the menu item under "Save All"). If a font converted on your own doesn't work, try the repair options, and if this still doens't work edit the file by hand or even cooler: help me with a patch to make this library more robust. Remember that a lot of fonts are not allowed to be distributed freely.

Example: src/Test/Font.hs generates a Collada file that can be read with tools like blender. The data that is passed to genCollada is represented with a data type that I use for all my libraries to allow easy combination.

The main function to generate a visual representation of a string is:

displayString :: String -> (Int,Int) -> Props -> Transf -> Mode -> Spacing -> O -> V -> V -> P -> TexMap -> [Geometry]

The list [AObj] can contain various data:

  • Textures that can be used directly by OpenGL (TextureObject)
  • Names of texture files in the fontcache (collada-output needs this)
  • Extruded or non extruded outlines