@@ 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
@@ 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
@@ 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 = []
}