~alcinnz/fontconfig-pure

ref: 866ea3d2d38b232014081d67c198a73620f1414c fontconfig-pure/Graphics/Text/Font/Choose/Init.hs -rw-r--r-- 2.2 KiB
866ea3d2 — Adrian Cochrane Start implementing a seperate bridge module to Harfbuzz. 1 year, 10 months ago
                                                                                
300e62d1 Adrian Cochrane
e21707cb Adrian Cochrane
64bcb432 Adrian Cochrane
d3bb3d92 Adrian Cochrane
614373ce Adrian Cochrane
d3bb3d92 Adrian Cochrane
614373ce Adrian Cochrane
e21707cb Adrian Cochrane
d3bb3d92 Adrian Cochrane
e21707cb Adrian Cochrane
d3bb3d92 Adrian Cochrane
e21707cb Adrian Cochrane
d3bb3d92 Adrian Cochrane
e21707cb Adrian Cochrane
d3bb3d92 Adrian Cochrane
e21707cb Adrian Cochrane
d3bb3d92 Adrian Cochrane
e21707cb Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module Graphics.Text.Font.Choose.Init (Config, initLoadConfig, initLoadConfigAndFonts,
    init, fini, reinit, bringUptoDate, version) where

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