Skip to content
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

Update imports to the variable font beta #4616

Merged
merged 28 commits into from
Jan 12, 2023

Conversation

ClementChaumel
Copy link
Contributor

Done

Update imports to the variable font beta

The change seems not to be enough, when I look at the network tab I can see that the static font still gets downloaded instead of the variable one

image

Not sure where else I should make the change

@ClementChaumel
Copy link
Contributor Author

Ok it imports correctly now but I'm still not sure it uses the variable font as the
font-variation-settings: "wght" 350, "wdth" 73; declaration has no effect whatsoever

@bartaz
Copy link
Contributor

bartaz commented Dec 6, 2022

@bartaz
Copy link
Contributor

bartaz commented Dec 6, 2022

font-display: $font-display-option;
font-family: 'Ubuntu';
font-style: normal;
font-weight: $font-weight-regular-text;
Copy link
Contributor

Choose a reason for hiding this comment

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

@ClementChaumel could you try remove this? Maybe this is making the font "fixed" on some font weight, instead of being flexible?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or we could specify range between 100 and 600?
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight

Copy link
Contributor

Choose a reason for hiding this comment

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

remove it from fontfaces declarations, set it individually in each heading I would say

Copy link
Contributor

Choose a reason for hiding this comment

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

It is set on each heading, we need to let browser know which weights are supported by this particular font.

@ClementChaumel
Copy link
Contributor Author

Hey, I added a little tester to display the difference in behaviour between a variable font from google font and ours
https://vanilla-framework-4616.demos.haus/docs/examples/base/variable-font-test

image

One thing I noticed is that to import the font like that from GF you need to explicitly ask for a range using .. like so wght@200..800

I don't know why the ubuntu font ignores the font-variation-settings property entirely though

@fitojb
Copy link
Contributor

fitojb commented Dec 30, 2022

Fantastic! It finally solves the fake-weight issue when using Bold (700), and it renders crisp and clear on Ubuntu. It's just missing hinting for Windows (in the interpolated weights) and interpolation to Thin (100) in the Italic style.

@fitojb
Copy link
Contributor

fitojb commented Jan 9, 2023

In https://vanilla-framework-4616.demos.haus/docs/base/typography#:~:text=Edit%20on%20CodePen-,Strong%20text,-Strong%20text
I think the weight difference when using <strong> needs to be a bit more prominent than it is now. Not an issue that manifested using the static fonts
image

@lyubomir-popov
Copy link
Contributor

@fitojb good catch, we need to point the $font-weight-bold variable to the 500 weight, it is currently set to 400. cc @ClementChaumel

scss/_base_code.scss Outdated Show resolved Hide resolved
scss/_base_fontfaces.scss Outdated Show resolved Hide resolved
scss/_base_forms.scss Outdated Show resolved Hide resolved

{% block content %}
<style>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wdth,wght@0,75..100,300..800;1,75..100,300..800&display=swap');
Copy link
Contributor

Choose a reason for hiding this comment

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

drop the unnecessary import

<style>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wdth,wght@0,75..100,300..800;1,75..100,300..800&display=swap');

.mono{
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need custom class names?

I guess we can simply use built-in stuff, like <em> for italic and <code> for mono?

<input id="weight" type="range" min="200" max="800" value="300" step="1" style="appearance: auto" oninput="doTheThing()">
<label>Width</label>
<input id="width" type="range" min="75" max="100" value="100" step="1" style="appearance: auto" oninput="doTheThing()">
<label>Italic</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to do anything, can we drop that?

@bartaz
Copy link
Contributor

bartaz commented Jan 10, 2023

TODO:

  • update to latest font files
  • update docs in typography
  • update docs in settings fonts
  • bump version to 3.10
  • update what's new page with new font information
  • update status labels in side bar navigation (remove current ones, add "updated" to typography page - unless there is any better page about font)

font-stretch: 100%; /* min and max value for the width axis, expressed as percentage */
font-style: italic;
font-weight: 100 800; /* min and max value for the weight axis */
src: url('#{$assets-path}c1b12cdf-Ubuntu-Italic[wdth,wght]-latin (1).woff2') format('woff2-variations');
Copy link
Contributor

@bartaz bartaz Jan 11, 2023

Choose a reason for hiding this comment

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

Could we avoid having unnecessary stuff in font URLs?

Having spaces and (1) caused by downloading same name multiple times looks messy and may cause URL encoding issues.
I know that right now it means uploading it again probably, unless someone from backend guys can help us renaming those on asset server.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's important these URLs look clean and clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh my bad I didn't think it mattered. Do we want to agree on a format before I reupload them?

@ClementChaumel ClementChaumel force-pushed the WD-830-create-a-vanilla-branch-to-test-new-font branch from d77dbc2 to 16a41b9 Compare January 11, 2023 15:56
@lyubomir-popov
Copy link
Contributor

Well done @ClementChaumel and @bartaz

Copy link
Contributor

@bartaz bartaz left a comment

Choose a reason for hiding this comment

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

Good to go!

@ClementChaumel ClementChaumel merged commit 29d0e09 into main Jan 12, 2023
@ClementChaumel ClementChaumel deleted the WD-830-create-a-vanilla-branch-to-test-new-font branch January 12, 2023 13:45
@fitojb
Copy link
Contributor

fitojb commented Jan 13, 2023

Very happy with the improved weight distribution and proportions of the Mono font. Excellent overall

@rink-grey
Copy link

@fitojb may i ask how can i get the fixed Ubuntu Mono font file, thanks

@bartaz
Copy link
Contributor

bartaz commented Feb 5, 2024

@rink-grey Ubuntu fonts (including Mono) are available on Google fonts: https://fonts.google.com/?query=Ubuntu (although it may not be the latest variable font version yet)

Latest available font files are in our repos https://github.com/canonical/Ubuntu-Sans-fonts https://github.com/canonical/Ubuntu-Sans-Mono-fonts

@rink-grey
Copy link

@bartaz thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants