Add Fixed32 numeric instances

This commit is contained in:
2024-02-11 18:50:25 +01:00
parent c5f715ac7c
commit 41b5c14e2f
4 changed files with 124 additions and 33 deletions

View File

@ -10,23 +10,23 @@ module Graphics.Fountainhead.MetricsSpec
import Graphics.Fountainhead.Metrics
import Test.Hspec (Spec, describe, it, shouldBe)
import qualified Data.ByteString as ByteString
spec :: Spec
spec =
describe "collectMetrics" $
it "collects information from the name table" $ do
let expected = FontDescriptor
{ fontName = "fontName"
, flags = []
, fullName = "fullName"
, familyName = "familyName"
, weight = "weight"
, fontBBox = FontBBox 0 0 0 0
, version = "1.0.0"
, notice = "Notice"
, encodingScheme = "encodingScheme"
, isFixedPitch = False
, ascender = 0
, descender = 0
let fontPath = "./fonts/OpenSans-Bold.ttf"
expected = FontDescriptor
{ fontName = "OpenSansBold"
, flags = [] -- 4
, ascender = 1068
, descender = -292
, fontBBox = FontBBox (-548) (-271) 1201 1047
, italicAngle = 0
, capHeight = 714
, stemV = 105
, missingWidth = 600
}
in collectMetrics `shouldBe` expected
openSansBoldItalic <- ByteString.readFile fontPath
collectMetrics fontPath openSansBoldItalic `shouldBe` Right expected