https://kotlinlang.org logo
#compose
Title
# compose
c

Colton Idle

01/17/2021, 9:38 PM
Should text size in sp be defined in "odd" numbers (not multiple of 4/8)? I know this isn't necessarily a compose thing, but I think in the past @nickbutcher has mentioned to stick to 8pt/dp rhythym. But I'm working on a compose app with a new designer and they really want to use 13sp as a font size and I think that's wrong because it doesn't multiply all that great. I know material has its own type scale that uses multiples of 4/8 but is it like "oh please don't set 13sp as a font size" or am I making this out to be worse than it really is and my designer can have a 13sp text size if they want?
i

Ian Lake

01/17/2021, 10:55 PM
The Material website talks extensively about the recommended text styles and their sizing: https://material.io/design/typography/the-type-system.html
c

Colton Idle

01/17/2021, 11:34 PM
Thanks. I'm familiar with that webpage (I tried to point it out with my question "material has its own type scale that uses multiples of 4/8" but I was still looking for any hard rules that basically say "using 13 or 21sp for a font size is a no-no in android land"
s

Siyamed

01/18/2021, 6:51 AM
The whole grid is 4x4 squares. Distances between baselines are on the grid. What i remember is that as long as the UI elements are fit onto that grid, that's material spec.
If the distances between text 'boxes' were based on bootom/top than the text would have to be multipliers of 4, but baseline to baseline distance of 4x changes that dynamic
The typography section says 'Line-height must be a value divisible by 4 to maintain the grid'
So they say that lineheight should be 4x, but no mention of fontsize, which then can be 4x-1, which is odd :)
But i believe you have to set lineheight based on that info, if fontsize is not 4x.
c

Colton Idle

01/18/2021, 2:21 PM
Thanks @Siyamed that helps!
5 Views