module Data.Text.ParagraphLayout.Internal.ResolvedSpan (ResolvedSpan (..)) where import Data.Text (Text) import qualified Data.Text.ICU as BreakStatus (Line) import Data.Text.ParagraphLayout.Internal.BiDiLevels import Data.Text.ParagraphLayout.Internal.ResolvedBox import Data.Text.ParagraphLayout.Internal.TextContainer import Data.Text.ParagraphLayout.Internal.TextOptions -- | Internal structure containing resolved values that may be shared with -- other spans across the paragraph. data ResolvedSpan d = ResolvedSpan { spanUserData :: d , spanIndex :: Int , spanOffsetInParagraph :: Int , spanText :: Text , spanTextOptions :: TextOptions , spanBoxes :: [ResolvedBox d] , spanBiDiLevels :: TextLevels , spanLineBreaks :: [(Int, BreakStatus.Line)] -- TODO: Can be optimised by starting with the shortest line break. , spanCharacterBreaks :: [(Int, ())] } instance Eq (ResolvedSpan d) where a == b = spanIndex a == spanIndex b instance TextContainer (ResolvedSpan d) where getText = spanText