Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@fontsource/roboto
Advanced tools
@fontsource/roboto is an npm package that allows you to self-host the Roboto font in your web projects. It provides a convenient way to include the Roboto font family in your application without relying on external CDNs. This package supports various font weights and styles, making it versatile for different design needs.
Basic Usage
This code imports the default Roboto font into your project. It includes the regular weight and normal style.
import '@fontsource/roboto';
Specific Font Weight
This code imports the Roboto font with a weight of 500. You can specify different weights by changing the number in the import path.
import '@fontsource/roboto/500.css';
Specific Font Style
This code imports the italic style of the Roboto font. You can combine this with different weights as needed.
import '@fontsource/roboto/italic.css';
Advanced Usage with CSS
This code imports the Roboto font with a weight of 500 and italic style. This is useful for more advanced typography needs.
import '@fontsource/roboto/500-italic.css';
The typeface-roboto package is another option for self-hosting the Roboto font. It offers similar functionality to @fontsource/roboto but is part of the older 'typeface' package series. It may not be as actively maintained as @fontsource/roboto.
The fontsource-open-sans package allows you to self-host the Open Sans font, which is another popular sans-serif typeface. It offers similar features to @fontsource/roboto, including support for various weights and styles.
The fontsource-lato package provides the Lato font family for self-hosting. Like @fontsource/roboto, it supports multiple weights and styles, making it a versatile choice for web typography.
The CSS and web font files to easily self-host the “Roboto” font. Please visit the main Fontsource website to view more details on this package.
Fontsource has a variety of methods to import CSS, such as using a bundler like Webpack. Alternatively, it supports SASS. Full documentation can be found here.
yarn add @fontsource/roboto // npm install @fontsource/roboto
Within your app entry file or site component, import it in.
import "@fontsource/roboto"; // Defaults to weight 400.
Supported variables:
[100,300,400,500,700,900]
[italic,normal]
[cyrillic,cyrillic-ext,greek,greek-ext,latin,latin-ext,vietnamese]
Finally, you can reference the font name in a CSS stylesheet, CSS Module, or CSS-in-JS.
body {
font-family: "Roboto";
}
It is important to always read the license for every font that you use. Most of the fonts in the collection use the SIL Open Font License, v1.1. Some fonts use the Apache 2 license. The Ubuntu fonts use the Ubuntu Font License v1.0.
Google Fonts License Attributions
Font version (provided by source): v29
.
Feel free to star and contribute new ideas to this repository that aim to improve the performance of font loading, as well as expanding the existing library we already have. Any suggestions or ideas can be voiced via an issue.
FAQs
Self-host the Roboto font in a neatly bundled NPM package.
The npm package @fontsource/roboto receives a total of 0 weekly downloads. As such, @fontsource/roboto popularity was classified as not popular.
We found that @fontsource/roboto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.