3 unstable releases

0.2.0 Apr 20, 2024
0.1.1 Mar 3, 2024
0.1.0 Mar 3, 2024

#1724 in Parser implementations

Download history 308/week @ 2024-03-02 27/week @ 2024-03-09 3/week @ 2024-03-16 68/week @ 2024-03-30 41/week @ 2024-04-06 156/week @ 2024-04-13 475/week @ 2024-04-20

740 downloads per month

MIT/Apache

33KB
627 lines

fontconfig-cache-parser

fontconfig-cache-parser does what it says: it's a rust crate for parsing fontconfig's cache files. This allows you to list your installed font files (and see some properties of them) without having to scan all the font directories on your system.

This crate does not (yet) allow for parsing all the information in the cache, but it is capable of extracting basic metadata like filenames, style information, and charsets.

You may also be interested in the fontconfig_parser crate, which parses fontconfig's config files. In particular, it can tell you where the cache files live.


lib.rs:

A crate for parsing fontconfig cache files.

The fontconfig cache format is a C-style binary format, containing a maze of twisty structs all alike, with lots of pointers from one to another. This makes it pretty inefficient to parse the whole file, especially if you're only interested in a few parts. The expected workflow of this crate is:

  1. You read the cache file into memory (possibly using mmap if the file is large and performance is important).
  2. You construct a Cache, borrowing the memory chunk.
  3. You follow the various methods on Cache to get access to the information you want. As you follow those methods, the data will be read incrementally from the memory chunk you created in part 1.

Dependencies

~0.5–1MB
~21K SLoC