Skip to content

Commit

Permalink
remove unused fonts, include bitstream directly, move font loading to…
Browse files Browse the repository at this point in the history
… separate module
  • Loading branch information
robx committed Nov 26, 2018
1 parent 7e9c0f1 commit 017d205
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19,403 deletions.
18,967 changes: 0 additions & 18,967 deletions data/fonts/aneliza-light.svg

This file was deleted.

419 changes: 0 additions & 419 deletions data/fonts/gen-light.svg

This file was deleted.

1 change: 1 addition & 0 deletions puzzle-draw.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ library
Parse.Code
Draw.Style
Draw.Grid
Draw.Font
Draw.Lib
Draw.Elements
Draw.Widths
Expand Down
1 change: 1 addition & 0 deletions src/Draw/Draw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Draw.Draw (

import Diagrams.Prelude hiding (render)

import Draw.Font
import Draw.Lib
import Draw.Widths

Expand Down
19 changes: 19 additions & 0 deletions src/Draw/Font.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Draw.Font
( fontAnelizaRegular
, fontBit
, Font
)
where

import Graphics.SVGFonts.Fonts (bit)
import Graphics.SVGFonts.ReadFont (PreparedFont, loadFont)

import Paths_puzzle_draw (getDataFileName)

type Font = PreparedFont Double

fontAnelizaRegular :: IO Font
fontAnelizaRegular = getDataFileName "data/fonts/aneliza-regular.svg" >>= loadFont

fontBit :: IO Font
fontBit = getDataFileName "data/fonts/bitstream.svg" >>= loadFont
18 changes: 1 addition & 17 deletions src/Draw/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ module Draw.Lib where
import Diagrams.Prelude

import Graphics.SVGFonts.Text (TextOpts(..), Mode(..), Spacing(..), textSVG')
import Graphics.SVGFonts.Fonts (bit)
import Graphics.SVGFonts.ReadFont (PreparedFont, loadFont)

import Control.Arrow ((***))

import Paths_puzzle_draw (getDataFileName)
import Draw.Font

type Backend' b = (V b ~ V2, N b ~ Double,
Renderable (Path V2 Double) b, Backend b V2 Double)
Expand Down Expand Up @@ -100,8 +98,6 @@ fit f a = scale (f / m) a
where m = max (diameter unitX a)
(diameter unitY a)

type Font = PreparedFont Double

-- | Write text that is centered both vertically and horizontally and that
-- has an envelope. Sized such that single capital characters fit nicely
-- into a square of size @1@.
Expand All @@ -113,18 +109,6 @@ text'' fnt t = stroke (textSVG' (TextOpts fnt INSIDE_H KERN False 1 1) t)
rfc :: (HasStyle a, InSpace V2 Double a) => Colour Double -> a -> a
rfc = recommendFillColor

fontGenLight :: IO Font
fontGenLight = getDataFileName "data/fonts/gen-light.svg" >>= loadFont

fontAnelizaLight :: IO Font
fontAnelizaLight = getDataFileName "data/fonts/aneliza-light.svg" >>= loadFont

fontAnelizaRegular :: IO Font
fontAnelizaRegular = getDataFileName "data/fonts/aneliza-regular.svg" >>= loadFont

fontBit :: IO Font
fontBit = bit

-- | Variant of 'phantom' that forces the argument backend type.
phantom' :: Backend' b => Diagram b -> Diagram b
phantom' = phantom
1 change: 1 addition & 0 deletions src/tools/drawpuzzle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Data.Compose
import Data.PuzzleTypes (checkType, typeOptions)
import Draw.Draw
import Draw.Code
import Draw.Font
import Draw.Lib

import Options.Applicative
Expand Down

0 comments on commit 017d205

Please sign in to comment.