Skip to content

Self-host "Roboto" font assets #1949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions djangoproject/scss/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,41 @@ $logo-bg-dark: #272c27;

// @font-face declarations

@font-face {
font-family: 'Roboto';
src: url('#{$font-path}/Roboto-Regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('#{$font-path}/Roboto-Italic.woff2') format('woff2');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('#{$font-path}/Roboto-Bold.woff2') format('woff2');
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src: url('#{$font-path}/Roboto-BoldItalic.woff2') format('woff2');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'Roboto';
src: url('#{$font-path}/Roboto-Light.woff2') format('woff2');
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: 'Fira Mono';
src: url('#{$font-path}/FiraMono-Regular.woff2') format('woff2');
Expand Down
Binary file added djangoproject/static/fonts/Roboto-Bold.woff2
Binary file not shown.
Binary file not shown.
Binary file added djangoproject/static/fonts/Roboto-Italic.woff2
Binary file not shown.
Binary file added djangoproject/static/fonts/Roboto-Light.woff2
Binary file not shown.
Binary file added djangoproject/static/fonts/Roboto-Regular.woff2
Binary file not shown.
4 changes: 0 additions & 4 deletions djangoproject/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@

<title>{% block title %}The web framework for perfectionists with deadlines{% endblock %} | Django</title>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we parse the ital,wght@0,300;0,400;0,700;1,400;1,700 part of the URL, we get the following font variants:

  1. Light (not italic, weight 300)
  2. Regular (not italic, weight 400)
  3. Bold (not italic, weight 700)
  4. (Regular) Italic (italic, weight 400)
  5. Bold Italic (italic, weight 700)


<link rel="stylesheet" href="{% static "css/output.css" %}" >

<script src="{% static "js/mod/switch-dark-mode.js" %}"></script>
Expand Down