Expand description
The system font-size setting, as the curve it is and not the multiplier it looks like.
A size in Sp used to be sp * font_scale dp, and on Android 13 and below
that is exactly what the platform does. Android 14 replaced it: above a
threshold setting the platform runs the sp value through a piecewise-linear
table, so small text grows by the full setting and large text grows by less.
TypedValue.applyDimension(COMPLEX_UNIT_SP, ..) answers from that table, and
Jetpack Compose carries its own copy so its Density answers the same.
Measured on a Wear OS 5 emulator at density 2.0 with the setting at 1.24
(TypedValue.applyDimension and androidx.compose.ui.unit.Density(context)
agree to the last bit on every sample):
| sp | multiplied | platform |
|---|---|---|
| 12 | 29.76 px | 29.76 px |
| 13 | 32.24 px | 32.72 px |
| 14 | 34.72 px | 35.68 px |
| 16 | 39.68 px | 38.72 px |
| 19 | 47.12 px | 43.76 px |
So multiplying is wrong in both directions at once, and by enough to change
where a line wraps. A FontScaleCurve carries the platform’s answer
instead: the host samples the real conversion when the configuration says it
changed, and everything that resolves an Sp goes through
FontScaleCurve::sp_to_dp.
Off Android, and on an Android below the version that has a table, the curve
holds no knots and sp_to_dp is the multiplication again — which is what
those platforms actually do.
Structs§
- Font
Scale Curve - The sp → dp conversion the platform performs, sampled from the platform.
Constants§
- MAX_
FONT_ SCALE_ KNOTS - How many knots a curve keeps.