[Fontconfig] Sharing a FcConfig object between processes

Akira TAGOH akira at tagoh.org
Thu Jul 27 04:07:16 UTC 2023

On Wed, Jul 26, 2023 at 6:40 PM Idriss Fekir <mcsm224 at gmail.com> wrote:
> Hi,
> In Gimp, a Custom config xml string is used to rename some fonts in the
> FcConfig object which are problematic with Pango.
> Gimp supports plugins (and has several fundamental plugins, such as
> saving to a PDF file), each plugin runs in its **own process**.
> This means that any plugin (such as the Pdf export plugin) will get some
> fonts wrong, due to not having the custom xml renaming string in its
> FcConfig.
> Apart from sharing the xml string and doing the renaming on the FcConfig
> object every time  plugin which needs it is run, Is it possible to share
> an FcConfig Object between several processes?

processes? not threads? No, fontconfig doesn't support sharing
FcConfig among processes.
But if renaming family names is the main purpose, you can put
something like this and updating fontconfig caches once may help.

  <match target="scan">
    <test name="family">
      <string>Bad Family Name</string>
    <edit name="family" mode="assign">
      <string>Good Family Name</string>

This is supposed to be "renaming" family name to something in edit. If
you prefer to keep the original one, you may want to use "append" or
"prepend" instead of "assign". Please see the document for more
Please note that this only updates the family name in the fontconfig
cache. If applications tries to open a font directly and go through
meta data from freetype say, you'll still see the original name.

Hope that helps,

More information about the Fontconfig mailing list