Skip to content

Commit

Permalink
Self-host "Roboto" font assets
Browse files Browse the repository at this point in the history
This change ends the project's reliance on Google Fonts as a remote font
asset host.

Roboto is released under the SIL Open Font License, Version 1.1:
https://github.com/googlefonts/roboto-3-classic/?tab=OFL-1.1-1-ov-file

The initial TTF font files were downloaded from GitHub:
https://github.com/googlefonts/roboto-3-classic/releases/tag/v3.010

Then I ran `ftcli converter ft2wf --flavor woff2` on the files from the
`web` directory to generate `woff2` files:
https://ftcli.github.io/FoundryTools-CLI/commands/ftcli_converter.html
  • Loading branch information
adamzap committed Feb 13, 2025
1 parent a59e8e5 commit e7ab2f6
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 4 deletions.
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">

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

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

0 comments on commit e7ab2f6

Please sign in to comment.