A .golden/richParagraphLayout/offsetMiddleDownOuterTextWrap.golden => .golden/richParagraphLayout/offsetMiddleDownOuterTextWrap.golden +91 -0
@@ 0,0 1,91 @@
+ParagraphLayout
+ { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 1936, y_size = -4984}
+ , paragraphLines =
+ [ Line {lineNumber = 1, lineRect = Rect {x_origin = 0, y_origin = 0, x_size = 1936, y_size = -1121}}
+ , Line {lineNumber = 2, lineRect = Rect {x_origin = 0, y_origin = -1121, x_size = 1936, y_size = -1621}}
+ , Line {lineNumber = 3, lineRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}}
+ , Line {lineNumber = 4, lineRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1936, y_size = -1121}}
+ ]
+ , paragraphFragments =
+ [ Fragment
+ { fragmentUserData = "outer start"
+ , fragmentLine = 1
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = 0, x_size = 1723, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 1723, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 82, cluster = 5, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 81, cluster = 6, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 574, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 72, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 559, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "outer start"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -1121, x_size = 1757, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -1121, x_size = 1757, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 87, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 402, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 90, cluster = 10, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 765, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 82, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "inner"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ [ AncestorBox {boxUserData = "box", boxLeftEdge = SpacedEdge 0, boxRightEdge = SpacedEdge 0, boxStartEdge = SpacedEdge 0, boxEndEdge = SpacedEdge 0}
+ ]
+ , fragmentContentRect = Rect {x_origin = 1757, y_origin = -1621, x_size = 0, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 1757, y_origin = -1621, x_size = 0, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ []
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 1757, y_origin = -1121, x_size = 0, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 1757, y_origin = -1121, x_size = 0, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ []
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 3
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 73, cluster = 14, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 386, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 82, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 88, cluster = 16, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 574, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 85, cluster = 17, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 386, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 4
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1690, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1690, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 428, cluster = 19, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 643, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 89, cluster = 21, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 488, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 72, cluster = 22, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 559, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ ]
+ }
A .golden/richParagraphLayout/offsetMiddleUpOuterTextWrap.golden => .golden/richParagraphLayout/offsetMiddleUpOuterTextWrap.golden +91 -0
@@ 0,0 1,91 @@
+ParagraphLayout
+ { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 1936, y_size = -4984}
+ , paragraphLines =
+ [ Line {lineNumber = 1, lineRect = Rect {x_origin = 0, y_origin = 0, x_size = 1936, y_size = -1121}}
+ , Line {lineNumber = 2, lineRect = Rect {x_origin = 0, y_origin = -1121, x_size = 1936, y_size = -1621}}
+ , Line {lineNumber = 3, lineRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}}
+ , Line {lineNumber = 4, lineRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1936, y_size = -1121}}
+ ]
+ , paragraphFragments =
+ [ Fragment
+ { fragmentUserData = "outer start"
+ , fragmentLine = 1
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = 0, x_size = 1723, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 1723, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 82, cluster = 5, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 81, cluster = 6, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 574, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 72, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 559, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "outer start"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -1621, x_size = 1757, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -1621, x_size = 1757, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 87, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 402, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 90, cluster = 10, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 765, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 82, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "inner"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ [ AncestorBox {boxUserData = "box", boxLeftEdge = SpacedEdge 0, boxRightEdge = SpacedEdge 0, boxStartEdge = SpacedEdge 0, boxEndEdge = SpacedEdge 0}
+ ]
+ , fragmentContentRect = Rect {x_origin = 1757, y_origin = -1121, x_size = 0, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 1757, y_origin = -1121, x_size = 0, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ []
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 2
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 1757, y_origin = -1621, x_size = 0, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 1757, y_origin = -1621, x_size = 0, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ []
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 3
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -2742, x_size = 1936, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 73, cluster = 14, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 386, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 82, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 590, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 88, cluster = 16, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 574, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 85, cluster = 17, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 386, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ , Fragment
+ { fragmentUserData = "outer end"
+ , fragmentLine = 4
+ , fragmentAncestorBoxes =
+ []
+ , fragmentContentRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1690, y_size = -1121}
+ , fragmentRect = Rect {x_origin = 0, y_origin = -3863, x_size = 1690, y_size = -1121}
+ , fragmentPen = (0, -932)
+ , fragmentGlyphs =
+ [ (GlyphInfo {codepoint = 428, cluster = 19, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 643, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 89, cluster = 21, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 488, y_advance = 0, x_offset = 0, y_offset = 0})
+ , (GlyphInfo {codepoint = 72, cluster = 22, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 559, y_advance = 0, x_offset = 0, y_offset = 0})
+ ]
+ }
+ ]
+ }
M test/Data/Text/ParagraphLayout/RichSpec.hs => test/Data/Text/ParagraphLayout/RichSpec.hs +13 -1
@@ 174,13 174,15 @@ spec = do
result `shouldBeGolden` "mixedLineHeightBaseline3"
describe "offset middle baseline" $ do
- -- TODO: also test interaction with line wrapping
-- TODO: also test struts for inline boxes with children
-- FIXME: prevent vertical trimming of paragraphs
let opts = defaultParagraphOptions
{ paragraphAlignment = AlignStart
, paragraphMaxWidth = largeWidth
}
+ let wrap = opts
+ { paragraphMaxWidth = 3000
+ }
it "root strut extends line downwards" $ do
let input = offsetMiddleInnerTextParagraph 500 font opts
@@ 202,6 204,16 @@ spec = do
let result = layoutRich input
result `shouldBeGolden` "offsetMiddleDownOuterText"
+ it "inline box strut extends one wrapped line upwards" $ do
+ let input = offsetMiddleOuterTextParagraph 500 font wrap
+ let result = layoutRich input
+ result `shouldBeGolden` "offsetMiddleUpOuterTextWrap"
+
+ it "inline box strut extends one wrapped line downwards" $ do
+ let input = offsetMiddleOuterTextParagraph (-500) font wrap
+ let result = layoutRich input
+ result `shouldBeGolden` "offsetMiddleDownOuterTextWrap"
+
it "handles mixed sizes" $ do
let opts = defaultParagraphOptions
{ paragraphAlignment = AlignStart