~jaro/balkon

ref: 882969e0d9acabfc05f5ccad69c63d64983b9814 balkon/test/Data/Text/ParagraphLayout/SpanData.hs -rw-r--r-- 1.8 KiB
882969e0Jaro Link ResolvedSpan to boxes. 1 year, 8 days 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
64
65
66
module Data.Text.ParagraphLayout.SpanData
    ( emptySpan
    , czechHello
    , serbianMixedScript
    )
where

import Data.Text (pack)
import Data.Text.Glyphize (Font)

import Data.Text.ParagraphLayout.Internal.BoxOptions
import Data.Text.ParagraphLayout.Internal.LineHeight
import Data.Text.ParagraphLayout.Internal.ResolvedBox
import Data.Text.ParagraphLayout.Internal.ResolvedSpan
import Data.Text.ParagraphLayout.Internal.TextOptions

defaultBox :: ResolvedBox ()
defaultBox = ResolvedBox () 0 defaultBoxOptions

emptySpan :: Font -> ResolvedSpan ()
emptySpan font = ResolvedSpan
    { spanUserData = ()
    , spanIndex = 0
    , spanOffsetInParagraph = 0
    , spanText = pack ""
    , spanTextOptions = defaultTextOptions
        { textFont = font
        , textLineHeight = Normal
        , textLanguage = "en"
        }
    , spanBoxes = [defaultBox]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }

czechHello :: Font -> ResolvedSpan ()
czechHello font = ResolvedSpan
    { spanUserData = ()
    , spanIndex = 0
    , spanOffsetInParagraph = 0
    , spanText = pack "Ahoj, světe!"
    , spanTextOptions = defaultTextOptions
        { textFont = font
        , textLineHeight = Normal
        , textLanguage = "cs"
        }
    , spanBoxes = [defaultBox]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }

serbianMixedScript :: Font -> ResolvedSpan ()
serbianMixedScript font = ResolvedSpan
    { spanUserData = ()
    , spanIndex = 0
    , spanOffsetInParagraph = 0
    , spanText = pack "Vikipedija (Википедија)"
    , spanTextOptions = defaultTextOptions
        { textFont = font
        , textLineHeight = Normal
        , textLanguage = "sr"
        }
    , spanBoxes = [defaultBox]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }