#font #source #repository #google #file-source #find #yaml-config

bin+lib google-fonts-sources

finding source repositories of Google Fonts fonts

6 releases (3 breaking)

new 0.5.1 Oct 28, 2024
0.5.0 Oct 24, 2024
0.3.1 Sep 17, 2024
0.3.0 Aug 22, 2024
0.1.0 Jul 3, 2024

#90 in Configuration

Download history 16/week @ 2024-07-08 181/week @ 2024-07-15 139/week @ 2024-07-22 43/week @ 2024-07-29 112/week @ 2024-08-05 203/week @ 2024-08-12 225/week @ 2024-08-19 138/week @ 2024-08-26 260/week @ 2024-09-02 88/week @ 2024-09-09 228/week @ 2024-09-16 11/week @ 2024-09-23 352/week @ 2024-09-30 310/week @ 2024-10-07 436/week @ 2024-10-14 230/week @ 2024-10-21

1,329 downloads per month

MIT/Apache

39KB
779 lines

google-fonts-sources

Rust utility to help find the sources of Google Fonts fonts.

This is currently bare-bones; it inspects (or checks out) the repository at github.com/google/fonts, and for each font parses its metadata file, looking for a repository.

For each repository we find, we then look for a config.yaml file in that repository's /source directory, which is present by convention on sources intended to be built by Google Fonts.

use

To use this tool from the command line, in order to generate a JSON dictionary containing information about source repositories:

cargo run -- -o repo_list.json

To use this tool from another Rust crate, see the docs.


lib.rs:

Finding sources for Google Fonts fonts

basic usage:

// get a list of repositories:

let font_repo_cache = Path::new("~/where_i_want_to_checkout_fonts");
let font_repos = google_fonts_sources::discover_sources(font_repo_cache).unwrap();

// for each repo we find, do something with each source:

for repo in &font_repos {
    let sources = match repo.get_sources(font_repo_cache) {
        Ok(sources) => sources,
        Err(e) => {
            eprintln!("skipping repo '{}': '{e}'", repo.repo_name());
            continue;
        }
    };

    println!("repo '{}' contains sources {sources:?}", repo.repo_name());
}

Dependencies

~8–18MB
~280K SLoC