ku-fpg/blank-canvas — pull request #52 by RyanGlScott (2014-11-01 01:41:38+00:00)
Title: Overloaded font

This fixes issue #45. It provides an overloaded version of the `font` function (not visible unless you import the `Graphics.Blank.Font` module) that also accepts a `Font` ADT in addition to `Text`. I tried to make the various `Font`-related data types behave as closely as possible to their [CSS counterparts](https://developer.mozilla.org/en-US/docs/Web/CSS/font), which is reflected in their `IsString`, `Read`, and `Show` instances. I also tried to hand shorthand functions to make the overloaded versions look similar to how CSS does it. For example this is equivalent to `italic 12px/14px Gill Sans Extrabold, sans-serif`:

```haskell
(defFont ["Gill Sans Extrabold", sansSerif]) {
fontStyle = italic
, fontSize = px 12
, lineHeight = px 14
}
```

I had considered adding some wacky `Num` instances so that units (e.g., `px`, `percent`) could be used in postfix fashion, but I would have lost some flexibility with the typeclasses I used, so I decided against it.