حجم الخط ووزنه ونمطه
اجعل النص عريضًا أو مائلًا وبالحجم المناسب
حجم الخط ووزنه ونمطه درس مجاني في Jetpack Compose Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Jetpack Compose Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
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. 🎨
الأسئلة الشائعة
هل درس «حجم الخط ووزنه ونمطه» مجاني؟
نعم — نص درس «حجم الخط ووزنه ونمطه» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Jetpack Compose Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.
ماذا ستتعلم في «حجم الخط ووزنه ونمطه»؟
اجعل النص عريضًا أو مائلًا وبالحجم المناسب تتمرن على Jetpack Compose Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Jetpack Compose Academy؟
لا تُشترط خبرة سابقة. Jetpack Compose Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «حجم الخط ووزنه ونمطه»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Jetpack Compose Academy هذا؟
نعم. كل درس في Jetpack Compose Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- Composable النص
- حجم الخط ووزنه ونمطه
- اللون والمحاذاة وتجاوز المساحة
- AnnotatedString: نص منسق مختلط