@@ -53,7 +53,11 @@ module Foreign.Lua.Module.DocLayout (
5353
5454 -- * Document Querying
5555 , is_empty
56+ , height
57+ , min_offset
5658 , offset
59+ , real_length
60+ , update_column
5761
5862 -- * Marshaling
5963 , peekDoc
@@ -116,6 +120,11 @@ pushModule = do
116120 -- querying
117121 Lua. addfunction " is_empty" is_empty
118122 Lua. addfunction " offset" offset
123+ Lua. addfunction " height" height
124+ Lua. addfunction " min_offset" min_offset
125+ Lua. addfunction " offset" offset
126+ Lua. addfunction " real_length" real_length
127+ Lua. addfunction " update_column" update_column
119128 -- rendering
120129 Lua. addfunction " render" render
121130 return 1
@@ -143,6 +152,26 @@ is_empty = return . Doc.isEmpty
143152offset :: Doc Text -> Lua Int
144153offset = return . Doc. offset
145154
155+ -- | Returns the minimal width of a @'Doc'@ when reflowed at
156+ -- breakable spaces.
157+ min_offset :: Doc Text -> Lua Int
158+ min_offset = return . Doc. minOffset
159+
160+ -- | Returns the column that would be occupied by the last laid
161+ -- out character.
162+ update_column :: Doc Text -> Int -> Lua Int
163+ update_column doc = return . Doc. updateColumn doc
164+
165+ -- | Returns the height of a block or other Doc.
166+ height :: Doc Text -> Lua Int
167+ height = return . Doc. height
168+
169+ -- | Returns the real length of a string in a monospace font: 0
170+ -- for a combining character, 1, for a regular character, 2 for
171+ -- an East Asian wide character.
172+ real_length :: Text -> Lua Int
173+ real_length = return . Doc. realLength
174+
146175--
147176-- Constructors
148177--
0 commit comments