-
Notifications
You must be signed in to change notification settings - Fork 181
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
Modular Scale calculations #89
Comments
Be curious to hear more what you mean? This is the script for generating
|
The calculations I've used previously to generate a modular scale are p: base font size Using these inputs
The type scale generated looks something like this: p: 18px / 1em The two sites I mentioned above also give a similar result. p: 18px / 1rem I was wanting to know the method/reasoning typography.js uses to generate it's type scales. |
How I've setup Typography.js is that h1 equals the So the default There's an internal
Math.pow(scaleRatio, scaleValue) and then uses another internal function, adjustFontSizeTo to return the font size + line height to maintain vertical rhythm.
A scale value of 0 equals the body size. A scale value of 1 equals the h1 size (by convention, it's pretty arbitrary where on the scale you pick off sizes — you could have different scales that end up returning the same font sizes — but 0 — 1 is pretty easy to remember and has worked well for me). You can see where header sizes are defined here:
I used to have each header size equidistant but in the real world, most sites want more differentiation between h1/h2 and so h2 is now 0.6 on the scale instead of 0.8. So to recreate your example scale, just divide the h1 font size by the base to get the scale ratio for Typography.js or 42/18 == 2.333 |
Also this release notes might help as it was when a lot of these ideas crystalized https://github.com/KyleAMathews/typography.js/releases/tag/v0.8.3 |
Just wondering what calculations are used for the scales?
I've compared typography.js to a couple of sites I've referenced in the past and I've noticed that the output of typography.js isn't consistent with the other sites.
The sites I'm comparing are:
and the values I'm using are
font size: 18px / 1.25em
line height: 1.5
scale ratio: ~1.333
The text was updated successfully, but these errors were encountered: