32 lines
1.5 KiB
Markdown
32 lines
1.5 KiB
Markdown
# Fontconfig_actor
|
|
|
|
A [Syndicate actor](https://syndicate-lang.org) for querying [Fontconfig](https://www.freedesktop.org/software/fontconfig/).
|
|
|
|
The actor responds to observations of font properties by asserting what it determines to be the most appropriate font.
|
|
|
|
The assertion format is `<fontconfig {pattern…} {attributes…}>` (see [protocol.prs](./protocol.prs)). The `pattern` field is a dictionary of properties to match fonts against and the `attributes` field is a dictionary of the properties of a font selected by Fontconfig. An application observes a `pattern` and takes the `file` and `index` fields of a corresponding assertion and reads font data from the file-system. In the case that `pattern` does not match any fonts an assertion will still be made, so it is possible that all of the properties in `pattern` will be contradicted in `attributes`.
|
|
|
|
For a list of possibly supported properties see the [Fontconfig documentation](https://www.freedesktop.org/software/fontconfig/fontconfig-devel/x19.html).
|
|
|
|
Example [Syndicate server](https://git.syndicate-lang.org/syndicate-lang/syndicate-rs) configuration:
|
|
```
|
|
<require-service <daemon fontconfig_actor>>
|
|
<daemon fontconfig_actor {
|
|
argv: [ "/home/emery/src/bin/fontconfig_actor" ]
|
|
protocol: application/syndicate
|
|
}>
|
|
|
|
let ?fontspace = dataspace
|
|
<fontspace $fontspace>
|
|
|
|
? <service-object <daemon fontconfig_actor> ?cap> [
|
|
$cap <serve $fontspace>
|
|
]
|
|
|
|
$fontspace [
|
|
? <fontconfig {family: "Gentium Book Plus"} ?attributes> [
|
|
$log ! <log "-" { line: <fontconfig $attributes> }>
|
|
]
|
|
]
|
|
```
|