Syndicate actor for asserting Fontconfig information
Go to file
Emery Hemingway b3d0b69626 Update build metadata 2023-11-30 12:02:52 +02:00
src Syndicate API update 2023-10-21 18:36:02 +01:00
.envrc Better build system 2023-06-07 18:09:04 +01:00
.gitignore Add lockfile 2023-10-09 20:27:15 +01:00
README.md Idomatic dataspace passing at boot 2023-05-02 22:07:00 +01:00
Tupfile Syndicate API update 2023-10-21 18:36:02 +01:00
Tuprules.tup Add lockfile 2023-10-09 20:27:15 +01:00
fontconfig_actor.nimble Update build metadata 2023-11-30 12:02:52 +02:00
lock.json Update build metadata 2023-11-30 12:02:52 +02:00
protocol.prs Idomatic dataspace passing at boot 2023-05-02 22:07:00 +01:00
shell.nix Update build metadata 2023-11-30 12:02:52 +02:00

README.md

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. When the value of a property is a Preserves symbol (rather than a string in double-quotes) it will be resolved to a Fontconfig constant if possible. Constants are not resolved from integers to symbols in the attributes field. For example, {slant: oblique} is transformed to {slant: 110} from pattern to attributes.

Example Syndicate server configuration:

let ?fontspace = dataspace
<fontspace $fontspace>

<daemon fontconfig_actor {
  argv: [ "/usr/local/bin/fontconfig_actor" ]
  protocol: application/syndicate
}>

? <fontspace ?fontspace> [
  <require-service <daemon fontconfig_actor>>
  ? <service-object <daemon fontconfig_actor> ?cap> [
    $cap { dataspace: $fontspace }
    $socketspace ? <fontconfig {size: 8.0, spacing: proportional} ?properties> [
      $log ! <log "-" { line: <fontconfig $properties> }>
    ]
  ]
]

Motivation

This actor is only useful with applications that already speak Syndicate. For those applications that do, getting typeface and font configuration over Syndicate has a few benefits over using Fontconfig directly.

  • One less library to compile, link, and load.
  • Request caching across different applications and invocations.
  • Less system-calls at the application side.
  • Dynamic font configuration.