yjsvg 0.1.14 → 0.1.18
raw patch · 2 files changed
+23/−5 lines, 2 files
Files
- src/Text/XML/YJSVG.hs +22/−4
- yjsvg.cabal +1/−1
src/Text/XML/YJSVG.hs view
@@ -5,6 +5,8 @@ , Color(..) , Position(..), topleft, center , yjsvgVersion+, Font(..)+, FontWeight(..) ) where import Text.XML.HaXml(AttValue(..), QName(..), Prolog(..),@@ -15,9 +17,17 @@ import Data.Word(Word8) yjsvgVersion :: (Int, String)-yjsvgVersion = (7, "0.1.11a")+yjsvgVersion = (9, "0.1.17") -type Font = String+data FontWeight = Normal | Bold deriving (Show, Read)+weightValue :: FontWeight -> String+weightValue Normal = "normal"+weightValue Bold = "bold"++data Font = Font{+ fontName :: String,+ fontWeight :: FontWeight+ } deriving (Show, Read) data Position = TopLeft{posX :: Double, posY :: Double} | Center{posX :: Double, posY :: Double}@@ -125,10 +135,11 @@ = Elem (N "text") [ ( N "x", AttValue [ Left $ show x ] ) , ( N "y", AttValue [ Left $ show y ] )- , ( N "font-family", AttValue [ Left f ] )+ , ( N "font-family", AttValue [ Left $ fontName f ] )+ , ( N "font-weight", AttValue [ Left $ weightValue $ fontWeight f ] ) , ( N "font-size", AttValue [ Left $ show s ] ) , ( N "fill", AttValue [ Left $ mkColorStr c ] )- ] [ CString False t () ]+ ] [ CString False (escape t) () ] where (x, y) = getPos pw ph p @@ -225,3 +236,10 @@ = xmlParse "ougon.xml" ougonXml print $ document $ svgToXml 100 200 [ Rect 20 30 80 90 "black" "purple", Text 40 50 30 "underline" "purple" "good" ] -}++escape :: String -> String+escape "" = ""+escape ('&' : cs) = "&" ++ escape cs+escape ('<' : cs) = "<" ++ escape cs+escape ('>' : cs) = ">" ++ escape cs+escape (c : cs) = c : escape cs
yjsvg.cabal view
@@ -2,7 +2,7 @@ Cabal-Version: >= 1.6 Name: yjsvg-Version: 0.1.14+Version: 0.1.18 stability: experimental author: YoshikuniJujo <PAF01143@nifty.ne.jp> maintainer: YoshikuniJujo <PAF01143@nifty.ne.jp>