~alcinnz/fontconfig-pure

d3bb3d92191d9e740c1d827e5c56f58d725d8c42 — Adrian Cochrane 2 years ago 215106b
Upload documentation on initialization/finalization routines.
1 files changed, 26 insertions(+), 0 deletions(-)

M Graphics/Text/Font/Choose/Init.hs
M Graphics/Text/Font/Choose/Init.hs => Graphics/Text/Font/Choose/Init.hs +26 -0
@@ 5,14 5,40 @@ import Prelude hiding (init)

import Graphics.Text.Font.Choose.Config

-- | Loads the default configuration file and returns the resulting configuration.
-- Does not load any font information.
initLoadConfig = fcInitLoadConfig >>= ptr2config
foreign import ccall "FcInitLoadConfig" fcInitLoadConfig :: IO Config_
-- | Loads the default configuration file and builds information about the available fonts.
-- Returns the resulting configuration.
initLoadConfigAndFonts = fcInitLoadConfigAndFonts >>= ptr2config
foreign import ccall "FcInitLoadConfigAndFonts" fcInitLoadConfigAndFonts :: IO Config_

-- | Initialize fontconfig library
-- Loads the default configuration file and the fonts referenced therein and
-- sets the default configuration to that result.
-- Returns whether this process succeeded or not.
-- If the default configuration has already been loaded,
-- this routine does nothing and returns FcTrue.
foreign import ccall "FcInit" init :: IO Bool
-- | Frees all data structures allocated by previous calls to fontconfig functions.
-- Fontconfig returns to an uninitialized state,
-- requiring a new call to one of the FcInit functions before any other
-- fontconfig function may be called.
foreign import ccall "FcFini" fini :: IO ()
-- | Forces the default configuration file to be reloaded
-- and resets the default configuration. Returns `False` if the configuration
-- cannot be reloaded (due to configuration file errors,
-- allocation failures or other issues) and leaves the existing configuration
-- unchanged. Otherwise returns True.
foreign import ccall "FcInitReinitialize" reinit :: IO Bool
-- | Checks the rescan interval in the default configuration,
-- checking the configuration if the interval has passed and
-- reloading the configuration if when any changes are detected.
-- Returns False if the configuration cannot be reloaded (see FcInitReinitialize).
-- Otherwise returns True.
foreign import ccall "FcInitBringUptoDate" bringUptoDate :: IO Bool

-- | Library version number
-- Returns the version number of the library.
foreign import ccall "FcGetVersion" version :: Int