How to access fonts

The [`assets`](/assets/) module contains a variable named `fonts` that holds references to the fonts defined in a package. You can either [create your own font package](create-font-package/) or add the font package dependency in your current package or define fonts in your current package itself. Lets say we are using font package `fifthtry.github.io/roboto-font` ([repo](https://github.com/FifthTry/roboto-font)) as dependency and lets use it in our module. Let's assume that we are using the font package `fifthtry.github.io/roboto-font` ([repo](https://github.com/FifthTry/roboto-font)) as a dependency and we want to use it in our module. We can import the `assets` module of `roboto-font` package to access its fonts.
-- import: fifthtry.github.io/roboto-font/assets

-- ftd.type dtype:
size.px: 40
weight: 900
font-family: $assets.fonts.Roboto
line-height.px: 65
letter-spacing.px: 5

-- ftd.text: Hello World
role: $dtype
Lang:
ftd
In [`FASTN.ftd`](https://github.com/FifthTry/roboto-font/blob/main/FASTN.ftd) module for `fifthtry.github.io/roboto-font` package, you can see that the fonts are defined like this:
-- fastn.font: Roboto
style: italic
weight: 100
woff2: -/fifthtry.github.io/roboto-font/static/Roboto-100-italic-cyrillic-ext.woff2
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F


Lang:
ftd
We have accessed these fonts using `fonts` variable which contains reference to `Roboto` (`$assets.fonts.Roboto`).

Support `fastn`!

Enjoying `fastn`? Please consider giving us a star ⭐️ on [GitHub](https://github.com/fastn-stack/fastn) to show your support!
[⭐️](https://github.com/fastn-stack/fastn)

Getting Help

Have a question or need help? Visit our [GitHub Q&A discussion](https://github.com/fastn-stack/fastn/discussions/categories/q-a) to get answers and subscribe to it to stay tuned. Join our [Discord](https://discord.gg/a7eBUeutWD) channel and share your thoughts, suggestion, question etc. Connect with our [community](/community/)!
[💻️](/community/)

Found an issue?

If you find some issue, please visit our [GitHub issues](https://github.com/fastn-stack/fastn/issues) to tell us about it.

Quick links:

- [Install `fastn`](install/) - [Create `fastn` package](create-fastn-package/) - [Expander Crash Course](expander/) - [Syntax Highlighting in Sublime Text](/sublime/)

Join us

We welcome you to join our [Discord](https://discord.gg/a7eBUeutWD) community today. We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright © 2023 - [FifthTry.com](https://www.fifthtry.com/)