> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/flatredball/graphics/text/newlinedistance.md).

# NewLineDistance

### Introduction

The NewlineDistance property sets the amount of spacing between lines on a Text object. This value is set according to the Camera/Layer settings automatically when the Text is added to managers, but it can be modified after the fact to adjust spacing.

### Code Example (2D Camera/Layer)

The default setup for FlatRedBall is to be in 2D coordinates. If so, then NewlineDistance will be measured in pixels. The following code creates two Text objects and shows how to adjust their NewlineDistance:

```
// Assuming a 2D camera:
Text text = TextManager.AddText("Regular\nnewline");

Text otherText = TextManager.AddText("Modified\nnewline");
otherText.X = 150;
otherText.NewLineDistance = 30;
```

![NewlineDistance2D.PNG](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-eb721504e848214c25653b4e5ae0395b2d43ed7e%2Fmigrated_media-NewlineDistance2D.PNG?alt=media)

### Code Example (3D Camera/Layer)

The following code creates two Text objects and shows how to adjust their NewlineDistance. Note that this example was made with a 3D camera.

```
Text text = TextManager.AddText("Regular\nnewline");
// In a 3D camera, we need to set this to false if we want accurate NewlineDistances
text.AdjustPositionForPixelPerfectDrawing = false;

Text otherText = TextManager.AddText("Modified\nnewline");
otherText.X = 10;
otherText.NewLineDistance = 3;
otherText.AdjustPositionForPixelPerfectDrawing = false;
```

![NewlineDistance.PNG](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-975bbdf4eb0558170fa26885ff63db16595e01f6%2Fmigrated_media-NewlineDistance.PNG?alt=media)

### NewlineDistance rounds to whole numbers if AdjustPositionForPixelPerfectDrawing is true

Text object are designed to work in 2D coordinates by default. Therefore, NewlineDistance will round to the nearest integer value. To change this, you can set the Texts' [AdjustPositionForPixelPerfectDrawing](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) to false. The reason this happens is because if you are dealing with Text that has multiple lines and it is going to scroll vertically (like on a credits screen), then individual lines may appear to jitter when the text scrolls. If you are using 3D text, then you most likely do not want it to be adjusted for pixel perfect drawing anyway, so setting AdjustPositionForPixelPerfectDrawing to false will both resolve this issue and potential other issues with rendering te a Text object on a 3D Camera/Layer.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/graphics/text/newlinedistance.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
