diagrams / SVGFonts

Fonts from the SVG-Font format
http://hackage.haskell.org/package/SVGFonts
Other
20 stars 12 forks source link

Wrong rendering of "87" with FreeSans font #31

Open ygale opened 4 years ago

ygale commented 4 years ago

After converting FreeSans to SVG using FontForge, the string "87" is rendered incorrectly by SVGFonts. FreeSans is a large font, but I cut it down to a minimal repro font with only 3 glyphs. In particular, I removed all kerning and it still reproduces, so this is not the same as #29.

In the following code, if you uncomment either the "FreeSans" line or the "font87bad" line, the text renders incorrectly. If you uncomment the "font87good" line (that font has only the two glyphs '7' and '8'), the text renders correctly. The fonts are attached, but I renamed them from .svg to .txt to make Github happy.

import Diagrams.Backend.SVG.CmdLine
import Diagrams.Prelude
import Graphics.SVGFonts

main = do
   --font <- loadFont "FreeSans.svg"
   font <- loadFont "font87bad.svg"
   --font <- loadFont "font87good.svg"
   let txt t =
         (stroke (textSVG' (TextOpts font INSIDE_H KERN False 10 10) t)
          :: Diagram B) # fillRule EvenOdd # fc black
   mainWith $ txt "8877"

font87bad.txt font87good.txt FreeSans.txt.gz