> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/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/gum/code/standard-visuals/textruntime/maxletterstoshow.md).

# MaxLettersToShow

## Introduction

`MaxLettersToShow` controls the number of letters that are displayed by a `TextRuntime`. This value can be used to print text out letter-by-letter. This property does not change alignment or size of text. In other words, a TextRuntime with its `WidthUnits` or `HeightUnits` of `RelativeToChildren` reports the same absolute width regardless of its `MaxLettersToShow` value.

## Code Example - Printing Letters One at a Time

The following code can be used to print letters out one at a time.

```csharp
// Class scope
TextRuntime textRuntime;
bool isPrinting = false;
float numberOfCharacters;
protected override void Initialize()
{
    GumUI.Initialize(this);

    textRuntime = new TextRuntime();
    textRuntime.AddToRoot();
    textRuntime.Text = "This is longer text which is used to " +
        "create word wrapping. Notice that when this prints out, " +
        "it prints one letter at a time and wraps according to the " +
        "TextRuntime's bounds";

    textRuntime.Anchor(Anchor.Center);
    textRuntime.Width = 200;
    textRuntime.WidthUnits = Gum.DataTypes.DimensionUnitType.Absolute;
    textRuntime.Height = 0;
    textRuntime.HeightUnits = Gum.DataTypes.DimensionUnitType.RelativeToChildren;
    textRuntime.MaxLettersToShow = 0;

    base.Initialize();
}


protected override void Update(GameTime gameTime)
{
    GumUI.Update(gameTime);

    if(GumUI.Keyboard.KeyPushed(Keys.Space))
    {
        isPrinting = true;
        numberOfCharacters = 0;
    }

    if(isPrinting)
    {
        const int charactersPerSecond = 20;
        numberOfCharacters += 
            (float)gameTime.ElapsedGameTime.TotalSeconds * charactersPerSecond;

        textRuntime.MaxLettersToShow = (int)numberOfCharacters;
    }

    base.Update(gameTime);
}

```

<figure><img src="/files/PpfIFgC3Ufxspj1eoX79" alt=""><figcaption></figcaption></figure>


---

# 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://docs.flatredball.com/gum/code/standard-visuals/textruntime/maxletterstoshow.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.
