~jaro/balkon

75e3b64a230f131fcde0b12604a187aef4ee2853 — Jaro 1 year, 7 months ago efcef17
Store direction in ResolvedBox.
M src/Data/Text/ParagraphLayout/Internal/ResolvedBox.hs => src/Data/Text/ParagraphLayout/Internal/ResolvedBox.hs +3 -0
@@ 1,6 1,8 @@
module Data.Text.ParagraphLayout.Internal.ResolvedBox (ResolvedBox (..))
where

import Data.Text.Glyphize (Direction)

import Data.Text.ParagraphLayout.Internal.BoxOptions

-- | Internal structure describing an inline box.


@@ 9,6 11,7 @@ data ResolvedBox d = ResolvedBox
    { boxUserData :: d
    , boxIndex :: Int
    , boxOptions :: BoxOptions
    , boxDirection :: Direction
    }

instance Eq (ResolvedBox d) where

M src/Data/Text/ParagraphLayout/Internal/Tree.hs => src/Data/Text/ParagraphLayout/Internal/Tree.hs +3 -1
@@ 91,4 91,6 @@ flattenNode :: Int -> BoxPath d -> TextOptions -> InnerNode d ->
flattenNode idx path textOpts (TextSequence d len) =
    (idx, [TextLeaf d len textOpts path])
flattenNode idx path _ (InlineBox d (Box ns textOpts) boxOpts) =
    flattenNodes (idx + 1) (ResolvedBox d idx boxOpts : path) textOpts ns
    flattenNodes (idx + 1) (ResolvedBox d idx boxOpts dir : path) textOpts ns
    where
        dir = textDirection textOpts

M test/Data/Text/ParagraphLayout/SpanData.hs => test/Data/Text/ParagraphLayout/SpanData.hs +5 -5
@@ 14,8 14,8 @@ import Data.Text.ParagraphLayout.Internal.ResolvedBox
import Data.Text.ParagraphLayout.Internal.ResolvedSpan
import Data.Text.ParagraphLayout.Internal.TextOptions

defaultBox :: ResolvedBox ()
defaultBox = ResolvedBox () 0 defaultBoxOptions
defaultBox :: Direction -> ResolvedBox ()
defaultBox dir = ResolvedBox () 0 defaultBoxOptions dir

emptySpan :: Font -> ResolvedSpan ()
emptySpan font = ResolvedSpan


@@ 28,7 28,7 @@ emptySpan font = ResolvedSpan
        , textLineHeight = Normal
        , textLanguage = "en"
        }
    , spanBoxes = [defaultBox]
    , spanBoxes = [defaultBox DirLTR]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }


@@ 44,7 44,7 @@ czechHello font = ResolvedSpan
        , textLineHeight = Normal
        , textLanguage = "cs"
        }
    , spanBoxes = [defaultBox]
    , spanBoxes = [defaultBox DirLTR]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }


@@ 60,7 60,7 @@ serbianMixedScript font = ResolvedSpan
        , textLineHeight = Normal
        , textLanguage = "sr"
        }
    , spanBoxes = [defaultBox]
    , spanBoxes = [defaultBox DirLTR]
    , spanLineBreaks = []
    , spanCharacterBreaks = []
    }