packages feed

gi-pango-0.1.38.13: GI/Pango/Structs/AttrFontFeatures.hs


{- |
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 #PangoAttrFontFeatures structure is used to represent OpenType
font features as an attribute.
-}

module GI.Pango.Structs.AttrFontFeatures
    ( 

-- * Exported types
    AttrFontFeatures(..)                    ,
    newZeroAttrFontFeatures                 ,
    noAttrFontFeatures                      ,


 -- * Properties
-- ** Attr
    attrFontFeaturesReadAttr                ,


-- ** Features
    attrFontFeaturesReadFeatures            ,




    ) 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 AttrFontFeatures = AttrFontFeatures (ForeignPtr AttrFontFeatures)
-- | Construct a `AttrFontFeatures` struct initialized to zero.
newZeroAttrFontFeatures :: MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures = liftIO $ callocBytes 24 >>= wrapPtr AttrFontFeatures

noAttrFontFeatures :: Maybe AttrFontFeatures
noAttrFontFeatures = Nothing

attrFontFeaturesReadAttr :: AttrFontFeatures -> IO Attribute
attrFontFeaturesReadAttr s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr Attribute)
    val' <- (newPtr 16 Attribute) val
    return val'

attrFontFeaturesReadFeatures :: AttrFontFeatures -> IO T.Text
attrFontFeaturesReadFeatures s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CString
    val' <- cstringToText val
    return val'

type family ResolveAttrFontFeaturesMethod (t :: Symbol) (o :: *) :: * where
    ResolveAttrFontFeaturesMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, MethodInfo info AttrFontFeatures p) => IsLabelProxy t (AttrFontFeatures -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, MethodInfo info AttrFontFeatures p) => IsLabel t (AttrFontFeatures -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif