3 unstable releases

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

#1035 in Parser implementations

Download history 229/week @ 2024-02-26 97/week @ 2024-03-04 12/week @ 2024-03-11 82/week @ 2024-04-01 41/week @ 2024-04-08 534/week @ 2024-04-15 618/week @ 2024-04-22 510/week @ 2024-04-29 463/week @ 2024-05-06 75/week @ 2024-05-13

1,687 downloads per month
Used in 4 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.5–1MB
~21K SLoC