SVGFonts 1.8.1 → 1.8.2
raw patch · 3 files changed
+23/−15 lines, 3 filesdep −diagrams-coredep −directorydep −parsecdep ~containersdep ~diagrams-libPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: diagrams-core, directory, parsec
Dependency ranges changed: containers, diagrams-lib
API changes (from Hackage documentation)
- Graphics.SVGFonts: drop_rect :: forall n. RealFloat n => PathInRect n -> Path V2 n
+ Graphics.SVGFonts: drop_rect :: RealFloat n => PathInRect n -> Path V2 n
- Graphics.SVGFonts: svgText_fitRect :: forall n. RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n
+ Graphics.SVGFonts: svgText_fitRect :: RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n
- Graphics.SVGFonts: svgText_fitRect_stretchySpace :: forall n. RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n
+ Graphics.SVGFonts: svgText_fitRect_stretchySpace :: RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n
- Graphics.SVGFonts.PathInRect: drop_rect :: forall n. RealFloat n => PathInRect n -> Path V2 n
+ Graphics.SVGFonts.PathInRect: drop_rect :: RealFloat n => PathInRect n -> Path V2 n
- Graphics.SVGFonts.ReadFont: type OutlineMap n = Map String (Path V2 n)
+ Graphics.SVGFonts.ReadFont: type OutlineMap n = Map String Path V2 n
- Graphics.SVGFonts.Text: svgText_fitRect :: forall n. RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n
+ Graphics.SVGFonts.Text: svgText_fitRect :: RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n
- Graphics.SVGFonts.Text: svgText_fitRect_stretchySpace :: forall n. RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n
+ Graphics.SVGFonts.Text: svgText_fitRect_stretchySpace :: RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n
- Graphics.SVGFonts.Wrap: wrapText :: forall n m. (TypeableFloat n, Monad m) => TextOpts n -> n -> [(String -> m Split, (n, n))] -> String -> m [String]
+ Graphics.SVGFonts.Wrap: wrapText :: (TypeableFloat n, Monad m) => TextOpts n -> n -> [(String -> m Split, (n, n))] -> String -> m [String]
- Graphics.SVGFonts.Wrap: wrapTextLine :: forall n m. (TypeableFloat n, Monad m) => TextOpts n -> n -> [(String -> m Split, (n, n))] -> String -> m (String, String)
+ Graphics.SVGFonts.Wrap: wrapTextLine :: (TypeableFloat n, Monad m) => TextOpts n -> n -> [(String -> m Split, (n, n))] -> String -> m (String, String)
Files
- CHANGES.md +8/−0
- SVGFonts.cabal +4/−7
- src/Graphics/SVGFonts/ReadFont.hs +11/−8
CHANGES.md view
@@ -1,3 +1,11 @@+1.8.2 (15 Aug 2026)+-------------------++- Fix some warnings+- Allow `containers-0.8` and `diagrams-lib-1.6`+- Test on GHC 9.14+- Remove unnecessary dependencies: `diagrams-core`, `directory`, `parsec`+ 1.8.1 (15 Feb 2025) -------------------
SVGFonts.cabal view
@@ -1,5 +1,5 @@ Name: SVGFonts-Version: 1.8.1+Version: 1.8.2 Synopsis: Fonts from the SVG-Font format Description: Native font support for the diagrams framework (<https://diagrams.github.io/>). Note that this package can be used with any diagrams backend, not just the SVG backend. The SVG-font format is easy to parse and was therefore chosen for a font library completely written in Haskell.@@ -34,7 +34,7 @@ data-files: fonts/*.svg extra-source-files: CHANGES.md, README.md, diagrams/*.svg extra-doc-files: diagrams/*.svg-Tested-with: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.5 || ==9.8.2 || ==9.10.1 || ==9.12.1+Tested-with: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.2 || ==9.14.1 source-repository head type: git location: https://github.com/diagrams/SVGFonts.git@@ -49,14 +49,11 @@ bytestring >= 0.10 && < 1.0, cereal, cereal-vector,- containers >= 0.4 && < 0.8,+ containers >= 0.4 && < 0.9, data-default-class >= 0.2 && < 0.3,- diagrams-core >= 1.3 && < 1.6,- diagrams-lib >= 1.3 && < 1.6,- directory >= 1.1,+ diagrams-lib >= 1.3 && < 1.7, blaze-svg >= 0.3.3, blaze-markup >= 0.5,- parsec, split, text, vector,
src/Graphics/SVGFonts/ReadFont.hs view
@@ -93,9 +93,10 @@ parseFont basename contents = readFontData fontElement basename where xml = onlyElems $ parseXML $ contents- fontElement | null fontElements = error ("no <font>-tag found in SVG file using SVGFonts library." +++ fontElement = case catMaybes fontElements of+ [] -> error ("no <font>-tag found in SVG file using SVGFonts library." ++ "Most likely wrong namespace in <svg>-tag. Please delete xmlns=...")- | otherwise = head $ catMaybes $ fontElements+ (f:_) -> f fontElements = map (findElement (qTag "font")) xml ++ -- sometimes there is a namespace given with <svg xmlns=... map (findElement (unqual "font")) xml -- sometimes not: <svg>@@ -271,12 +272,14 @@ -- | Change the horizontal advance of two consective chars (kerning) kernAdvance :: RealFloat n => String -> String -> Kern n -> Bool -> n-kernAdvance ch0 ch1 kern u | u && not (null s0) = (kernK kern) V.! (head s0)- | not u && not (null s1) = (kernK kern) V.! (head s1)- | otherwise = 0- where s0 = intersect (s kernU1S ch0) (s kernU2S ch1)- s1 = intersect (s kernG1S ch0) (s kernG2S ch1)- s sel ch = concat (maybeToList (Map.lookup ch (sel kern)))+kernAdvance ch0 ch1 kern u+ | u, (s0h : _) <- s0 = kernK kern V.! s0h+ | not u, (s1h : _) <- s1 = kernK kern V.! s1h+ | otherwise = 0+ where+ s0 = intersect (s kernU1S ch0) (s kernU2S ch1)+ s1 = intersect (s kernG1S ch0) (s kernG2S ch1)+ s sel ch = concat (maybeToList (Map.lookup ch (sel kern))) -- > import Graphics.SVGFonts.ReadFont -- > linL <- loadDataFont "fonts/LinLibertine.svg"