Skip to content

Commit

Permalink
fix text scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed May 3, 2014
1 parent 655f0ae commit d00167c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Diagrams/Backend/Rasterific.hs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ textBox f ps str = (float2Double w, float2Double h)
(w, h) = stringBoundingBox f 96 ps str

instance Renderable Text Rasterific where
render _ (Text tr al str) = R $ do
render _ (Text tt tn al str) = R $ do
isLocal <- fromMaybe True <$> getStyleAttrib getFontSizeIsLocal
fs <- fromMaybe 12 <$> getStyleAttrib (fromOutput . getFontSize)
slant <- fromMaybe FontSlantNormal <$> getStyleAttrib getFontSlant
fw <- fromMaybe FontWeightNormal <$> getStyleAttrib getFontWeight
Expand All @@ -428,7 +429,7 @@ instance Renderable Text Rasterific where
(refX, refY) = case al of
BaselineText -> (0, y)
BoxAlignedText xt yt -> (x * xt, (1 - yt) * y)
p = rasterificPtTransf ((moveOriginBy (r2 (refX, refY)) mempty) <> tr) (R.V2 0 0)
p = rasterificPtTransf ((moveOriginBy (r2 (refX, refY)) mempty) <> if isLocal then tt else tn) (R.V2 0 0)
liftR (R.withTexture fColor $ R.printTextAt fnt fs' p str)

instance Renderable (DImage Embedded) Rasterific where
Expand Down

0 comments on commit d00167c

Please sign in to comment.