Fonts.
Search the Google Fonts catalog and
download font files. cc.me indexes a local clone of the repository and serves it over a
small JSON API with an open CORS policy, so any page can look up families and fetch
.ttf files directly.
Search
GET /fonts with a query returns matching families. All parameters are
optional: q matches the family name or slug, category and
subset filter, and limit (max 100) / offset
paginate. An empty query lists everything.
GET /fonts?q=roboto&category=SANS_SERIF&subset=latin&limit=2
{
"total": 18,
"count": 2,
"offset": 0,
"limit": 2,
"families": [
{
"slug": "roboto",
"name": "Roboto",
"license": "apache",
"category": "SANS_SERIF",
"designer": "Christian Robertson",
"subsets": ["latin", "cyrillic"],
"variable": true,
"files": [
{
"filename": "Roboto[wdth,wght].ttf",
"style": "normal",
"weight": 400,
"path": "/fonts/roboto/Roboto[wdth,wght].ttf"
}
]
}
]
}
Family
GET /fonts/<slug> returns one family with the same fields plus its
variable-font axes.
GET /fonts/roboto
{
"slug": "roboto",
"name": "Roboto",
"variable": true,
"files": [ "…" ],
"axes": [
{ "tag": "wght", "min": 100, "max": 900 }
]
}
Download
GET /fonts/<slug>/<filename> returns the font file with the right
font/* content type and a long Cache-Control. Use a
filename from the family's files list; anything else is a
404.
GET /fonts/roboto/Roboto%5Bwdth,wght%5D.ttf
Load one straight into a page with the CSS Font Loading API or an @font-face:
@font-face {
font-family: "Roboto";
src: url("https://cc.me/fonts/roboto/Roboto%5Bwdth,wght%5D.ttf") format("truetype");
}
Errors
404- Unknown family slug, or a filename not listed for that family.