Chart-diagrams 1.9.3 → 1.9.5.1
raw patch · 2 files changed
Files
Chart-diagrams.cabal view
@@ -1,5 +1,5 @@ Name: Chart-diagrams-Version: 1.9.3+Version: 1.9.5.1 License: BSD3 License-file: LICENSE Copyright: Jan Bracker, 2006-2014@@ -9,7 +9,7 @@ Synopsis: Diagrams backend for Charts. Description: Diagrams backend for Charts. Category: Graphics-Cabal-Version: >= 1.6+Cabal-Version: 1.18 Build-Type: Simple data-files: fonts/LinLibertine_R.svg@@ -25,24 +25,26 @@ library+ default-language: Haskell98 Build-depends: base >= 3 && < 5- , old-locale- , time, mtl- , diagrams-core >= 1.3 && < 1.5+ , old-locale >= 1.0.0 && < 1.1+ , time >= 1.12 && < 1.13+ , diagrams-core >= 1.3 && < 1.6 , diagrams-lib >= 1.2 && < 1.5 , diagrams-svg >= 1.4 && < 1.5 , diagrams-postscript >= 0.7 && < 1.6- , SVGFonts >= 1.4 && < 1.8+ , SVGFonts >= 1.8 && < 1.9 , colour >= 2.2.1 && < 2.4 , blaze-markup >= 0.7 && < 0.9 , svg-builder >= 0.1 && < 0.2 , bytestring >= 0.9 && < 1.0 , operational >= 0.2.2 && < 0.3- , containers >= 0.4 && < 0.7+ , containers >= 0.4 && < 0.8 , data-default-class < 0.2- , lens >= 3.9 && < 4.19+ , lens >= 3.9 && < 5.3+ , mtl >= 2.0 && < 2.4 , Chart >= 1.9 && < 1.10- , text+ , text >= 2.0 && < 2.2 other-modules: Paths_Chart_diagrams Exposed-modules: Graphics.Rendering.Chart.Backend.Diagrams
Graphics/Rendering/Chart/Backend/Diagrams.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE CPP #-}@@ -49,6 +50,7 @@ import Control.Lens(makeLenses) import Control.Monad.Operational import Control.Monad.State.Lazy+import Control.Monad import Diagrams.Core.Transform ( Transformation(..) ) import Diagrams.Prelude@@ -395,7 +397,10 @@ let fs = envFontStyle env let (scaledH, scaledA, scaledD, scaledYB) = calcFontMetrics env return (mempty, TextSize- { textSizeWidth = realToFrac $ D2.width $ F.textSVG' (fontStyleToTextOpts env) text+ { textSizeWidth = realToFrac $ D2.width+ $ F.drop_rect+ $ F.fit_height scaledH+ $ F.svgText (fontStyleToTextOpts env) text , textSizeAscent = realToFrac scaledA -- scaledH * (a' / h') -- ascent , textSizeDescent = realToFrac scaledD -- scaledH * (d' / h') -- descent , textSizeYBearing = realToFrac scaledYB -- -scaledH * (capHeight / h)@@ -412,10 +417,13 @@ => Point -> String -> DState (N b) (D.QDiagram b V2 (N b) Any) dDrawTextSvg (Point x y) text = do env <- get+ let (scaledH, _, _, _) = calcFontMetrics env return $ D.transform (toTransformation $ translate (Vector x y) 1) $ applyFontStyleSVG (envFontStyle env) $ D2.scaleY (-1)- $ F.textSVG_ (fontStyleToTextOpts env) text+ $ F.set_envelope+ $ F.fit_height scaledH+ $ F.svgText (fontStyleToTextOpts env) text dDrawTextNative :: (D.Renderable (D2.Text (N b)) b, D.TypeableFloat (N b)) => Point -> String -> DState (N b) (D.QDiagram b V2 (N b) Any)@@ -572,42 +580,11 @@ fontStyleToTextOpts env = let fs = envFontStyle env font = envSelectFont env fs- (scaledH, _, _, _) = calcFontMetrics env in F.TextOpts { F.textFont = font- , F.mode = F.INSIDE_H , F.spacing = F.KERN , F.underline = False- , F.textWidth = 1- , F.textHeight = scaledH -- _font_size fs }--{-# DEPRECATED fontFromName "This function will be removed in the next release" #-}--#if MIN_VERSION_SVGFonts(1,7,0)-{-- We need this `unsafePerformIO` to deal with breaking- change in SVGFonts, which has changed the types of `F.lin` and `F.bit`- from `F.PreparedFont n` to `IO F.PreparedFont n`.- These functions simply read the files from `data-files`- of `SVGFonts`.--}-getPreparedFont = unsafePerformIO-#else-getPreparedFont = id-#endif--{-- The `fontFromName` function is not used inside this module.- It is not exported either. So it is safe to remove it- in the future release thus escaping use of `unsafePerformIO`.--}--fontFromName :: (Read n, RealFloat n) => String -> F.PreparedFont n-fontFromName name = case name of- "serif" -> getPreparedFont F.lin- "monospace" -> getPreparedFont F.bit- _ -> getPreparedFont F.lin -- | Convert line caps. convertLineCap :: LineCap -> D.LineCap