Safe Haskell | None |
---|---|
Language | Haskell2010 |
Graphics.Text.Font.Choose.Config.Accessors
Description
APIs for retrieving configuration This is seperate from Graphics.Text.Font.Choose.Config to avoid cyclic dependencies.
Synopsis
- configCreate :: IO Config
- setCurrent :: Config -> IO ()
- current :: IO Config
- current' :: Config
- uptodate :: Config -> IO Bool
- home :: String
- enableHome :: Bool -> IO Bool
- buildFonts :: Config -> IO ()
- configDirs :: Config -> IO [String]
- fontDirs :: Config -> IO [String]
- configFiles :: Config -> IO [String]
- cacheDirs :: Config -> IO [String]
- fonts :: Config -> SetName -> IO FontSet
- rescanInterval :: Config -> IO Int
- setRescanInterval :: Config -> Int -> IO ()
- appFontAddFile :: Config -> FilePath -> IO ()
- appFontAddDir :: Config -> FilePath -> IO ()
- appFontClear :: Config -> IO ()
- substitute :: Config -> Pattern -> Maybe Pattern -> MatchKind -> Pattern
- fontMatch :: Config -> Pattern -> Maybe Pattern
- fontSort :: Config -> Pattern -> Bool -> Maybe (FontSet, CharSet')
- fontRenderPrepare :: Config -> Pattern -> Pattern -> Pattern
- fontList :: Config -> Pattern -> ObjectSet -> FontSet
- filename :: Config -> FilePath -> IO FilePath
- parseAndLoad :: Config -> FilePath -> Bool -> IO ()
- parseAndLoadFromMemory :: Config -> FilePath -> Bool -> IO ()
- sysroot :: Config -> IO String
- setSysroot :: Config -> String -> IO ()
- data SetName
- data MatchKind
Documentation
configCreate :: IO Config Source #
Creates an empty configuration.
setCurrent :: Config -> IO () Source #
Sets the current default configuration to config. Implicitly calls FcConfigBuildFonts if necessary, and FcConfigReference() to inrease the reference count in config since 2.12.0.
Returns the current default configuration.
WARNING: Might not behave correctly around calls to setCurrent
,
but given how many APIs expect a config this makes pure code easier to write.
uptodate :: Config -> IO Bool Source #
Checks all of the files related to config and returns whether any of them has been modified since the configuration was created.
Return the current user's home directory, if it is available & if using it is enabled.
enableHome :: Bool -> IO Bool Source #
If given True, then Fontconfig will use various files which are specified relative to the user's home directory (using the ~ notation in the configuration). When its False, then all use of the home directory in these contexts will be disabled. The previous setting of the value is returned.
buildFonts :: Config -> IO () Source #
Builds the set of available fonts for the given configuration. Note that any changes to the configuration after this call (through parseAndLoad or parseAndLoadFromMemory) have indeterminate effects. (On the other hand, application fonts can still be modified through appFontAddFile, appFontAddDir and appFontClear).
configDirs :: Config -> IO [String] Source #
Returns the list of font directories specified in the configuration files. Does not include any subdirectories.
fontDirs :: Config -> IO [String] Source #
Returns the list of font directories. This includes the configured font directories along with any directories below those in the filesystem.
configFiles :: Config -> IO [String] Source #
Returns the list of known configuration files used to generate given config.
cacheDirs :: Config -> IO [String] Source #
returns a string list containing all of the directories that fontconfig will search when attempting to load a cache file for a font directory.
fonts :: Config -> SetName -> IO FontSet Source #
Returns one of the two sets of fonts from the configuration as specified by set.
rescanInterval :: Config -> IO Int Source #
Returns the interval between automatic checks of the configuration (in seconds) specified in config. The configuration is checked during a call to FcFontList when this interval has passed since the last check. An interval setting of zero disables automatic checks.
setRescanInterval :: Config -> Int -> IO () Source #
Sets the rescan interval. An interval setting of zero disables automatic checks.
appFontAddFile :: Config -> FilePath -> IO () Source #
Adds an application-specific font to the configuration.
appFontAddDir :: Config -> FilePath -> IO () Source #
Scans the specified directory for fonts, adding each one found to the application-specific set of fonts.
appFontClear :: Config -> IO () Source #
Clears the set of application-specific fonts.
substitute :: Config -> Pattern -> Maybe Pattern -> MatchKind -> Pattern Source #
Performs the sequence of pattern modification operations tagged by kind
.
If kind is MatchPattern then those tagged as pattern operations are applied,
else if kind is MatchFont those tagged as font operations are applied
& p_pat is used for <test> elements with target=pattern.
fontMatch :: Config -> Pattern -> Maybe Pattern Source #
Finds the font in sets most closely matching pattern and returns the result of fontRenderPrepare for that font and the provided pattern.
fontSort :: Config -> Pattern -> Bool -> Maybe (FontSet, CharSet') Source #
Returns the list of fonts sorted by closeness to p. If trim is FcTrue, elements in the list which don't include Unicode coverage not provided by earlier elements in the list are elided. The union of Unicode coverage of all of the fonts is returned.
The returned FcFontSet references FcPattern structures which may be shared by the return value from multiple FcFontSort calls, applications must not modify these patterns.
fontRenderPrepare :: Config -> Pattern -> Pattern -> Pattern Source #
Creates a new pattern consisting of elements of font not appearing in pat, elements of pat not appearing in font and the best matching value from pat for elements appearing in both. The result is passed to FcConfigSubstituteWithPat with kind FcMatchFont and then returned.
fontList :: Config -> Pattern -> ObjectSet -> FontSet Source #
Selects fonts matching p, creates patterns from those fonts containing only the given objects and returns the set of unique such patterns.
filename :: Config -> FilePath -> IO FilePath Source #
Given the specified external entity name, return the associated filename. This provides applications a way to convert various configuration file references into filename form.
An empty name indicates that the default configuration file should be used;
which file this references can be overridden with the FONTCONFIG_FILE environment variable.
Next, if the name starts with ~, it refers to a file in the current users home directory.
Otherwise if the name doesn't start with /
, it refers to a file in the default config dir;
the built-in default directory can be overridden with the FONTCONFIG_PATH environment variable.
The result of this function is affected by the FONTCONFIG_SYSROOT environment variable or equivalent functionality.
parseAndLoad :: Config -> FilePath -> Bool -> IO () Source #
Walks the configuration in path
and constructs the internal representation in conf
.
Any include files referenced from within path
will be loaded and parsed.
If complain
is False, no warning will be displayed if path
does not exist.
Error and warning messages will be output to stderr.
Throws an exception if some error occurred while loading the file, either a parse error,
semantic error or allocation failure. After all configuration files or strings have been loaded,
with FcConfigParseAndLoad inclusive-or FcConfigParseAndLoadFromMemory,
call FcConfigBuildFonts to build the font database.
parseAndLoadFromMemory :: Config -> FilePath -> Bool -> IO () Source #
Walks the configuration in buf
and constructs the internal representation in conf
.
Any includes files referenced from within buf
will be loaded and dparsed.
If complain
is False, no warning will be displayed if file
does not exist.
Error and warning messages will be output to stderr.
Throws an exception if fsome error occurred while loading the file, either a parse error,
semantic error or allocation failure. After all configuration files or strings have been loaded,
with FcConfigParseAndLoad inclusive-or FcConfigParseAndLoadFromMemory,
call FcConfigBuildFonts to build the font database.
sysroot :: Config -> IO String Source #
Obtains the system root directory in conf
if available.
All files (including file properties in patterns) obtained from this conf
are relative to this system root directory.
setSysroot :: Config -> String -> IO () Source #
Set root
as the system root directory. All file paths used or created with this conf
(including file properties in patterns) will be considered or made relative to this root
.
This allows a host to generate caches for targets at build time.
This also allows a cache to be re-targeted to a different base directory if FcConfigGetSysRoot
is used to resolve file paths. When setting this on the current config this causes
changing current config (calls FcConfigSetCurrent()).
Which set of fonts to retrieve.
Instances
Enum SetName Source # | |
Read SetName Source # | |
Show SetName Source # | |
Eq SetName Source # | |
Which pattern modifications to apply during substituteWithPat
.
Constructors
MatchPattern | Applies pattern operations. |
MatchFont | Applies font operations. |
Instances
Enum MatchKind Source # | |
Defined in Graphics.Text.Font.Choose.Config.Accessors Methods succ :: MatchKind -> MatchKind # pred :: MatchKind -> MatchKind # fromEnum :: MatchKind -> Int # enumFrom :: MatchKind -> [MatchKind] # enumFromThen :: MatchKind -> MatchKind -> [MatchKind] # enumFromTo :: MatchKind -> MatchKind -> [MatchKind] # enumFromThenTo :: MatchKind -> MatchKind -> MatchKind -> [MatchKind] # | |
Read MatchKind Source # | |
Show MatchKind Source # | |
Eq MatchKind Source # | |