FontyFruity 0.5.3.1 → 0.5.3.2
raw patch · 3 files changed
+36/−37 lines, 3 filesdep +xmldep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: xml
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- FontyFruity.cabal +6/−5
- changelog +3/−0
- src/Graphics/Text/TrueType/FontFolders.hs +27/−32
FontyFruity.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: FontyFruity-version: 0.5.3.1+version: 0.5.3.2 synopsis: A true type file format loader description: A haskell Truetype file parser.@@ -28,7 +28,7 @@ Source-Repository this Type: git Location: https://github.com/Twinside/FontyFruity.git- Tag: v0.5.3.1+ Tag: v0.5.3.2 library exposed-modules: Graphics.Text.TrueType@@ -47,10 +47,10 @@ , Graphics.Text.TrueType.FontType ghc-options: -Wall -O2- ghc-prof-options: -Wall -prof -auto-all+ ghc-prof-options: -Wall hs-source-dirs: src default-language: Haskell2010- build-depends: base >= 4.5 && < 4.9+ build-depends: base >= 4.5 && < 5 , binary >= 0.5 , bytestring >= 0.10 , containers >= 0.5 && < 0.6@@ -58,5 +58,6 @@ , directory , text , filepath- , deepseq >= 1.2+ , deepseq >= 1.2+ , xml >= 1.3
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +v0.5.3.2 May 2016+ * Fix: Bumping base bounds+ v0.5.3(.1) February 2016 * Fix: bug when trying to scan a directory * Addition: exposing descriptorOf function
src/Graphics/Text/TrueType/FontFolders.hs view
@@ -36,45 +36,43 @@ import Data.Binary( Binary( .. ) ) import Data.Binary.Get( Get , getWord32be- , getByteString + , getByteString ) import Data.Binary.Put( Put , putWord32be , putByteString ) import qualified Data.Map.Strict as M import System.FilePath( (</>) )-{--import Text.XML.HXT.Core( runX- , readDocument- , withValidate- , withSubstDTDEntities- , no- , multi- , getChildren- , isElem- , hasName- , getText- , (>>>) )--- -} -{-import qualified Control.Exception as E-}+import Text.XML.Light( elChildren+ , elName+ , onlyElems+ , parseXML+ , qName+ , strContent )++import qualified Control.Exception as E import qualified Data.Text as T+import qualified Data.Text.IO as T (readFile) import Graphics.Text.TrueType.FontType import Graphics.Text.TrueType.Header import Graphics.Text.TrueType.Name -{-catchAny :: IO a -> (E.SomeException -> IO a) -> IO a-}-{-catchAny = E.catch-}+import Control.DeepSeq (($!!)) -{-+catchAny :: IO a -> (E.SomeException -> IO a) -> IO a+catchAny = E.catch+ loadParseFontsConf :: IO [FilePath]-loadParseFontsConf = runX (- readDocument [withValidate no, withSubstDTDEntities no]- "/etc/fonts/fonts.conf"- >>> multi (isElem >>> hasName "dir" >>> getChildren >>> getText))+loadParseFontsConf = getPaths <$> T.readFile "/etc/fonts/fonts.conf"+ where+ getPaths s = map strContent+ $ filter ((== "dir") . qName . elName)+ $ concatMap elChildren+ $ onlyElems+ $ parseXML s --- -} #if !MIN_VERSION_base(4,6,0) lookupEnv :: String -> IO (Maybe String) lookupEnv varName = do@@ -85,14 +83,12 @@ #endif loadUnixFontFolderList :: IO [FilePath]-loadUnixFontFolderList =- -- Quick hack, need to change XML parser to a lighter one- return ["/usr/share/fonts", "/usr/local/share/fonts", "~/.fonts"]- {-- catchAny (do conf <- loadParseFontsConf- return $!! (</> "truetype") <$> conf)- (const $ return [])- --}+loadUnixFontFolderList = catchAny+ (do conf <- loadParseFontsConf+ return $!! conf ++ map (</> "truetype") conf)+ (const $ return defaults)+ where+ defaults = ["/usr/share/fonts", "/usr/local/share/fonts", "~/.fonts"] loadWindowsFontFolderList :: IO [FilePath] loadWindowsFontFolderList = toFontFolder <$> lookupEnv "Windir"@@ -243,4 +239,3 @@ font <- loader n findOrRest $ font >>= isMatching n else searchIn rest-