~jaro/balkon

ref: b27f00d9649dd8faafc91a2333818af233ea0b98 balkon/test/Data/Text/ParagraphLayout/ParagraphData.hs -rw-r--r-- 1.6 KiB
b27f00d9Jaro Implement "plain" interface. 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module Data.Text.ParagraphLayout.ParagraphData
    (czechHelloParagraph
    ,emptyParagraph
    ,emptySpanParagraph
    ,mixedLanguageLTRParagraph
    ,mixedScriptSerbianParagraph
    )
where

import Data.Text (pack)
import Data.Text.Internal (Text(Text))
import Data.Text.ParagraphLayout.Plain
    (Paragraph(Paragraph)
    ,ParagraphOptions
    ,Span(Span)
    )

emptyParagraph :: ParagraphOptions -> Paragraph
emptyParagraph opts =
    let (Text arr off _) = pack ""
    in Paragraph
        arr
        (fromIntegral off)
        []
        opts

emptySpanParagraph :: ParagraphOptions -> Paragraph
emptySpanParagraph opts =
    let (Text arr off _) = pack ""
    in Paragraph
        arr
        (fromIntegral off)
        [Span 0 "en"]
        opts

czechHelloParagraph :: ParagraphOptions -> Paragraph
czechHelloParagraph opts =
    let (Text arr off len) = pack "Ahoj, světe!"
    in Paragraph
        arr
        (fromIntegral off)
        [Span (fromIntegral len) "cs"]
        opts

mixedScriptSerbianParagraph :: ParagraphOptions -> Paragraph
mixedScriptSerbianParagraph opts =
    let (Text arr off len) = pack "Vikipedija (Википедија)"
    in Paragraph
        arr
        (fromIntegral off)
        [Span (fromIntegral len) "sr"]
        opts

mixedLanguageLTRParagraph :: ParagraphOptions -> Paragraph
mixedLanguageLTRParagraph opts =
    let (Text arr off _) = pack "Tak jsem tady, 世界!"
    in Paragraph
        arr
        (fromIntegral off + 4)
        [Span 11 "cs" -- this will contain the text "jsem tady, "
        ,Span 7 "ja" -- this will contain the text "世界!"
        ]
        opts