{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) The PangoGlyphVisAttr is used to communicate information between the shaping phase and the rendering phase. More attributes may be added in the future. -} module GI.Pango.Structs.GlyphVisAttr ( -- * Exported types GlyphVisAttr(..) , newZeroGlyphVisAttr , noGlyphVisAttr , -- * Properties -- ** IsClusterStart glyphVisAttrReadIsClusterStart , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Pango.Types import GI.Pango.Callbacks newtype GlyphVisAttr = GlyphVisAttr (ForeignPtr GlyphVisAttr) -- | Construct a `GlyphVisAttr` struct initialized to zero. newZeroGlyphVisAttr :: MonadIO m => m GlyphVisAttr newZeroGlyphVisAttr = liftIO $ callocBytes 4 >>= wrapPtr GlyphVisAttr noGlyphVisAttr :: Maybe GlyphVisAttr noGlyphVisAttr = Nothing glyphVisAttrReadIsClusterStart :: GlyphVisAttr -> IO Word32 glyphVisAttrReadIsClusterStart s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Word32 return val type family ResolveGlyphVisAttrMethod (t :: Symbol) (o :: *) :: * where ResolveGlyphVisAttrMethod l o = MethodResolutionFailed l o instance (info ~ ResolveGlyphVisAttrMethod t GlyphVisAttr, MethodInfo info GlyphVisAttr p) => IsLabelProxy t (GlyphVisAttr -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveGlyphVisAttrMethod t GlyphVisAttr, MethodInfo info GlyphVisAttr p) => IsLabel t (GlyphVisAttr -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif