Closed jbracker closed 11 years ago
Ok, I looked at the place where the font file is read and I think I have spotted the problem here: https://github.com/diagrams/SVGFonts/blob/master/src/Graphics/SVGFonts/ReadFont.hs#L169
ascent = read $ fromMaybe "" $ findAttr (unqual "ascent") fontface
descent = read $ fromMaybe "" $ findAttr (unqual "descent") fontface
I think the problem is that ascent
and descent
are passed on as String
s, though the intention here is to parse a number. Parsing a String
fails, because the quotes are missing. I checked all of the provided fonts and each has the ascent and descent attribute set. So I would suggest to change that code like this:
ascent = fromJust $ fmap read $ findAttr (unqual "ascent") fontface
descent = fromJust $ fmap read $ findAttr (unqual "descent") fontface
Proper error handling is missing either way...
I think the same error will occur with the values for xHeight
, capHeight
, stemh
, stemv
, fontWeight
and unitsPerEm
.
I will open a pull request with the corrected code soon.
This code leads to a
Prelude.read: no parse
:as does this code: