module Data.Text.ParagraphLayout.ParagraphData
(czechHelloParagraph
,emptyParagraph
,emptySpanParagraph
,mixedLanguageLTRParagraph
,mixedScriptSerbianParagraph
)
where
import Data.Text (pack)
import Data.Text.Internal (Text(Text))
import Data.Text.ParagraphLayout.Plain
(Paragraph(Paragraph)
,ParagraphOptions
,Span(Span)
)
emptyParagraph :: ParagraphOptions -> Paragraph
emptyParagraph opts =
let (Text arr off _) = pack ""
in Paragraph
arr
(fromIntegral off)
[]
opts
emptySpanParagraph :: ParagraphOptions -> Paragraph
emptySpanParagraph opts =
let (Text arr off _) = pack ""
in Paragraph
arr
(fromIntegral off)
[Span 0 "en"]
opts
czechHelloParagraph :: ParagraphOptions -> Paragraph
czechHelloParagraph opts =
let (Text arr off len) = pack "Ahoj, světe!"
in Paragraph
arr
(fromIntegral off)
[Span (fromIntegral len) "cs"]
opts
mixedScriptSerbianParagraph :: ParagraphOptions -> Paragraph
mixedScriptSerbianParagraph opts =
let (Text arr off len) = pack "Vikipedija (Википедија)"
in Paragraph
arr
(fromIntegral off)
[Span (fromIntegral len) "sr"]
opts
mixedLanguageLTRParagraph :: ParagraphOptions -> Paragraph
mixedLanguageLTRParagraph opts =
let (Text arr off _) = pack "Tak jsem tady, 世界!"
in Paragraph
arr
(fromIntegral off + 4)
[Span 11 "cs" -- this will contain the text "jsem tady, "
,Span 7 "ja" -- this will contain the text "世界!"
]
opts