{"id":28370690,"url":"https://github.com/fontsource/google-font-metadata","last_synced_at":"2025-07-28T08:46:17.876Z","repository":{"id":37756350,"uuid":"279578822","full_name":"fontsource/google-font-metadata","owner":"fontsource","description":"A metadata generator that fetches and parses the Google Fonts API.","archived":false,"fork":false,"pushed_at":"2025-06-01T01:29:58.000Z","size":56700,"stargazers_count":38,"open_issues_count":5,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T15:30:53.555Z","etag":null,"topics":["fonts","fontsource","google-font","google-fonts","google-fonts-api","metadata","metadata-generator","unicode-range"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fontsource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-14T12:27:33.000Z","updated_at":"2025-07-10T04:41:57.000Z","dependencies_parsed_at":"2024-01-01T01:35:16.102Z","dependency_job_id":"a739d5a3-26b6-42ef-9915-9953094297a8","html_url":"https://github.com/fontsource/google-font-metadata","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/fontsource/google-font-metadata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fontsource%2Fgoogle-font-metadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fontsource%2Fgoogle-font-metadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fontsource%2Fgoogle-font-metadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fontsource%2Fgoogle-font-metadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fontsource","download_url":"https://codeload.github.com/fontsource/google-font-metadata/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fontsource%2Fgoogle-font-metadata/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267488254,"owners_count":24095779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fonts","fontsource","google-font","google-fonts","google-fonts-api","metadata","metadata-generator","unicode-range"],"created_at":"2025-05-29T06:44:18.855Z","updated_at":"2025-07-28T08:46:17.860Z","avatar_url":"https://github.com/fontsource.png","language":"TypeScript","readme":"# Google Font Metadata\n\n[![npm version](https://badge.fury.io/js/google-font-metadata.svg)](https://badge.fury.io/js/google-font-metadata) [![License](https://badgen.net/badge/license/MIT/green)](https://github.com/fontsource/google-font-metadata/blob/master/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/fontsource/google-font-metadata.svg?style=social\u0026label=Star)](https://github.com/fontsource/google-font-metadata/stargazers)\n\nA metadata generator that fetches and parses the Google Fonts API to be primarily used for the [Fontsource monorepo](https://github.com/fontsource/fontsource).\n\n## Installation\n\nInstall the package from `npm`:\n\n```shell\nnpm install google-font-metadata\n```\n\n## Usage\n\nThe project exports the following data:\n\n```ts\nimport {\n    APIv1,\n    APIv2,\n    APIVariable,\n    APIIconStatic,\n    APIIconVariable,\n    APILicense,\n    APIRegistry,\n} from \"google-font-metadata\";\nconst {\n    APIv1,\n    APIv2,\n    APIVariable,\n    APIIconStatic,\n    APIIconVariable,\n    APILicense,\n    APIRegistry,\n} = require(\"google-font-metadata\");\n\nconsole.dir(APIv2);\n```\n\n## APIv1\n\nUses the Google Fonts CSS APIv1 that includes different font files for each subset, but does NOT include unicode-range values. This isn't usually recommended.\n\nIt exports [`data/google-fonts-v1.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/google-fonts-v1.json).\n\n```json\n{\n...\n\"abel\": {\n    \"family\": \"Abel\",\n    \"id\": \"abel\",\n    \"subsets\": [\"latin\"],\n    \"weights\": [400],\n    \"styles\": [\"normal\"],\n    \"variants\": {\n      \"400\": {\n        \"normal\": {\n          \"latin\": {\n            \"url\": {\n              \"woff2\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE2V9BPQ.woff2\",\n              \"woff\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE2V9BOw.woff\",\n              \"truetype\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE2V9BOA.ttf\"\n            }\n          }\n        }\n      }\n    },\n    \"defSubset\": \"latin\",\n    \"lastModified\": \"2022-04-20\",\n    \"version\": \"v18\",\n    \"category\": \"sans-serif\"\n  },\n...\n}\n```\n\n## APIv2\n\nUses the Google Fonts CSS APIv2 and includes the unicode-range values for every subset. However, the API serves `ttf` files with **ALL** subsets included in one file and therefore all links for those file types in the same subset lead to the same link for each weight and style. `woff2` and `woff` files are individually split per subset.\n\nExports [`data/google-fonts-v2.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/google-fonts-v2.json).\n\n```json\n{\n...\n\"abel\": {\n    \"family\": \"Abel\",\n    \"id\": \"abel\",\n    \"subsets\": [\"latin\"],\n    \"weights\": [400],\n    \"styles\": [\"normal\"],\n    \"unicodeRange\": {\n      \"latin\": \"U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD\"\n    },\n    \"variants\": {\n      \"400\": {\n        \"normal\": {\n          \"latin\": {\n            \"url\": {\n              \"woff2\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE2V9BPQ.woff2\",\n              \"woff\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE6Vs.woff\",\n              \"truetype\": \"https://fonts.gstatic.com/s/abel/v18/MwQ5bhbm2POE6Vg.ttf\"\n            }\n          }\n        }\n      }\n    },\n    \"defSubset\": \"latin\",\n    \"lastModified\": \"2022-04-20\",\n    \"version\": \"v18\",\n    \"category\": \"sans-serif\"\n  },\n...\n}\n```\n\nNote that fonts with large glyphsets such as the Japanese, Korean or Chinese language, are divided into many smaller **numbered** subsets that utilize the unicode-range @fontface selector. An example is Noto Sans JP which returns the following:\n\n```json\n{\n...\n \"noto-sans-jp\": {\n    \"family\": \"Noto Sans JP\",\n    \"id\": \"noto-sans-jp\",\n    \"subsets\": [\"japanese\", \"latin\"],\n    \"weights\": [100, 300, 400, 500, 700, 900],\n    \"styles\": [\"normal\"],\n    \"unicodeRange\": {\n      \"[0]\": \"U+25ee8,...,U+2f9f4\",\n      \"[1]\": \"U+1f235-1f23b,...,U+25ed8\",\n      ...\n      \"[119]\": \"U+20,...,U+ff0e\"\n      },\n    \"variants\": {\n      \"100\": {\n        \"normal\": {\n          \"[0]\": {\n            \"url\": {\n              \"woff2\": \"https://fonts.gstatic.com/s/notosansjp/v42/-F6ofjtqLzI2JPCgQBnw7HFQoggPkENvl4B0ZLgOquiXidBa3qHiDcp2RQ.0.woff2\",\n              \"woff\": \"https://fonts.gstatic.com/s/notosansjp/v42/-F62fjtqLzI2JPCgQBnw7HFoxQII2lcnk-AFfrgQrvWXpdFg3KXxAMsKMbdN.0.woff\",\n              \"opentype\": \"https://fonts.gstatic.com/s/notosansjp/v42/-F6ofjtqLzI2JPCgQBnw7HFQoggM.otf\"\n            }\n          },\n          ...,\n        },\n        ...,\n      }\n    }\n  }\n...\n}\n```\n\n## APIVariable\n\nScrapes the Google Fonts directory and uses the Google Fonts API to generate all the relevant axis definitions and download variant metadata. You can learn more variable font axis' [here](https://fonts.google.com/variablefonts).\n\nThere are 3 default variants:\n\n-   `wght` - Only links to font files that only have the `wght` axis.\n-   `standard` - A default set of fonts that includes `wght, wdth, slnt, opsz` axis' if available.\n-   `full` - Links to font files that have all the axis' included within them.\n\nFurthermore, a variant is generated for each unique axis in the font, e.g. if `wdth` exists, `variants.wdth.normal.latin` will exist. Note that the `wght` axis is also included in each unique custom variant.\n\nNote that `standard` or `full` variants may not exist if there are no relevant axes in the font for that classification. This is to prevent duplicate variants with different names.\n\nExports [`data/variable.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/variable.json).\n\n```json\n{\n...\n\"akshar\": {\n    \"family\": \"Akshar\",\n    \"id\": \"akshar\",\n    \"axes\": {\n      \"wght\": { \"default\": \"400\", \"min\": \"300\", \"max\": \"700\", \"step\": \"1\" }\n    },\n    \"variants\": {\n      \"wght\": {\n        \"normal\": {\n          \"devanagari\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpR5lhOc.woff2\",\n          \"latin-ext\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCqh5lhOc.woff2\",\n          \"latin\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpB5l.woff2\"\n        }\n      },\n      \"full\": {\n        \"normal\": {\n          \"devanagari\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpR5lhOc.woff2\",\n          \"latin-ext\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCqh5lhOc.woff2\",\n          \"latin\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpB5l.woff2\"\n        }\n      },\n      \"standard\": {\n        \"normal\": {\n          \"devanagari\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpR5lhOc.woff2\",\n          \"latin-ext\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCqh5lhOc.woff2\",\n          \"latin\": \"https://fonts.gstatic.com/s/akshar/v5/Yq6V-LyHWTfz9rGCpB5l.woff2\"\n        }\n      }\n    }\n  },\n...\n}\n```\n\nNote that certain fonts such as Inter or Recursive have the SLNT axis, meaning their `font-style` in CSS won't be `normal` or `italic` on property `full` but `oblique x deg x deg`. Refer to the [CSS test fixture](https://github.com/fontsource/google-font-metadata/blob/v4/tests/fixtures/variable-parser/recursive-slnt-normal.css) for Recursive. While still showing as `normal` in metadata, it is up to the developer to include the `oblique` style if they are generating CSS using the `min` and `max` values from `recursive.axes.slnt` property.\n\n### APIDirect and APIVariableDirect\n\nThese are arrays of generated objects from the `npx gfm generate [key]` command. It is unlikely you will use this.\n\n```ts\nimport { APIDirect, APIVariableDirect } from \"google-font-metadata\";\nconst { APIDirect, APIVariableDirect } = require(\"google-font-metadata\");\n```\n\nExports [`data/api-response.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/api-response.json) and [`data/variable-response.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/variable-response.json) respectively.\n\n## APILicense\n\nScrapes the [Google Fonts Attribution](https://fonts.google.com/attribution) page and returns a readable object.\n\n```json\n{\n...\n  \"abel\": {\n    \"id\": \"abel\",\n    \"authors\": {\n      \"copyright\": \"Copyright 2011, Matthew Desmond with Reserved Font Name Abel.\",\n      \"website\": \"http://www.madtype.com\",\n      \"email\": \"mattdesmond@gmail.com\"\n    },\n    \"license\": {\n      \"type\": \"SIL Open Font License, 1.1\",\n      \"url\": \"http://scripts.sil.org/OFL\"\n    },\n    \"original\": \"Copyright (c) 2011, Matthew Desmond (http://www.madtype.com | mattdesmond@gmail.com), with Reserved Font Name Abel.\"\n  },\n...\n}\n```\n\nExports [`data/licenses.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/licenses.json)\n\n## APIRegistry\n\n```json\n{\n...\n  {\n    \"name\": \"Thick Stroke\",\n    \"tag\": \"XOPQ\",\n    \"min\": -1000,\n    \"max\": 2000,\n    \"default\": 88,\n    \"precision\": 0\n  },\n...\n}\n```\n\nExports [`data/axis-registry.json`](https://github.com/fontsource/google-font-metadata/tree/main/data/axis-registry.json)\n\nYou can refer to [`src/index.ts`](https://github.com/fontsource/google-font-metadata/blob/main/src/index.ts) and [`src/data.ts`](https://github.com/fontsource/google-font-metadata/blob/main/src/data.ts) to see all exports.\n\n## Updating API Files\n\nYou can use the `gfm` CLI tool to update the metadata with fresh results from the Google APIs.\n\n`npx gfm generate [key]` - Fetches the default Google Fonts API which can be used for parsing later. This has to be called before `npx gfm parse`.\n\nFlags:\n\n-   `-n, --normal` - Only fetch the normal Google Developer API for APIv1 and APIv2.\n-   `-v, --variable` - Only scrape the variable axis page for APIVariable. Note `key` does not need to be given if this option is passed.\n\nYou are able to get a Google Fonts API `key` value from [here](https://console.developers.google.com/apis/credentials). Alternatively, you can use a `.env` file with `API_KEY=keyvalue` instead of providing a key argument in the command.\n\n##\n\n`npx gfm parse` - Parses through the Google Fonts CSS API and generate full metadata using the `generate` command data.\n\nFlags:\n\n-   `-1, --v1` - Only parse and update APIv1.\n-   `-2, --v2` - Only parse and update APIv2.\n-   `-v, --variable` - Only parse and update APIVariable.\n-   `-l, --license` - Only parse and update APILicense.\n-   `-f, --force` - This skips the cache and force parses every font.\n-   `--no-validate` - This skips invoking `npx gfm validate` after finishing parsing.\n\n##\n\n`npx gfm validate` - Helper command to validate your existing metadata with a schema. This is automatically invoked with `npx gfm parse`.\n\nFlags:\n\n-   `-1, --v1` - Only validate APIv1.\n-   `-2, --v2` - Only validate APIv2.\n-   `-v, --variable` - Only validate APIVariable.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffontsource%2Fgoogle-font-metadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffontsource%2Fgoogle-font-metadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffontsource%2Fgoogle-font-metadata/lists"}