> For the complete documentation index, see [llms.txt](https://docs.polyfrost.org/oneconfig/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.polyfrost.org/oneconfig/gui/render-manager/font-rendering.md).

# Font Rendering

## Drawing Text

If you would like to display some text on the screen, you can use the various drawText methods of the `NanoVGHelper`. A list of these can be found on the Dokka docs. These methods work exactly the same as other draw methods to keep it simple:

```java
NanoVGHelper.INSTANCE.setupAndDraw((vg) -> {
    // draw Hi! at x=10 y=50 in white (-1), at 12px size in Inter Regular
    NanoVGHelper.INSTANCE.drawText(vg, "Hi!", 10, 50, -1, 12f, Fonts.REGULAR);
    
    // draw a string formatted like a URL (blue with underline) at x=10 y=50
    // which can be clicked and hovered
    NanoVGHelper.INSTANCE.drawUrl(vg, "https://www.youtube.com/watch?v=dQw4w9WgXcQ", 10, 50, 12f, Fonts.REGULAR);
    
    // draw some wrapped text at x=10 y=50 in white (-1), at 12px in Inter Regular
    // which wraps onto the next line if the line is more than 100px long
    NanoVGHelper.INSTANCE.drawWrappedText(vg, "Never gonna give you up; never gonna let you down", 10, 50, 100, -1, 12f, Fonts.REGULAR);
}
```

You can even use your own font by creating a custom `Font` object:

```java
// create the font object
public static final Font inter = new Font("inter", "/path/to/font/file.ttf");

public void draw(long vg, int x, int y) {
    // draw Hi! in your font you chose
    NanoVGHelper.INSTANCE.drawText(vg, "Hi!", 10, 50, -1, 12f, inter);
}
```


---

# 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:

```
GET https://docs.polyfrost.org/oneconfig/gui/render-manager/font-rendering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
