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

[css-fonts-4] Better example needed for font-size-adjust #2859

Closed
svgeesus opened this issue Jul 2, 2018 · 7 comments
Closed

[css-fonts-4] Better example needed for font-size-adjust #2859

svgeesus opened this issue Jul 2, 2018 · 7 comments

Comments

@svgeesus
Copy link
Contributor

svgeesus commented Jul 2, 2018

The example for font-size-adjust is basically a hack explaining how to iteratively determine a vaue for a given font.

It would be better replaced with an example that shows the nice result when the property is correctly applied.

@fantasai fantasai added the css-fonts-4 Current Work label Jul 24, 2018
@svgeesus svgeesus self-assigned this Nov 27, 2018
@matthew-dean
Copy link

matthew-dean commented Nov 30, 2018

That whole section is utterly confusing.

Figure 11: Text with and without the use of font-size-adjust

The use of font-size-adjust how???

p {
  font-family: Verdana, Futura, Times;
  font-size-adjust: ??? 
}

@svgeesus
Copy link
Contributor Author

svgeesus commented Dec 2, 2018

A good example would have two rules, setting different elements in two different font faces, which have very different x-heights. It would then use font-size-adjust to make the x-heights more similar.

@tigt
Copy link

tigt commented Nov 8, 2019

I made an example of this property at https://codepen.io/tigt/pen/MaeJEK

It’s not quite perfect for your needs, as it also uses SVG’s textLength, but I figured it might be useful as an organic “in the wild” example from a web dev.

@svgeesus
Copy link
Contributor Author

svgeesus commented Dec 4, 2019

Hmm, this is a bit hand-wavy, too:

This value applies to any font that is selected but in typical usage it should be based on the aspect value of the first font in the font-family list.

What does "any font that is selected" mean? The same wording was in CSS Fonts 3.

@svgeesus
Copy link
Contributor Author

svgeesus commented Dec 4, 2019

I put the old example from Fonts 3 into a codepen, calculated the x-height for Verdana and for Times New Roman, then used those values in the earlier example to make it clearer.

@svgeesus
Copy link
Contributor Author

svgeesus commented Dec 4, 2019

@matthew-dean the first example now reads

p {
	font-family: Verdana, Futura, Times;
}
p.adj {
	font-size-adjust: 0.545;
}

<p>Lorem ipsum dolor sit amet, ...</p>
<p class="adj">Lorem ipsum dolor sit amet, ...</p>

@dberlow
Copy link

dberlow commented Dec 18, 2019

From www.w3.org/TR/css-fonts-4/#font-size-adjust-prop ..."This is commonly referred to as the aspect value and is equal to the x-height of a font divided by the font size."

Besides never having heard this term, "aspect value", I believe strongly that the documentation is incorrect. The scale value to match x-heights across fonts is determined by creating a ratio of the x-ht (in units per em) to units per em, to reach the fallback scale value between two such values.

The "font size", as I understand the term is not used.

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

No branches or pull requests

5 participants