{"id":13423600,"url":"https://github.com/r-lib/systemfonts","last_synced_at":"2025-05-15T11:06:24.716Z","repository":{"id":34983981,"uuid":"190163549","full_name":"r-lib/systemfonts","owner":"r-lib","description":"System Native Font Handling in R","archived":false,"fork":false,"pushed_at":"2025-05-13T10:21:22.000Z","size":7117,"stargazers_count":93,"open_issues_count":8,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-13T11:24:49.298Z","etag":null,"topics":["fonts","rstats"],"latest_commit_sha":null,"homepage":"https://systemfonts.r-lib.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-06-04T08:45:46.000Z","updated_at":"2025-05-13T10:17:41.000Z","dependencies_parsed_at":"2022-08-09T08:36:49.584Z","dependency_job_id":"afc65f7c-d95b-4842-86c3-f548f0d38095","html_url":"https://github.com/r-lib/systemfonts","commit_stats":{"total_commits":274,"total_committers":10,"mean_commits":27.4,"dds":"0.12043795620437958","last_synced_commit":"e048bdc4adc660c7f12c7bf4943009169d22f62e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fsystemfonts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fsystemfonts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fsystemfonts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fsystemfonts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/systemfonts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253932290,"owners_count":21986353,"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","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","rstats"],"created_at":"2024-07-31T00:00:38.494Z","updated_at":"2025-05-15T11:06:24.710Z","avatar_url":"https://github.com/r-lib.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# systemfonts \u003ca href=\"https://systemfonts.r-lib.org\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" alt=\"systemfonts website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/systemfonts)](https://cran.r-project.org/package=systemfonts)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![R-CMD-check](https://github.com/r-lib/systemfonts/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/systemfonts/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/systemfonts/graph/badge.svg)](https://app.codecov.io/gh/r-lib/systemfonts)\n\u003c!-- badges: end --\u003e\n\nsystemfonts is a package that locates installed fonts. It uses the system-native libraries on Mac (CoreText) and Linux (FontConfig), and uses Freetype to parse the fonts in the registry on Windows.\n\n## Installation\nsystemfonts is available from CRAN using `install.packages('systemfonts')`. It\nis however still under development and you can install the development version\nusing devtools.\n\n```{r, eval=FALSE}\n# install.packages('pak')\npak::pak('r-lib/systemfonts')\n```\n\n## Examples\nThe main use of this package is to locate font files based on family and style:\n\n```{r}\nlibrary(systemfonts)\n\nmatch_fonts('Avenir', italic = TRUE)\n```\n\nThis function returns the path to the file holding the font, as well as the\n0-based index of the font in the file.\n\nIt is also possible to get a data.frame of all available fonts:\n\n```{r, include=FALSE}\nlibrary(tibble)\n```\n```{r}\nsystem_fonts()\n```\n\nFurther, you can query additional information about fonts and specific glyphs,\nif that is of interest using the `font_info()` and `glyph_info()` functions.\n\n### Custom fonts\nWhile the package was created to provide transparent access to fonts installed\non the system, it has grown to also provide ways to work with font files not\npart of the system installation. This is especially beneficial if you are\nrunning code on a system where you don't have administrator rights and need to\nuse a custom font.\n\nsystemfonts provide the `add_fonts()` function which takes a vector of file\npaths and add these to the lookup database without installing them. Further,\nsystemfonts automatically looks in the `./fonts` and `~/fonts` folders and adds\nany font files located there during startup. This means that you can distribute\na script along with a fonts directory and have those fonts automatically\navailable during execution of the script.\n\nIn addition to the above, systemfonts also provides access to online font\nrepositories such as [Google Fonts](https://fonts.google.com) and can search and\ndownload from these, automatically adding the downloaded fonts to the lookup\ndatabase.\n\nAll these functionalities are condensed into a single function,\n`require_font()`, which allows you to state a font dependency inside a script.\nThe function will first look for the font on the system, and failing that, will\ntry to fetch it from an online repository. If that fails it will either throw an\nerror or remap the font to another of the developers choosing.\n\n\n## C API\nWhile getting this information in R is nice, the intended use is mostly through\ncompiled code so that graphic devices can easily locate relevant font files etc.\n\nIn order to use functions from systemfonts in C(++) code your package should\nlist systemfonts in the `LinkingTo` field in the `DESCRIPTION` file. Once this\nis done you can now `#include \u003csystemfonts.h\u003e` in your code and use the provided\nfunctions. Look into the\n[`inst/include/systemfonts.h`](https://github.com/r-lib/systemfonts/blob/master/inst/include/systemfonts.h)\nfile to familiarise yourself with the C API.\n\n## System Defaults\nsystemfonts will always try to find a font for you, even if none exist with the\ngiven family name or style. How it resolves this is system specific and should\nnot be relied on, but it can be expected that a valid font file is always\nreturned no matter the input.\n\nA few special aliases exist that behaves predictably but system dependent:\n\n- `\"\"` and `\"sans\"` return *Helvetica* on Mac, *Arial* on Windows, and the\n  default sans-serif font on Linux (*DejaVu Sans* on Ubuntu)\n- `\"serif\"` return *Times* on Mac, *Times New Roman* on Windows, and the\n  default serif font on Linux (*DejaVu Serif* on Ubuntu)\n- `\"mono\"` return *Courier* on Mac, *Courier New* on Windows, and the\n  default mono font on Linux (*DejaVu Mono* on Ubuntu)\n- `\"emoji\"` return *Apple Color Emoji* on Mac, *Segoe UI Emoji* on Windows, and the\n  default emoji font on Linux (*Noto Color* on Ubuntu)\n\n## Code of Conduct\nPlease note that the 'systemfonts' project is released with a\n[Contributor Code of Conduct](https://github.com/r-lib/systemfonts/blob/master/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fsystemfonts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fsystemfonts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fsystemfonts/lists"}