3 unstable releases

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

#1574 in Parser implementations

Download history 870/week @ 2024-07-25 765/week @ 2024-08-01 732/week @ 2024-08-08 379/week @ 2024-08-15 250/week @ 2024-08-22 273/week @ 2024-08-29 433/week @ 2024-09-05 458/week @ 2024-09-12 294/week @ 2024-09-19 304/week @ 2024-09-26 789/week @ 2024-10-03 605/week @ 2024-10-10 705/week @ 2024-10-17 455/week @ 2024-10-24 479/week @ 2024-10-31 454/week @ 2024-11-07

2,180 downloads per month
Used in 6 crates (via fontique)

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.4–0.9MB
~19K SLoC