Font Size, Weight & Style
Make text bold, italic, and the right size.
Font Size, Weight & Style is a free Jetpack Compose Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Jetpack Compose Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Style Your Text
Plain words are fine, but real apps need emphasis. Text accepts simple arguments to control size, weight, and style without any XML.
Set the Size
Use fontSize to make text bigger or smaller. Sizes use the sp unit, which respects the user accessibility font settings.
Text("Big title", fontSize = 24.sp)Why sp, Not dp
Text uses sp so it scales with the system font size. Layout uses dp, but words should grow when a user prefers larger text.
Make It Bold
Reach for fontWeight when you want emphasis. FontWeight.Bold is the everyday choice for titles and important labels.
Text("Headline", fontWeight = FontWeight.Bold)Weights Are a Scale
Weight is more than bold or not. FontWeight ranges from Light to Black, so you can dial in exactly the emphasis a design asks for.
FontWeight.Light
FontWeight.Medium
FontWeight.BlackAdd Italics
Slant your text with fontStyle. FontStyle.Italic is great for quotes, captions, or a subtle hint of personality.
Text("a note", fontStyle = FontStyle.Italic)Mix Them Together
These arguments combine freely. One Text call can be large, bold, and italic at once, all in a single readable line of code. 🙂
Text("Wow", fontSize = 20.sp,
fontWeight = FontWeight.Bold)Change the Font Family
Swap the typeface with fontFamily. Built-ins like Serif and Monospace ship for free, and you can load custom fonts too.
Text("code", fontFamily = FontFamily.Monospace)Letter Spacing
For airy, polished headings, nudge letterSpacing. A little extra space between characters can make uppercase titles feel premium.
Text("MENU", letterSpacing = 2.sp)Lean on Theme Styles
Instead of setting each value, pass a ready-made style from MaterialTheme. It keeps every screen visually consistent.
Text("Title", style = MaterialTheme.typography.titleLarge)Small Touches, Big Polish
Size, weight, and style are tiny arguments, but together they turn flat text into a clear hierarchy users instantly understand.
Quick Check
Which unit should you give to fontSize, and why?
Recap
You styled text with fontSize, fontWeight, fontStyle, and family. Use sp for sizing, and prefer theme typography for a consistent look. 🎨
Frequently asked questions
Is the “Font Size, Weight & Style” lesson free?
Yes — the full text of “Font Size, Weight & Style” is free to read here on the web, and the Jetpack Compose Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Jetpack Compose Academy course, upgrade to CoddyKit PRO.
What will I learn in “Font Size, Weight & Style”?
Make text bold, italic, and the right size. You practise Jetpack Compose Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Jetpack Compose Academy?
No prior experience is required. Jetpack Compose Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Font Size, Weight & Style” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Jetpack Compose Academy lesson?
Yes. Every Jetpack Compose Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The Text Composable
- Font Size, Weight & Style
- Color, Alignment & Overflow
- AnnotatedString: Rich Mixed Text