Skip to content

Commit

Permalink
Adding support for font weight and font slant
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakjois committed Jun 20, 2012
1 parent 7017fe8 commit 5605b2d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Graphics/Rendering/SVG.hs
Expand Up @@ -85,6 +85,8 @@ renderStyles s = mconcat . map ($ s) $
, renderDashing
, renderOpacity
, renderFontSize
, renderFontSlant
, renderFontWeight
]

renderLineColor :: Style v -> S.Attribute
Expand Down Expand Up @@ -152,6 +154,22 @@ renderFontSize s = renderAttr A.fontSize fontSize_
where
fontSize_ = ((++ "em") . show . getFontSize) <$> getAttr s

renderFontSlant :: Style v -> S.Attribute
renderFontSlant s = renderAttr A.fontStyle fontSlant_
where
fontSlant_ = (fontSlantAttr . getFontSlant) <$> getAttr s
fontSlantAttr :: FontSlant -> String
fontSlantAttr FontSlantItalic = "italic"
fontSlantAttr FontSlantOblique = "oblique"
fontSlantAttr FontSlantNormal = "normal"

renderFontWeight :: Style v -> S.Attribute
renderFontWeight s = renderAttr A.fontWeight fontWeight_
where
fontWeight_ = (fontWeightAttr . getFontWeight) <$> getAttr s
fontWeightAttr :: FontWeight -> String
fontWeightAttr FontWeightNormal = "normal"
fontWeightAttr FontWeightBold = "bold"

renderClipPathId :: Style v -> Int -> S.Attribute
renderClipPathId s id_ = renderAttr A.clipPath clipPathId
Expand Down

0 comments on commit 5605b2d

Please sign in to comment.