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
2,180 downloads per month
Used in 6 crates
(via fontique)
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:
- You read the cache file into memory (possibly using
mmap
if the file is large and performance is important). - You construct a
Cache
, borrowing the memory chunk. - 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