@@ 19,84 19,42 @@ import Data.Text.ParagraphLayout.Internal.TextOptions
defaultBox :: Direction -> ResolvedBox ()
defaultBox dir = ResolvedBox () 0 defaultBoxOptions dir
-emptySpan :: Font -> ResolvedSpan ()
-emptySpan font = ResolvedSpan
+sampleSpan :: Direction -> String -> String -> Font -> ResolvedSpan ()
+sampleSpan dir lang str font = ResolvedSpan
{ spanUserData = ()
, spanIndex = 0
, spanOffsetInParagraph = 0
- , spanText = pack ""
- , spanTextOptions = (defaultTextOptions DirLTR)
+ , spanText = text
+ , spanTextOptions = (defaultTextOptions dir)
{ textFont = font
, textLineHeight = Normal
- , textLanguage = "en"
+ , textLanguage = lang
}
- , spanBoxes = [defaultBox DirLTR]
+ , spanBoxes = [defaultBox dir]
, spanLineBreaks = []
, spanCharacterBreaks = []
}
+ where
+ text = pack str
+
+emptySpan :: Font -> ResolvedSpan ()
+emptySpan = sampleSpan DirLTR "en"
+ ""
czechHello :: Font -> ResolvedSpan ()
-czechHello font = ResolvedSpan
- { spanUserData = ()
- , spanIndex = 0
- , spanOffsetInParagraph = 0
- , spanText = pack "Ahoj, světe!"
- , spanTextOptions = (defaultTextOptions DirLTR)
- { textFont = font
- , textLineHeight = Normal
- , textLanguage = "cs"
- }
- , spanBoxes = [defaultBox DirLTR]
- , spanLineBreaks = []
- , spanCharacterBreaks = []
- }
+czechHello = sampleSpan DirLTR "cs"
+ "Ahoj, světe!"
arabicHello :: Font -> ResolvedSpan ()
-arabicHello font = ResolvedSpan
- { spanUserData = ()
- , spanIndex = 0
- , spanOffsetInParagraph = 0
- , spanText = pack "سلام"
- , spanTextOptions = (defaultTextOptions DirRTL)
- { textFont = font
- , textLineHeight = Normal
- , textLanguage = "ar"
- }
- , spanBoxes = [defaultBox DirRTL]
- , spanLineBreaks = []
- , spanCharacterBreaks = []
- }
+arabicHello = sampleSpan DirRTL "ar"
+ "سلام"
serbianMixedScript :: Font -> ResolvedSpan ()
-serbianMixedScript font = ResolvedSpan
- { spanUserData = ()
- , spanIndex = 0
- , spanOffsetInParagraph = 0
- , spanText = pack "Vikipedija (Википедија)"
- , spanTextOptions = (defaultTextOptions DirLTR)
- { textFont = font
- , textLineHeight = Normal
- , textLanguage = "sr"
- }
- , spanBoxes = [defaultBox DirLTR]
- , spanLineBreaks = []
- , spanCharacterBreaks = []
- }
+serbianMixedScript = sampleSpan DirLTR "sr"
+ "Vikipedija (Википедија)"
-- | Source:
-- <https://www.w3.org/International/articles/inline-bidi-markup/uba-basics>
englishAroundArabic :: Font -> ResolvedSpan ()
-englishAroundArabic font = ResolvedSpan
- { spanUserData = ()
- , spanIndex = 0
- , spanOffsetInParagraph = 0
- , spanText = pack "The title is مفتاح معايير الويب in Arabic."
- , spanTextOptions = (defaultTextOptions DirLTR)
- { textFont = font
- , textLineHeight = Normal
- , textLanguage = "en"
- }
- , spanBoxes = [defaultBox DirLTR]
- , spanLineBreaks = []
- , spanCharacterBreaks = []
- }
+englishAroundArabic = sampleSpan DirLTR "en"
+ "The title is مفتاح معايير الويب in Arabic."