> 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/fi/syvalliset-artikkelit/37-step-1-setting-up-an-overleaf-project-to-use-variable-fonts.md).

# Vaihe 1: Overleaf-projektin määrittäminen muuttujafonttien käyttöä varten

[Johdanto](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [Vaihe 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [Vaihe 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [Vaihe 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [Vaihe 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [Vaihe 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [Vaihe 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [Vaihe 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [Vaihe 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [Esimerkit ja projektit](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)

Aloittaaksesi tämän opastuksen, avaa [oheinen Overleaf-projekti](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d) joka sisältää seuraavat muuttuvat fontit:

* [Noto Serif](https://fonts.google.com/noto/specimen/Noto+Serif/tester) (pääasiakirjan teksti)
* [Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans/tester) (päätteetön fontti)
* [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono/tester) (tasalevyinen fontti)

Näitä fontteja ei ole vielä määritetty käyttöön. Aluksi, kun käännät [oheinen Overleaf-projekti](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d), LaTeXin oletusarvoiset tekstifontit otetaan käyttöön. Tämän opastuksen aikana opit korvaamaan nämä oletusfontit projektikansiossa nimellä `VariableFonts`.

Jos haluat mieluummin käyttää muita muuttuvia fontteja, seuraa alla olevia ohjeita. Muussa tapauksessa siirry [Vaihe 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) tähän opastukseen.

## (Valinnainen) Kuinka valita ja ladata omat muuttuvat fonttisi

Seuraa näitä vaiheita ladataksesi haluamasi muuttuvat fontit.

### 1. Hanki muuttuvat fontit Google Fontsista

[Google Fonts](https://fonts.google.com/) on erinomainen resurssi. Se tarjoaa [hyödyllistä dokumentaatiota](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) ja monia [vapaasti käytettäviä muuttuvia fontteja](https://fonts.google.com/?vfonly=true) jotka voidaan ladata Overleafiin ja määrittää käytettäväksi projekteissasi.

* **VINKKI**: Käytä Google Fonts -suodattimia löytääksesi muuttuvia fontteja. Aseta *Technology* suodatin arvoon *Variable* näyttääksesi vain muuttuvat fontit. Käytä lisäsuodattimia, kuten *Serif*, tarkentaaksesi hakua edelleen.

![Kuva, jossa näkyvät Google Fonts -hakusuodattimet](/files/012f5563025e14f8b9889f5eacb5912a61ed8914)

* **VINKKI**: Voit selailla muuttuvia fontteja niiden tukemien suunnitteluakseleiden perusteella: katso <https://fonts.google.com/variablefonts>. Google tarjoaa myös määritelmät muuttuvien fonttien suunnitteluakseleille: katso <https://fonts.google.com/variablefonts#axis-definitions>.
* Kun olet löytänyt haluamasi muuttuvat fontit, lataa ne paikalliselle laitteellesi ja nimeä uudelleen kaikki tiedostot, joissa on ongelmallisia merkkejä.
* Jotkin muuttuvat fontit koostuvat kahdesta `.ttf` tiedostosta: yksi pystysuoraa (normaalia) muotoa varten ja, jos se on tarjolla, yksi kursivoitua muotoa varten. Varmista tämä jokaisen lataamasi fontin kohdalla.

### 2. Nimeä Google-fonttitiedostot uudelleen ongelmien välttämiseksi

Googleen perustuva tapa nimetä muuttuvien fonttien tiedostoja sisältää fontin suunnitteluakselit pilkuilla erotettuina. Valitettavasti tämä aiheuttaa ongelmia fontspecille, joka on olennainen paketti muuttuvien fonttien käyttämiseen LuaLaTeXilla. Esimerkiksi Noto Serif tarjoaa leveys- ja painoakselit, ja se toimitetaan kahtena tiedostona — toinen pystysuoraa fonttia varten ja toinen kursivoitua fonttia varten:

* NotoSerif-VariableFont\_wdth,wght.ttf
* NotoSerif-Italic-VariableFont\_wdth,wght.ttf

Näissä tiedostonimissä olevat pilkut aiheuttavat virheitä, kun niitä käytetään fontspecin `\setmainfont` komennossa. Esimerkiksi kirjoittamalla

```
\setmainfont{NotoSerif-VariableFont_wdth,wght.ttf}
[ItalicFont = NotoSerif-Italic-VariableFont_wdth,wght.ttf]
```

syntyy virheitä, joihin kuuluu

```
! Package fontspec Error: Fonttia "NotoSerif-Italic-VariableFont_wdth" ei
(fontspec)                löydy.

! LaTeX Error: Avain 'fontspec-opentype/wght.ttf' on tuntematon ja se
(LaTeX)        jätetään huomiotta.
```

Voit ratkaista tämän ongelman nimeämällä fonttitiedostot uudelleen niin, että poistat pilkut (ja alaviivat '\_') ja korvaat ne “turvallisella” merkillä, kuten yhdysmerkeillä ('-'), sekä varmistamalla, ettei välilyöntejä lisätä. Voit esimerkiksi nimetä uudelleen:

* NotoSans-VariableFont\_wdth,wght.ttf

kohteeseen

* NotoSans-VariableFont-wdth-wght.ttf

Tämä yksinkertainen uudelleennimeäminen auttaa välttämään ristiriitoja ja varmistaa muuttuvien fonttien sujuvan integroinnin LaTeX-dokumentteihisi.

### 3. Luo uusi Overleaf-projekti

* Luo uusi Overleaf-projekti ja [aseta kääntäjäksi LuaLaTeX](/latex/fi/tietopankki/026-changing-compiler.md) koska se on ainoa kääntäjä, joka tukee muuttuvia fontteja.
* Lisää `fontspec` paketti dokumenttisi esipuheeseen kirjoittamalla `\usepackage{fontspec}`.
* Valitse tiedoston latauskuvake (![Image displaying Overleaf file-upload icon](/files/f470a5aa36a7a10817d5eff34e2b64fddac4da58)) lisätäksesi paikallisesti nimetyt muuttuvien fonttien tiedostot uuteen projektiisi:

![Kuva, jossa näytetään, miten tiedosto ladataan Overleaf-projektiin](/files/8d7db97d050d476686ad07f770a3fdee9958e592)

### 4. (Valinnainen) Järjestä projektisi fonttitiedostot

Jos haluat kokeilla useita fontteja, esimerkiksi testatessasi dokumenttien ulkoasuja, on hyödyllistä järjestää fonttitiedostot projektikansioiden avulla. Kääntämisvaiheessa LaTeX ei kuitenkaan etsi fontteja automaattisesti projektikansioistasi; sinun täytyy auttaa LaTeXia käyttämällä paikallista asetustiedostoa nimeltä [latexmkrc](/latex/fi/syvalliset-artikkelit/28-how-to-use-latexmkrc-with-overleaf.md). Emme mene yksityiskohtiin tässä, mutta suosittelemme luomaan projektikansion nimeltä `VariableFonts` ja kopioimaan `latexmkrc` tiedoston, jota käytetään [oheisessa projektissa](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d).

## Seuraavassa vaiheessa

Vaihe 2 esittelee LaTeXin fonttien valintamallin: New Font Selection Scheme -järjestelmän, joka tarjoaa tärkeää taustatietoa, jota käytetään koko tämän opastuksen loppuosan ajan.

[Johdanto](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [Vaihe 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [Vaihe 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [Vaihe 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [Vaihe 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [Vaihe 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [Vaihe 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [Vaihe 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [Vaihe 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [Esimerkit ja projektit](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/fi/syvalliset-artikkelit/37-step-1-setting-up-an-overleaf-project-to-use-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.
