gnuplot 0.4.0.2 → 0.4.1
raw patch · 2 files changed
+27/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.Gnuplot.Terminal.PostScript: embedFont :: FilePath -> T -> T
+ Graphics.Gnuplot.Terminal.PostScript: font :: String -> Int -> T -> T
Files
gnuplot.cabal view
@@ -1,5 +1,5 @@ Name: gnuplot-Version: 0.4.0.2+Version: 0.4.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>
src/Graphics/Gnuplot/Terminal/PostScript.hs view
@@ -2,18 +2,21 @@ T, cons, landscape, portrait, eps, color, monochrome,+ font, embedFont, ) where import qualified Graphics.Gnuplot.Terminal as Terminal-import Data.Maybe (catMaybes, ) import Graphics.Gnuplot.Utility (quote, )+import Data.Maybe (maybeToList, ) data T = Cons { filename_ :: FilePath, mode_ :: Maybe Mode,- color_ :: Maybe Bool+ color_ :: Maybe Bool,+ embedFont_ :: [FilePath],+ font_ :: Maybe (String, Int) } cons :: FilePath -> T@@ -21,7 +24,9 @@ Cons { filename_ = path, mode_ = Nothing,- color_ = Nothing+ color_ = Nothing,+ embedFont_ = [],+ font_ = Nothing } @@ -43,7 +48,20 @@ monochrome term = term{color_ = Just False} +font :: String -> Int -> T -> T+font fontName fontSize term =+ term{font_ = Just (fontName, fontSize)} +{- |+Embed a font file in the generated PostScript output.+Each call adds a new font file,+there is no way to remove it again.+-}+embedFont :: FilePath -> T -> T+embedFont fontFile term =+ term{embedFont_ = fontFile : embedFont_ term}++ -- private functions data Mode =@@ -67,10 +85,11 @@ Terminal.Cons { Terminal.options = "postscript" :- catMaybes (- (fmap formatMode $ mode_ term) :- (fmap (\b -> if b then "color" else "monochrome") $ color_ term) :- []),+ (maybeToList $ fmap formatMode $ mode_ term) +++ (maybeToList $ fmap (\b -> if b then "color" else "monochrome") $ color_ term) +++ (concatMap (\path -> "fontfile" : quote path : []) $ embedFont_ term) +++ (maybe [] (\(name,size) -> "font" : quote name : show size : []) $ font_ term) +++ [], Terminal.commands = ["set output " ++ (quote $ filename_ term)] }