module Data.Text.ParagraphLayout.ResolvedSpan (ResolvedSpan(..))
where
import Data.Text (Text)
import Data.Text.Glyphize (Font)
import qualified Data.Text.ICU as BreakStatus (Line)
import Data.Text.ParagraphLayout.LineHeight
import Data.Text.ParagraphLayout.TextContainer
-- | Internal structure containing resolved values that may be shared with
-- other spans across the paragraph.
data ResolvedSpan = ResolvedSpan
    { spanIndex :: Int
    , spanOffsetInParagraph :: Int
    , spanText :: Text
    , spanFont :: Font
    , spanLineHeight :: LineHeight
    , spanLanguage :: String
    , spanLineBreaks :: [(Int, BreakStatus.Line)]
    }
    deriving (Show)
instance Eq ResolvedSpan where
    a == b = spanIndex a == spanIndex b
instance TextContainer ResolvedSpan where
    getText = spanText