~alcinnz/CatTrap

48bb30e72fe8266d9404961b40e227ed308f4b7d — Adrian Cochrane 2 months ago 205f3ae
Reserve enough horizontal space for inline boxes.
1 files changed, 8 insertions(+), 7 deletions(-)

M Graphics/Layout/Inline.hs
M Graphics/Layout/Inline.hs => Graphics/Layout/Inline.hs +8 -7
@@ 75,16 75,17 @@ lowerSpacing :: (CastDouble m, CastDouble n) => (x -> PaddedBox m n) ->
lowerSpacing cb (Paragraph a b (RootBox c) d) = Paragraph a b (RootBox $ inner c) d
  where
    inner (Box childs opts) = flip Box opts $ map inner' childs
    inner' (InlineBox e@(_, Left box, _) child opts) = inlineBox e box child opts
    inner' (InlineBox e@(_, Right k, _) (Box childs opts') opts) =
        let box = cb k in inlineBox e box (Box childs opts' {
    inner' (InlineBox e@(_, Left box, _) child opts) =
        inlineBox e (leftSpace box') (rightSpace box') child opts
      where box' = mapX' unscale $ mapY' unscale box
    inner' (InlineBox e@(_, Right k, _) (Box childs opts') opts) = let box = cb k
        in inlineBox e (Box.width $ mapX' unscale box) 0 (Box childs opts' {
            textAscender = Just $ Box.height $ mapY' unscale box
          }) opts
    inner' self@(TextSequence _ _) = self
    inlineBox dat f child opts = InlineBox dat (inner child) $
        flip activateBoxSpacing opts $
            BoxSpacingLeftRight (leftSpace box) (rightSpace box)
      where box = mapX' unscale $ mapY' unscale f
    inlineBox dat left right child opts = InlineBox dat (inner child) $
        flip activateBoxSpacing opts $ BoxSpacingLeftRight left right



-- | A tree extracted from Balkón's inline layout.