From 2d06bc9a995587a140a440f89cb37923fcb7f46a Mon Sep 17 00:00:00 2001 From: Jaro Date: Thu, 11 May 2023 07:42:46 +0200 Subject: [PATCH] Test interaction between boxes and mixed script. --- .../richParagraphLayout/mixedScript.golden | 127 +++++++++++++++ .../mixedScriptWrap.golden | 149 ++++++++++++++++++ .../ParagraphLayout/Rich/ParagraphData.hs | 26 +++ test/Data/Text/ParagraphLayout/RichSpec.hs | 12 ++ 4 files changed, 314 insertions(+) create mode 100644 .golden/richParagraphLayout/mixedScript.golden create mode 100644 .golden/richParagraphLayout/mixedScriptWrap.golden diff --git a/.golden/richParagraphLayout/mixedScript.golden b/.golden/richParagraphLayout/mixedScript.golden new file mode 100644 index 0000000..337456d --- /dev/null +++ b/.golden/richParagraphLayout/mixedScript.golden @@ -0,0 +1,127 @@ +ParagraphLayout + { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 15283, y_size = -1121} + , paragraphFragments = + [ Fragment + { fragmentUserData = "text1" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 6, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 8, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text1" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 777, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 13, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text2" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box1", boxLeftSpacing = Just 50, boxRightSpacing = Nothing, boxStartSpacing = Just 50, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 3162, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 16, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 17, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text2" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box1", boxLeftSpacing = Nothing, boxRightSpacing = Just 100, boxStartSpacing = Nothing, boxEndSpacing = Just 100} + ] + , fragmentRect = Rect {x_origin = 3939, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 18, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 20, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 22, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text3" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 6374, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 28, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Just 150, boxRightSpacing = Nothing, boxStartSpacing = Just 150, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 8859, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 30, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 32, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 34, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Nothing, boxRightSpacing = Nothing, boxStartSpacing = Nothing, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 11194, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 36, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 37, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 38, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Nothing, boxRightSpacing = Just 200, boxStartSpacing = Nothing, boxEndSpacing = Just 200} + ] + , fragmentRect = Rect {x_origin = 11971, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 39, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 41, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 43, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text5" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 14506, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 45, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 46, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 47, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + ] + } diff --git a/.golden/richParagraphLayout/mixedScriptWrap.golden b/.golden/richParagraphLayout/mixedScriptWrap.golden new file mode 100644 index 0000000..8557fe7 --- /dev/null +++ b/.golden/richParagraphLayout/mixedScriptWrap.golden @@ -0,0 +1,149 @@ +ParagraphLayout + { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 4897, y_size = -4484} + , paragraphFragments = + [ Fragment + { fragmentUserData = "text1" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 6, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 8, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text1" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 777, y_origin = 0, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 11, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 13, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text2" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box1", boxLeftSpacing = Just 50, boxRightSpacing = Nothing, boxStartSpacing = Just 50, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 3162, y_origin = 0, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 16, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 17, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text2" + , fragmentLine = 1 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box1", boxLeftSpacing = Nothing, boxRightSpacing = Nothing, boxStartSpacing = Nothing, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 3939, y_origin = 0, x_size = 763, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 18, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text2" + , fragmentLine = 2 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box1", boxLeftSpacing = Nothing, boxRightSpacing = Just 100, boxStartSpacing = Nothing, boxEndSpacing = Just 100} + ] + , fragmentRect = Rect {x_origin = 0, y_origin = -1121, x_size = 1549, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 20, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 22, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text3" + , fragmentLine = 2 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 1649, y_origin = -1121, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 24, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 28, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 2 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Just 150, boxRightSpacing = Nothing, boxStartSpacing = Just 150, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 4134, y_origin = -1121, x_size = 763, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 30, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 3 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Nothing, boxRightSpacing = Nothing, boxStartSpacing = Nothing, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 0, y_origin = -2242, x_size = 1549, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 32, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 34, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 3 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Nothing, boxRightSpacing = Nothing, boxStartSpacing = Nothing, boxEndSpacing = Nothing} + ] + , fragmentRect = Rect {x_origin = 1549, y_origin = -2242, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 36, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 37, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 38, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text4" + , fragmentLine = 3 + , fragmentAncestorBoxes = + [ AncestorBox {boxUserData = "box2", boxLeftSpacing = Nothing, boxRightSpacing = Just 200, boxStartSpacing = Nothing, boxEndSpacing = Just 200} + ] + , fragmentRect = Rect {x_origin = 2326, y_origin = -2242, x_size = 2335, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 758, cluster = 39, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 41, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 786, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 758, cluster = 43, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 763, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + , Fragment + { fragmentUserData = "text5" + , fragmentLine = 4 + , fragmentAncestorBoxes = + [] + , fragmentRect = Rect {x_origin = 0, y_origin = -3363, x_size = 777, y_size = -1121} + , fragmentPen = (0, -932) + , fragmentGlyphs = + [ (GlyphInfo {codepoint = 77, cluster = 45, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 46, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 262, y_advance = 0, x_offset = 0, y_offset = 0}) + , (GlyphInfo {codepoint = 77, cluster = 47, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 253, y_advance = 0, x_offset = 0, y_offset = 0}) + ] + } + ] + } diff --git a/test/Data/Text/ParagraphLayout/Rich/ParagraphData.hs b/test/Data/Text/ParagraphLayout/Rich/ParagraphData.hs index 2886877..21ada2b 100644 --- a/test/Data/Text/ParagraphLayout/Rich/ParagraphData.hs +++ b/test/Data/Text/ParagraphLayout/Rich/ParagraphData.hs @@ -2,6 +2,7 @@ module Data.Text.ParagraphLayout.Rich.ParagraphData ( hardBoxBreakLTRParagraph , hardBoxBreakRTLParagraph , loremIpsumParagraph + , mixedScriptParagraph , mixedSizesParagraph , nestedBoxesParagraph , softBreakParagraph @@ -87,6 +88,31 @@ loremIpsumParagraph font = constructParagraph where t = tLTR { textFont = font, textLanguage = "zxx" } +mixedScriptParagraph :: Font -> ParagraphOptions -> Paragraph String +mixedScriptParagraph font = constructParagraph + (pack "prefix") + (rootBox t + [ text "text1" "jjjжжж" + -- Box starting on script boundary: + , box "box1" b1 t + -- Box continuing over script boundary: + [ text "text2" "jjjжжж" ] + -- Box ending outside script boundary: + , text "text3" "жжж" + -- Box starting outside script boundary: + , box "box2" b2 t + -- Box continuing over two script boundaries: + [ text "text4" "жжжjjjжжж" ] + -- Box ending on script boundary: + , text "text5" "jjj" + ] + ) + (pack "suffix") + where + b1 = b_ { boxSpacing = BoxSpacingLeftRight 50 100 } + b2 = b_ { boxSpacing = BoxSpacingLeftRight 150 200 } + t = tLTR { textFont = font, textLanguage = "zxx" } + mixedSizesParagraph :: (Font, Font) -> ParagraphOptions -> Paragraph String mixedSizesParagraph (bigFont, smallFont) = constructParagraph (pack "prefix") diff --git a/test/Data/Text/ParagraphLayout/RichSpec.hs b/test/Data/Text/ParagraphLayout/RichSpec.hs index c76ec89..d73c617 100644 --- a/test/Data/Text/ParagraphLayout/RichSpec.hs +++ b/test/Data/Text/ParagraphLayout/RichSpec.hs @@ -41,6 +41,18 @@ spec = do let result = layoutRich input result `shouldBeGolden` "mixedSizes" + it "handles mixed script" $ do + let opts = defaultParagraphOptions + 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 input = mixedScriptParagraph font opts + let result = layoutRich input + result `shouldBeGolden` "mixedScriptWrap" + it "handles nested boxes" $ do let opts = defaultParagraphOptions let input = nestedBoxesParagraph font opts -- 2.30.2