module TextExtents where
import Xrequest(xrequest)
import Command
import Event

queryTextExtents16K :: FontId
-> String -> (Int -> Int -> CharStruct -> f hi ho) -> f hi ho
queryTextExtents16K FontId
fid String
str Int -> Int -> CharStruct -> f hi ho
k =
    forall {f :: * -> * -> *} {ans} {hi} {ho}.
FudgetIO f =>
XRequest -> (XResponse -> Maybe ans) -> (ans -> f hi ho) -> f hi ho
xrequest XRequest
cmd XResponse -> Maybe (Int, Int, CharStruct)
expected forall a b. (a -> b) -> a -> b
$ \ (Int
a,Int
d,CharStruct
cs) -> Int -> Int -> CharStruct -> f hi ho
k Int
a Int
d CharStruct
cs
  where
    cmd :: XRequest
cmd = FontId -> String -> XRequest
QueryTextExtents16 FontId
fid String
str

    expected :: XResponse -> Maybe (Int, Int, CharStruct)
expected (TextExtents16Queried Int
a Int
d CharStruct
cs) = forall a. a -> Maybe a
Just (Int
a,Int
d,CharStruct
cs)
    expected XResponse
_ = forall a. Maybe a
Nothing