~jaro/balkon

ref: 88a5b6c714c5543b01d63d836ad403b5755d8d76 balkon/src/Data/Text/ParagraphLayout/Internal/BoxOptions.hs -rw-r--r-- 1.6 KiB
88a5b6c7Jaro Test shaping across intra-word breaks. 1 year, 5 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
module Data.Text.ParagraphLayout.Internal.BoxOptions
    ( BoxOptions (..)
    , BoxSpacing (..)
    , defaultBoxOptions
    )
where

import Data.Int (Int32)

-- | Style options to be applied to an inline box.
--
-- This record type is likely to be extended in the future.
-- Use `defaultBoxOptions` and update it with specific record selectors
-- instead of constructing `BoxOptions` directly.
data BoxOptions = BoxOptions

    { boxSpacing :: BoxSpacing
    -- ^ Determines amount of empty space to add before the first fragment
    -- and/or after the last fragment of this box.
    --
    -- This can be used to reserve space for a left margin, border,
    -- and/or padding.

    }
    deriving (Eq)

-- | Determines the amount of empty space to add around a box.
data BoxSpacing

    -- | Specification using absolute directions, unaffected by text direction.
    --
    -- (However, text direction is still used in case of fragmentation,
    -- to determine how to map the first (last) fragment to left (right).)
    = BoxSpacingLeftRight

        Int32
        -- ^ Amount of empty space to add to the left side of the
        -- first fragment (for LTR text) or last fragment (for RTL text)
        -- created from this box.

        Int32
        -- ^ Amount of empty space to add to the right side of the
        -- first fragment (for RTL text) or last fragment (for LTR text)
        -- created from this box.

    deriving (Eq, Show, Read)

-- | `BoxOptions` with default values.
defaultBoxOptions :: BoxOptions
defaultBoxOptions = BoxOptions
    { boxSpacing = BoxSpacingLeftRight 0 0
    }