fontconfig_actor/README.md

1.5 KiB

Fontconfig_actor

A Syndicate actor for querying 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). 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.

Example Syndicate server 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> }>
  ]
]