From 0926c4900b6354fe961f039b8a320d45efc43cde Mon Sep 17 00:00:00 2001 From: Jaro Date: Thu, 15 Jun 2023 22:34:35 +0200 Subject: [PATCH] Test with AlignStart by default. --- .../hardBoxBreakRTL.golden | 10 +-- .../mixedDirectionComplexRTL.golden | 16 ++-- .../mixedDirectionSimpleRTL.golden | 8 +- .../neutralDirectionRTL.golden | 4 +- .../newline1Paragraph.golden | 4 +- .../newline1TextParagraph.golden | 6 +- .../newline2Paragraph.golden | 6 +- .../newline2TextParagraph.golden | 8 +- .golden/shapedRuns/intraWordBreak.golden | 4 +- .../mixedDirectionComplexRTL.golden | 45 ++++++----- test/Data/Text/ParagraphLayout/RichSpec.hs | 81 +++++++++++++++++-- 11 files changed, 132 insertions(+), 60 deletions(-) diff --git a/.golden/richParagraphLayout/hardBoxBreakRTL.golden b/.golden/richParagraphLayout/hardBoxBreakRTL.golden index ecc4181..81b9684 100644 --- a/.golden/richParagraphLayout/hardBoxBreakRTL.golden +++ b/.golden/richParagraphLayout/hardBoxBreakRTL.golden @@ -1,5 +1,5 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 3455, y_size = -3000} + { paragraphRect = Rect {x_origin = 999996545, y_origin = 0, x_size = 3455, y_size = -3000} , paragraphFragments = [ Fragment { fragmentUserData = "text2" @@ -8,7 +8,7 @@ ParagraphLayout [ AncestorBox {boxUserData = "box2", boxLeftEdge = NoEdge, boxRightEdge = SpacedEdge 200, boxStartEdge = SpacedEdge 200, boxEndEdge = NoEdge} , AncestorBox {boxUserData = "box1", boxLeftEdge = NoEdge, boxRightEdge = SpacedEdge 100, boxStartEdge = SpacedEdge 100, boxEndEdge = NoEdge} ] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 1632, y_size = -1500} + , fragmentRect = Rect {x_origin = 999996545, y_origin = 0, x_size = 1632, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 512, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 839, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -22,7 +22,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 1932, y_origin = 0, x_size = 1523, y_size = -1500} + , fragmentRect = Rect {x_origin = 999998477, y_origin = 0, x_size = 1523, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 389, cluster = 16, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -38,7 +38,7 @@ ParagraphLayout , fragmentLine = 2 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = -1500, x_size = 2155, y_size = -1500} + , fragmentRect = Rect {x_origin = 999996645, y_origin = -1500, x_size = 2155, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 512, cluster = 45, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 839, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -56,7 +56,7 @@ ParagraphLayout [ AncestorBox {boxUserData = "box2", boxLeftEdge = SpacedEdge 150, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = SpacedEdge 150} , AncestorBox {boxUserData = "box1", boxLeftEdge = SpacedEdge 50, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = SpacedEdge 50} ] - , fragmentRect = Rect {x_origin = 2355, y_origin = -1500, x_size = 1000, y_size = -1500} + , fragmentRect = Rect {x_origin = 999999000, y_origin = -1500, x_size = 1000, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 389, cluster = 33, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/richParagraphLayout/mixedDirectionComplexRTL.golden b/.golden/richParagraphLayout/mixedDirectionComplexRTL.golden index bc84734..895e37d 100644 --- a/.golden/richParagraphLayout/mixedDirectionComplexRTL.golden +++ b/.golden/richParagraphLayout/mixedDirectionComplexRTL.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 24557, y_size = -1500} + { paragraphRect = Rect {x_origin = 999975443, y_origin = 0, x_size = 24557, y_size = -1500} , paragraphFragments = [ Fragment { fragmentUserData = "text3" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 6501, y_size = -1500} + , fragmentRect = Rect {x_origin = 999975443, y_origin = 0, x_size = 6501, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 147, cluster = 83, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 600, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -35,7 +35,7 @@ ParagraphLayout , fragmentAncestorBoxes = [ AncestorBox {boxUserData = "box1", boxLeftEdge = SpacedEdge 0, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = SpacedEdge 0} ] - , fragmentRect = Rect {x_origin = 6501, y_origin = 0, x_size = 1580, y_size = -1500} + , fragmentRect = Rect {x_origin = 999981944, y_origin = 0, x_size = 1580, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 3, cluster = 61, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 236, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -51,7 +51,7 @@ ParagraphLayout , fragmentAncestorBoxes = [ AncestorBox {boxUserData = "box1", boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge} ] - , fragmentRect = Rect {x_origin = 8081, y_origin = 0, x_size = 3418, y_size = -1500} + , fragmentRect = Rect {x_origin = 999983524, y_origin = 0, x_size = 3418, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 26, cluster = 48, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 351, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -71,7 +71,7 @@ ParagraphLayout , fragmentAncestorBoxes = [ AncestorBox {boxUserData = "box1", boxLeftEdge = NoEdge, boxRightEdge = SpacedEdge 0, boxStartEdge = SpacedEdge 0, boxEndEdge = NoEdge} ] - , fragmentRect = Rect {x_origin = 11499, y_origin = 0, x_size = 6326, y_size = -1500} + , fragmentRect = Rect {x_origin = 999986942, y_origin = 0, x_size = 6326, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 3, cluster = 47, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 236, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -100,7 +100,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 17825, y_origin = 0, x_size = 1580, y_size = -1500} + , fragmentRect = Rect {x_origin = 999993268, y_origin = 0, x_size = 1580, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 3, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 236, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -115,7 +115,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 19405, y_origin = 0, x_size = 3808, y_size = -1500} + , fragmentRect = Rect {x_origin = 999994848, y_origin = 0, x_size = 3808, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 4, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 534, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -134,7 +134,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 23213, y_origin = 0, x_size = 1344, y_size = -1500} + , fragmentRect = Rect {x_origin = 999998656, y_origin = 0, x_size = 1344, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 3, cluster = 10, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 236, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/richParagraphLayout/mixedDirectionSimpleRTL.golden b/.golden/richParagraphLayout/mixedDirectionSimpleRTL.golden index 5c8ec4f..50a5852 100644 --- a/.golden/richParagraphLayout/mixedDirectionSimpleRTL.golden +++ b/.golden/richParagraphLayout/mixedDirectionSimpleRTL.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 7954, y_size = -1500} + { paragraphRect = Rect {x_origin = 999992046, y_origin = 0, x_size = 7954, y_size = -1500} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 2979, y_size = -1500} + , fragmentRect = Rect {x_origin = 999992046, y_origin = 0, x_size = 2979, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 17, cluster = 13, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 517, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -22,7 +22,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 2979, y_origin = 0, x_size = 1578, y_size = -1500} + , fragmentRect = Rect {x_origin = 999995025, y_origin = 0, x_size = 1578, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 1143, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 1095, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -34,7 +34,7 @@ ParagraphLayout , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 4557, y_origin = 0, x_size = 3397, y_size = -1500} + , fragmentRect = Rect {x_origin = 999996603, y_origin = 0, x_size = 3397, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 6, cluster = 0, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 580, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/richParagraphLayout/neutralDirectionRTL.golden b/.golden/richParagraphLayout/neutralDirectionRTL.golden index 5fe8599..41f3a51 100644 --- a/.golden/richParagraphLayout/neutralDirectionRTL.golden +++ b/.golden/richParagraphLayout/neutralDirectionRTL.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 2003, y_size = -1500} + { paragraphRect = Rect {x_origin = 999997997, y_origin = 0, x_size = 2003, y_size = -1500} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 2003, y_size = -1500} + , fragmentRect = Rect {x_origin = 999997997, y_origin = 0, x_size = 2003, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 147, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 600, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/richParagraphLayout/newline1Paragraph.golden b/.golden/richParagraphLayout/newline1Paragraph.golden index e860988..0ce5142 100644 --- a/.golden/richParagraphLayout/newline1Paragraph.golden +++ b/.golden/richParagraphLayout/newline1Paragraph.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1500} + { paragraphRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -1500} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] diff --git a/.golden/richParagraphLayout/newline1TextParagraph.golden b/.golden/richParagraphLayout/newline1TextParagraph.golden index ad9437b..df05057 100644 --- a/.golden/richParagraphLayout/newline1TextParagraph.golden +++ b/.golden/richParagraphLayout/newline1TextParagraph.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 351, y_size = -3000} + { paragraphRect = Rect {x_origin = 999999649, y_origin = 0, x_size = 351, y_size = -3000} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] @@ -16,7 +16,7 @@ ParagraphLayout , fragmentLine = 2 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = -1500, x_size = 351, y_size = -1500} + , fragmentRect = Rect {x_origin = 999999649, y_origin = -1500, x_size = 351, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 26, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 351, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/richParagraphLayout/newline2Paragraph.golden b/.golden/richParagraphLayout/newline2Paragraph.golden index d506371..4826757 100644 --- a/.golden/richParagraphLayout/newline2Paragraph.golden +++ b/.golden/richParagraphLayout/newline2Paragraph.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -3000} + { paragraphRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -3000} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] @@ -16,7 +16,7 @@ ParagraphLayout , fragmentLine = 2 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = -1500, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = -1500, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] diff --git a/.golden/richParagraphLayout/newline2TextParagraph.golden b/.golden/richParagraphLayout/newline2TextParagraph.golden index 3776a88..b7a9962 100644 --- a/.golden/richParagraphLayout/newline2TextParagraph.golden +++ b/.golden/richParagraphLayout/newline2TextParagraph.golden @@ -1,12 +1,12 @@ ParagraphLayout - { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 351, y_size = -4500} + { paragraphRect = Rect {x_origin = 999999649, y_origin = 0, x_size = 351, y_size = -4500} , paragraphFragments = [ Fragment { fragmentUserData = "text" , fragmentLine = 1 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = 0, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] @@ -16,7 +16,7 @@ ParagraphLayout , fragmentLine = 2 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = -1500, x_size = 0, y_size = -1500} + , fragmentRect = Rect {x_origin = 1000000000, y_origin = -1500, x_size = 0, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [] @@ -26,7 +26,7 @@ ParagraphLayout , fragmentLine = 3 , fragmentAncestorBoxes = [] - , fragmentRect = Rect {x_origin = 0, y_origin = -3000, x_size = 351, y_size = -1500} + , fragmentRect = Rect {x_origin = 999999649, y_origin = -3000, x_size = 351, y_size = -1500} , fragmentPen = (0, -1085) , fragmentGlyphs = [ (GlyphInfo {codepoint = 26, cluster = 8, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 351, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/shapedRuns/intraWordBreak.golden b/.golden/shapedRuns/intraWordBreak.golden index 7221496..5819ba6 100644 --- a/.golden/shapedRuns/intraWordBreak.golden +++ b/.golden/shapedRuns/intraWordBreak.golden @@ -1,4 +1,4 @@ -[ (0, -35, +[ (3, -35, [ (GlyphInfo {codepoint = 373, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 24, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 971, cluster = 13, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 14, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 407, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -8,7 +8,7 @@ , (GlyphInfo {codepoint = 971, cluster = 2, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 14, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 407, cluster = 0, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (0, -83, +, (18, -83, [ (GlyphInfo {codepoint = 1363, cluster = 28, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 31, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 373, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 24, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 971, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 14, y_advance = 0, x_offset = 0, y_offset = 0}) diff --git a/.golden/shapedRuns/mixedDirectionComplexRTL.golden b/.golden/shapedRuns/mixedDirectionComplexRTL.golden index c91b5e1..fcb9439 100644 --- a/.golden/shapedRuns/mixedDirectionComplexRTL.golden +++ b/.golden/shapedRuns/mixedDirectionComplexRTL.golden @@ -1,31 +1,17 @@ -[ (0, -35, - [ (GlyphInfo {codepoint = 147, cluster = 83, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 82, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 90, cluster = 81, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 80, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 517, cluster = 78, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 27, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 955, cluster = 76, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 15, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 75, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 147, cluster = 74, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 73, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 90, cluster = 72, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 71, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 971, cluster = 69, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 14, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 394, cluster = 67, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 3, cluster = 66, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) - , (GlyphInfo {codepoint = 147, cluster = 65, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) +[ (7, -35, + [ (GlyphInfo {codepoint = 147, cluster = 65, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 64, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 90, cluster = 63, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 62, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (212, -35, +, (51, -35, [ (GlyphInfo {codepoint = 3, cluster = 61, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 147, cluster = 60, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 59, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 90, cluster = 58, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 57, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (264, -35, +, (103, -35, [ (GlyphInfo {codepoint = 26, cluster = 48, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 11, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 27, cluster = 49, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 18, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 50, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -36,7 +22,7 @@ , (GlyphInfo {codepoint = 27, cluster = 55, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 18, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 26, cluster = 56, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 11, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (374, -35, +, (213, -35, [ (GlyphInfo {codepoint = 3, cluster = 47, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 147, cluster = 46, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 45, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -57,14 +43,14 @@ , (GlyphInfo {codepoint = 90, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 25, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (581, -35, +, (420, -35, [ (GlyphInfo {codepoint = 3, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 147, cluster = 23, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 22, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 90, cluster = 21, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 20, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (633, -35, +, (472, -35, [ (GlyphInfo {codepoint = 4, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 17, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 6, cluster = 12, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 13, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) @@ -75,10 +61,25 @@ , (GlyphInfo {codepoint = 6, cluster = 18, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 4, cluster = 19, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 17, y_advance = 0, x_offset = 0, y_offset = 0}) ]) -, (757, -35, +, (596, -35, [ (GlyphInfo {codepoint = 3, cluster = 10, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 147, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 3, cluster = 8, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) , (GlyphInfo {codepoint = 90, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) ]) +, (480, -83, + [ (GlyphInfo {codepoint = 147, cluster = 83, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 3, cluster = 82, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 90, cluster = 81, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 3, cluster = 80, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 517, cluster = 78, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 27, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 955, cluster = 76, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 15, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 3, cluster = 75, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 147, cluster = 74, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 19, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 3, cluster = 73, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 90, cluster = 72, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 9, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 3, cluster = 71, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 971, cluster = 69, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 14, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 394, cluster = 67, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 8, y_advance = 0, x_offset = 0, y_offset = 0}) + ]) ] \ No newline at end of file diff --git a/test/Data/Text/ParagraphLayout/RichSpec.hs b/test/Data/Text/ParagraphLayout/RichSpec.hs index 4d6c3fe..0048a8e 100644 --- a/test/Data/Text/ParagraphLayout/RichSpec.hs +++ b/test/Data/Text/ParagraphLayout/RichSpec.hs @@ -23,6 +23,11 @@ fragmentRects p = map toItem $ paragraphFragments p glyphRuns :: ParagraphLayout d -> [[Word32]] glyphRuns = map (map (codepoint . fst) . fragmentGlyphs) . paragraphFragments +-- | A sufficiently large number to prevent line breaking, +-- while being round so that coordinates in test results are easy to read. +largeWidth :: Int32 +largeWidth = 1000000000 + spec :: Spec spec = do @@ -64,6 +69,9 @@ spec = do it "handles mixed line height" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let lineHeights = (800, 1300, 1700) let input = mixedLineHeightParagraph lineHeights font opts let result = layoutRich input @@ -71,30 +79,45 @@ spec = do it "handles mixed sizes" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedSizesParagraph (font, fontSmall) opts let result = layoutRich input result `shouldBeGolden` "mixedSizes" it "handles mixed script" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedScriptParagraph font opts let result = layoutRich input result `shouldBeGolden` "mixedScript" it "handles mixed script with line wraps" $ do - let opts = defaultParagraphOptions { paragraphMaxWidth = 5000 } + let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = 5000 + } let input = mixedScriptParagraph font opts let result = layoutRich input result `shouldBeGolden` "mixedScriptWrap" it "handles nested boxes" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = nestedBoxesParagraph font opts let result = layoutRich input result `shouldBeGolden` "nestedBoxes" it "handles hard break in LTR boxes" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = hardBoxBreakLTRParagraph font opts let result = layoutRich input result `shouldBeGolden` "hardBoxBreakLTR" @@ -111,7 +134,10 @@ spec = do originX + (sum $ take (n - 1) wordAdvancesWithSpace) let endX = originX + (sum wordAdvancesWithSpace) -- A paragraph exactly wide enough to fit the whole text. - let opts = defaultParagraphOptions { paragraphMaxWidth = endX } + let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = endX + } -- Small spacing that should push one word onto the next line. let s = 5 -- Large spacing that should push two words onto the next line. @@ -150,72 +176,108 @@ spec = do it "makes space for one newline" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = newline1Paragraph font opts let result = layoutRich input result `shouldBeGolden` "newline1Paragraph" it "makes space for one newline plus text" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = newline1TextParagraph font opts let result = layoutRich input result `shouldBeGolden` "newline1TextParagraph" it "makes space for two newlines" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = newline2Paragraph font opts let result = layoutRich input result `shouldBeGolden` "newline2Paragraph" it "makes space for two newlines plus text" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = newline2TextParagraph font opts let result = layoutRich input result `shouldBeGolden` "newline2TextParagraph" it "handles hard break in RTL boxes" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = hardBoxBreakRTLParagraph font opts let result = layoutRich input result `shouldBeGolden` "hardBoxBreakRTL" it "handles neutral characters in RTL paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = neutralDirectionParagraph DirRTL font opts let result = layoutRich input result `shouldBeGolden` "neutralDirectionRTL" it "handles neutral characters in LTR paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = neutralDirectionParagraph DirLTR font opts let result = layoutRich input result `shouldBeGolden` "neutralDirectionLTR" it "handles simple mixed direction in RTL paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedDirectionSimpleParagraph DirRTL font opts let result = layoutRich input result `shouldBeGolden` "mixedDirectionSimpleRTL" it "handles simple mixed direction in LTR paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedDirectionSimpleParagraph DirLTR font opts let result = layoutRich input result `shouldBeGolden` "mixedDirectionSimpleLTR" it "handles complex mixed direction in RTL paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedDirectionComplexParagraph DirRTL font opts let result = layoutRich input result `shouldBeGolden` "mixedDirectionComplexRTL" it "handles complex mixed direction in LTR paragraph" $ do let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = largeWidth + } let input = mixedDirectionComplexParagraph DirLTR font opts let result = layoutRich input result `shouldBeGolden` "mixedDirectionComplexLTR" it "preserves joining forms across soft breaks" $ do - let opts = defaultParagraphOptions { paragraphMaxWidth = 4500 } + let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = 4500 + } let input = intraWordBreakParagraph font opts let glyphRunsVisual = glyphRuns $ layoutRich input let glyphRunsLogical = map reverse glyphRunsVisual @@ -244,7 +306,10 @@ spec = do font <- runIO $ loadFont latinFont 0 testingOptions it "wraps lorem ipsum at 20em" $ do - let opts = defaultParagraphOptions { paragraphMaxWidth = 20000 } + let opts = defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = 20000 + } let input = loremIpsumParagraph font opts let pl = layoutRich input let popts = PageOptions @@ -280,10 +345,16 @@ spec = do layoutRich $ mixedDirectionComplexParagraph DirRTL font $ defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = 640 + } shapedRunsSpec "preserves joining forms across soft breaks" "intraWordBreak" $ layoutRich $ intraWordBreakParagraph font $ - defaultParagraphOptions { paragraphMaxWidth = 144 } + defaultParagraphOptions + { paragraphAlignment = AlignStart + , paragraphMaxWidth = 144 + } -- 2.30.2