~jaro/balkon

62b95c9e616030c3a1bdfe158634b2d6ee9fc4a9 — Jaro 1 year, 6 months ago a970299
Test ultra narrow Arabic text.
A .golden/paragraphLayout/arabicHelloParagraphUltraNarrow.golden => .golden/paragraphLayout/arabicHelloParagraphUltraNarrow.golden +170 -0
@@ 0,0 1,170 @@
ParagraphLayout
    { paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 827, y_size = -19500}
    , spanLayouts = [
        SpanLayout
        [ Fragment
            { fragmentUserData = ()
            , fragmentLine = 1
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = SpacedEdge 0, boxStartEdge = SpacedEdge 0, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 224, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 302, cluster = 5, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 224, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 2
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -1500, x_size = 269, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 477, cluster = 7, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 269, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 3
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -3000, x_size = 827, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1665, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 303, y_offset = -40})
                , (GlyphInfo {codepoint = 359, cluster = 9, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 827, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 4
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -4500, x_size = 314, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1588, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 26, y_offset = 451})
                , (GlyphInfo {codepoint = 381, cluster = 15, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 314, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 5
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -6000, x_size = 270, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 293, cluster = 19, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 270, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 6
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -7500, x_size = 555, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1641, cluster = 21, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 185, y_offset = 120})
                , (GlyphInfo {codepoint = 906, cluster = 21, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 555, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 7
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -9000, x_size = 479, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1588, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 99, y_offset = 170})
                , (GlyphInfo {codepoint = 770, cluster = 26, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 479, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 8
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -10500, x_size = 314, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1588, cluster = 30, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 26, y_offset = 451})
                , (GlyphInfo {codepoint = 381, cluster = 30, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 314, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 9
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -12000, x_size = 310, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1563, cluster = 34, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 42, y_offset = 40})
                , (GlyphInfo {codepoint = 336, cluster = 34, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 310, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 10
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -13500, x_size = 452, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1641, cluster = 38, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 4, y_offset = 379})
                , (GlyphInfo {codepoint = 840, cluster = 38, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 452, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 11
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -15000, x_size = 524, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 1588, cluster = 42, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 0, y_advance = 0, x_offset = 131, y_offset = 80})
                , (GlyphInfo {codepoint = 916, cluster = 42, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 524, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 12
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = NoEdge, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = NoEdge}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -16500, x_size = 270, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 293, cluster = 46, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 270, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        , Fragment
            { fragmentUserData = ()
            , fragmentLine = 13
            , fragmentAncestorBoxes =
                [ AncestorBox {boxUserData = (), boxLeftEdge = SpacedEdge 0, boxRightEdge = NoEdge, boxStartEdge = NoEdge, boxEndEdge = SpacedEdge 0}
                ]
            , fragmentRect = Rect {x_origin = 0, y_origin = -18000, x_size = 284, y_size = -1500}
            , fragmentPen = (0, -1085)
            , fragmentGlyphs =
                [ (GlyphInfo {codepoint = 108, cluster = 48, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False}, GlyphPos {x_advance = 284, y_advance = 0, x_offset = 0, y_offset = 0})
                ]
            }
        ]
    ]}

M test/Data/Text/ParagraphLayout/Plain/ParagraphData.hs => test/Data/Text/ParagraphLayout/Plain/ParagraphData.hs +10 -0
@@ 1,6 1,7 @@
{-# OPTIONS_GHC -fno-warn-deprecations #-}
module Data.Text.ParagraphLayout.Plain.ParagraphData
    ( arabicFillerParagraph
    , arabicHelloParagraph
    , czechHelloParagraph
    , devanagariAccentParagraph
    , devanagariParagraph


@@ 29,6 30,10 @@ import Data.Text.ParagraphLayout.Plain
    )
import Data.Text.ParagraphLayout.ParagraphConstruction

-- | Span with text in the Arabic language.
ar :: String -> (SpanOptions, String)
ar = (,) defaultSpanOptions { spanLanguage = "ar" }

-- | Span with text in the Czech language.
cs :: String -> (SpanOptions, String)
cs = (,) defaultSpanOptions { spanLanguage = "cs" }


@@ 80,6 85,11 @@ loremIpsumParagraph = "xxxx" |< zxx "Lorem ipsum dolor sit amet, consectetur adi
spannedLoremIpsumParagraph :: ParagraphOptions -> Paragraph ()
spannedLoremIpsumParagraph = "xxxx" |< zxx "Lorem ipsum dolor " >|< zxx "sit amet, consectetur" >|< zxx " adipiscing elit, sed " >|< zxx "do eiusmod tempor" >|< zxx " incididunt ut labore " >|< zxx "et dolore magna" >|< zxx " aliqua. Ut enim " >|< zxx "ad minim veniam," >|< zxx " quis nostrud exercitation " >|< zxx "ullamco laboris nisi" >|< zxx " ut aliquip ex " >|< zxx "ea commodo consequat." >|< zxx " Duis aute irure " >|< zxx "dolor in reprehenderit" >|< zxx " in voluptate velit " >|< zxx "esse cillum dolore" >|< zxx " eu fugiat nulla " >|< zxx "pariatur. Excepteur" >|< zxx " sint occaecat cupidatat " >|< zxx "non proident, sunt" >|< zxx " in culpa qui " >|< zxx "officia deserunt mollit" >|< zxx " anim id est " >|< zxx "laborum." >| "z"

-- | Source:
-- <https://en.wikipedia.org/w/index.php?title=As-salamu_alaykum&oldid=1158575357>
arabicHelloParagraph :: ParagraphOptions -> Paragraph ()
arabicHelloParagraph = "xxxxx" |< ar "ٱلسَّلَامُ عَلَيْكُمَا!" >| "zz"

czechHelloParagraph :: ParagraphOptions -> Paragraph ()
czechHelloParagraph = "xxxxx" |< cs "Ahoj, světe!" >| "zz"


M test/Data/Text/ParagraphLayout/PlainSpec.hs => test/Data/Text/ParagraphLayout/PlainSpec.hs +5 -0
@@ 36,6 36,11 @@ spec = do
                let result = layoutPlain $ emptyParagraph opts
                result `shouldBe` emptyLayout

            it "wraps by characters when line is ultra narrow" $ do
                let opts = opts_ { paragraphMaxWidth = 100 }
                let result = layoutPlain $ arabicHelloParagraph opts
                result `shouldBeGolden` "arabicHelloParagraphUltraNarrow"

            it "wraps filler text at 20em" $ do
                let opts = opts_ { paragraphMaxWidth = 20000 }
                let result = layoutPlain $ arabicFillerParagraph opts