Serve roboto and roboto-mono locally#57
Conversation
|
@noxpardalis Thanks a lot for this! It seems to work well. The only problem I see is we also need the bold font for @font-face {
font-family: Roboto;
font-weight: 700;
src: local("Roboto"), local("Roboto-Regular"), url(fonts/roboto/roboto-bold.woff2) format("woff2");
} |
|
@dantownsend you're very welcome! Good catch, indeed you would need something like that. I added both the bold and italic variants in 22a7dc3 (I can drop the italics if it's not needed). Originally |
|
Sorry to be super annoying, but I think we also use https://piccolo-orm.readthedocs.io/en/latest/piccolo/projects_and_apps/piccolo_projects.html#example |
|
No problems at all! I just included the bold variant for |
|
I've been looking at this some more, and this is the URL we used in the past: The response we get back from Google is this: /* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIXKMnyrYk.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIXKMnyrYk.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
... // And loads moreI realised it wasn't returning Roboto Mono.... I didn't realise because I have Roboto Mono installed on my laptop, and the mono font on iOS looks pretty similar. The URL that works is: https://fonts.googleapis.com/css?family=Roboto:italic,bold|Roboto+Mono&display=swap Anyway ... I realised we also need italic Roboto Mono, as that's what Pygments uses for Python comments. That just leaves bold-italic, which I don't think we need 🤔 Another Interesting thing is Sorry for the long comment - I hope it makes sense. |
|
Sounds, sound. Firstly, I'll include the italic variant for The
I guess they relegate CJK to the fonts made for it. It wouldn't be very difficult to also include coverage for the additional languages (just download the fonts, position them, and then copy the I wonder if there are any examples of people using the |
`roboto` and `roboto-mono` now include the same set of fonts so this commit also unifies the directory structure so it's consistent between the two fonts, i.e. ``` ├── roboto │ ├── LICENSE.txt │ ├── roboto-bold.woff2 │ ├── roboto-italic.woff2 │ └── roboto.woff2 └── roboto-mono ├── LICENSE.txt ├── roboto-mono-bold.woff2 ├── roboto-mono-italic.woff2 └── roboto-mono.woff2 ```
|
@dantownsend I added the italic variant for |
|
@noxpardalis Thanks for this - sorry for the slow reply. All looks good to me 👍 |
|
@noxpardalis Just released it, and was doing some testing on different devices. It's looking good, but found one edge case - in this code block it uses bold-italic: https://piccolo-theme.readthedocs.io/en/latest/demo.html#autodoc Not a rush, but if at some point you wouldn't mind creating a PR adding bold-italic too that would be great! |
Just opened a PR for adding the bold-italic variant for |
|
@noxpardalis No worries - thanks for the PR! |
First time contributing to
piccoloso I hope a fly-by pull request is okay 😃This addresses #56 by bundling the Roboto fonts with the static resources of the theme. I used Webfont Kit Generator to convert from the
ttffonts towoff2and then just point to them via@font-face.The results look okay to me (and crucially only load resources from
localhost) and the test passes when I run./scripts/run-testing.sh.