> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/ar/mqalat-mtamqh/39-step-3-replacing-latex-s-default-fonts-with-variable-fonts.md).

# الخطوة 3: استبدال الخطوط الافتراضية في LaTeX بالخطوط المتغيرة

[مقدمة](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [الخطوة 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [الخطوة 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [الخطوة 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [الخطوة 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [الخطوة 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [الخطوة 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [الخطوة 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [الخطوة 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [أمثلة ومشاريع](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)

في هذه الخطوة، نقدم ثلاثة أوامر من حزمة fontspec ستُستخدم لاستبدال الخطوط الافتراضية في LaTeX بخطوط متغيرة.

## استخدام fontspec لتغيير الخطوط الافتراضية في LaTeX

سنستخدم أوامر حزمة fontspec التالية لاستبدال الخطوط الافتراضية في LaTeX بخطوط متغيرة من اختيارنا:

* `\setmainfont{⟨font⟩}[⟨font features⟩]` يضبط الخط المستخدم لنص المستند الرئيسي.
* `\setsansfont{⟨font⟩}[⟨font features⟩]` يضبط خط بلا زوائد.
* `\setmonofont{⟨font⟩}[⟨font features⟩]` يضبط الخط أحادي المسافة.

لكل واحد من هذه الأوامر مكونان:

* `⟨font⟩`: وسيط مطلوب، يوضع بين الأقواس المعقوفة `{...}`، ويحدد الخط الذي نريد استخدامه، على هيئة اسم خط أو اسم ملف خط.
* `⟨font features⟩`: وسيط اختياري، يوضع بين الأقواس المربعة `[...]`، ويُستخدم لتفعيل ميزات خاصة بالخط، بما في ذلك إعداد الخطوط المتغيرة.

سيتم شرح هذه الأوامر بمزيد من التفصيل لاحقًا في هذا الدرس.

## كيفية تفعيل الخطوط المتغيرة لمشروع الدرس

اتبع هذه الخطوات لتفعيل الخطوط المتغيرة الخاصة بالمشروع واستخدامها.

1. افتح مشروع الدرس الأولي وحدّثه بلصق الشفرة التالية في مقدمة المستند—الصقها بعد السطر `\usepackage{fontspec}`.

```latex
% خط نص المستند الرئيسي للعائلة
\setmainfont{NotoSerif-VariableFont-wdth-wght.ttf}
% خط المستند العائلي بلا تذييلات
\setsansfont{NotoSans-VariableFont-wdth-wght.ttf}
% خط المستند العائلي أحادي المسافة
\setmonofont{RobotoMono-VariableFont-wght.ttf}
```

![صورة توضح مكان لصق كود LaTeX في مقدمة المستند](/files/e61c8df3e0905acdc019a6122fba758518f9370e)

4. أعد ترجمة المشروع المحدّث لتنسيقه باستخدام الخطوط المتغيرة. ينبغي أن تلاحظ المشكلات التالية:

* المستند المنسق لم يعد يحتوي على أي نص غامق أو مائل.
* هناك ثلاثة تحذيرات من «أشكال خط غير معرّفة»:

![صورة توضح تحذيرات الخط المفقود في LaTeX.](/files/803b754a2143c76152f2fec6420be78a51b244ec)

## لماذا أرى تحذيرات «شكل غير معرّف»؟

إعدادنا الأولي للخطوط المتغيرة هو *جدًا* بسيط، يفعّل الخطوط المستقيمة ذات الوزن المتوسط فقط. ونتيجةً لذلك، يصدر LaTeX تحذيرات «شكل غير معرّف»، ليخبرك بأنه لم يعد لديه إمكانية الوصول إلى الخطوط اللازمة لتنسيق النص الغامق، والغـامق المائل، والمائل العادي المستخدم في مستندنا.

## فهم تحذيرات «الشكل غير المعرّف» في LaTeX

كما أوضحنا في الخطوة 2، يصنّف LaTeX كل خط نصي وفق خمس سمات: الترميز، والعائلة، والسلسلة، والشكل، والحجم. إذا حاولت استخدام خط لا تتوافق مجموعة سماته—الترميز، والعائلة، والسلسلة، والشكل—مع خط «حقيقي» معروف، فسوف يصدر LaTeX تحذير «شكل مفقود». يمكن منع هذه التحذيرات عبر تهيئة خط بالسمات المطلوبة.

### بنية هذه التحذيرات

لكل تحذير البنية التالية

``شكل الخط `*encoding/family name/series/shape*' غير معرّف``

كما هو موضح في هذا الرسم:

![صورة توضح بنية تحذيرات الشكل المفقود في LaTeX](/files/8308faa4159d0fabf8fb6aa5797522dafccd04de)

### ماذا تخبرنا هذه التحذيرات؟

سيتم شرح كل تحذير من التحذيرات التالية أدناه.

![صورة توضح تحذيرات الخط المفقود في LaTeX.](/files/803b754a2143c76152f2fec6420be78a51b244ec)

1. **``شكل الخط `TU/NotoSerif-VariableFont-wdth-wght.ttf(0)/b/n' غير معرّف``**

لا يملك LaTeX إمكانية الوصول إلى خط بهذه المجموعة التالية من السمات:

* *الترميز*: **`TU`** (Unicode).
* *عائلة*: `**NotoSerif-VariableFont-wdth-wght.ttf(0)**`—اسم عائلة طويل أنشأته حزمة fontspec عندما استخدمنا الأمر \setmainfont. سنستكشف أسماء العائلات لاحقًا في هذه السلسلة.
* *السلسلة*: **`b`** → **b**غامق *الوزن*, **m**متوسط *width* (الـ **m** يُحذف).
* الشكل: **`n`** → **n**عادي (مستقيم) *شكل.*

يفتقر LaTeX إلى **b**وزن غامق، **m**عرض متوسط (السلسلة)، و **n**خط ذي شكل عادي (مستقيم) في عائلة `NotoSerif-VariableFont-wdth-wght.ttf(0)` .

4. **``شكل الخط `TU/NotoSerif-VariableFont-wdth-wght.ttf(0)/b/it' غير معرّف``**

لا يملك LaTeX إمكانية الوصول إلى خط بهذه المجموعة التالية من السمات:

* *الترميز*: **`TU`** (Unicode).
* *عائلة*: `**NotoSerif-VariableFont-wdth-wght.ttf(0)**`*.*
* *السلسلة*: `**b**` → **b**وزن غامق، **m**عرض متوسط (الـ **m** يُحذف).
* *الشكل*: it → شكل مائل.

يفتقر LaTeX إلى **b**وزن غامق، **m**عرض متوسط (السلسلة) **it**خط مائل (الشكل) في عائلة `NotoSerif-VariableFont-wdth-wght.ttf(0)` .

8. ``**شكل الخط `TU/NotoSerif-VariableFont-wdth-wght.ttf(0)/m/it' غير معرّف**``

لا يملك LaTeX إمكانية الوصول إلى خط بهذه المجموعة التالية من المعلمات:

* الترميز: TU (Unicode)
* العائلة: NotoSerif-VariableFont-wdth-wght.ttf(0)
* السلسلة: m → وزن متوسط، عرض متوسط (لاحظ استخدام m واحدة)
* الشكل: it → شكل مائل

يفتقر LaTeX إلى خط مائل (الشكل) ذي وزن متوسط وعرض متوسط في عائلة NotoSerif-VariableFont-wdth-wght.ttf(0).

## في الخطوة التالية

في الخطوات 4 إلى 6 سنصلح هذه التحذيرات عبر تهيئة خطوطنا المتغيرة لتوفير أشكال الخط المفقودة.

[مقدمة](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [الخطوة 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [الخطوة 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [الخطوة 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [الخطوة 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [الخطوة 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [الخطوة 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [الخطوة 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [الخطوة 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [أمثلة ومشاريع](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/ar/mqalat-mtamqh/39-step-3-replacing-latex-s-default-fonts-with-variable-fonts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
