# Text View

This content view is represented by `text` value for the field `type`.  The content for the text view is represented by the `text` field value.  Following example shows a simplest text content view:

```json
{
        "type": "text",
        "text": "Simple text content"
}
```

Having type and text fields is the bare minimum for Appstent SDK to render a text content view.

### Text Styling

Appstent supports a number of text styling properties.  Some of these properties are built-in using platform's presentation framework's system properties.  For specifying the font style, `font` field can be used with the value identifying the system font style name or a Font Family Name.  Appstent SDK looks for system font style name and only if it doesn't match look for the matching supported font.

#### System Font Styles

The following table shows what `font` values match the respective platform specific font types

<table data-full-width="true"><thead><tr><th width="165">"font" value</th><th width="195.33333333333331">SwiftUI Font</th><th>Android TextStyle</th></tr></thead><tbody><tr><td><code>largeTitle</code></td><td><code>Font.largeTitle</code></td><td><pre class="language-kotlin" data-overflow="wrap" data-full-width="true"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.h3
</code></pre></td></tr><tr><td><code>title</code></td><td><code>Font.title</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.h4
</code></pre></td></tr><tr><td><code>title2</code></td><td><code>Font.title2</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.h5
</code></pre></td></tr><tr><td><code>title3</code></td><td><code>Font.title3</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.h6
</code></pre></td></tr><tr><td><code>headline</code></td><td><code>Font.headline</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.subtitle
</code></pre></td></tr><tr><td><code>subheadline</code></td><td><code>Font.subheadline</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.subtitle2
</code></pre></td></tr><tr><td><code>body</code></td><td><code>Font.body</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.body1
</code></pre></td></tr><tr><td><code>callout</code></td><td><code>Font.callout</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.body2
</code></pre></td></tr><tr><td><code>footnote</code></td><td><code>Font.footnote</code></td><td><pre data-overflow="wrap"><code>androidx.compose.material.MaterialTheme.typography.overline
</code></pre></td></tr><tr><td><code>caption</code></td><td><code>Font.caption</code></td><td><pre class="language-kotlin" data-overflow="wrap"><code class="lang-kotlin">androidx.compose.material.MaterialTheme.typography.caption
</code></pre></td></tr></tbody></table>

#### Font Weights

Similar to system font styles, text view content supports a number of system defined font weight values, represented by `fontWeight` field value.  Following table list out the `fontWeight` field values to iOS and Android font weight mappings.

<table data-full-width="false"><thead><tr><th width="209.33333333333331">"fontWeight" value</th><th width="255">SwiftUI Font property</th><th>Compose FontWeight property</th></tr></thead><tbody><tr><td><code>ultraLight</code></td><td><code>Font.weight.ultraLight</code></td><td><pre><code>FontWeight.ExtraLight
</code></pre></td></tr><tr><td><code>thin</code></td><td><code>Font.weight.thin</code></td><td><pre><code>FontWeight.Thin
</code></pre></td></tr><tr><td><code>light</code></td><td><code>Font.weight.light</code></td><td><pre><code>FontWeight.Light
</code></pre></td></tr><tr><td><code>regular</code></td><td><code>Font.weight.regular</code></td><td><pre><code>FontWeight.Normal
</code></pre></td></tr><tr><td><code>medium</code></td><td><code>Font.weight.medium</code></td><td><pre><code>FontWeight.Medium
</code></pre></td></tr><tr><td><code>semibold</code></td><td><code>Font.weight.semibold</code></td><td><pre><code>FontWeight.SemiBold
</code></pre></td></tr><tr><td><code>bold</code></td><td><code>Font.weight.bold</code></td><td><pre><code>FontWeight.Bold
</code></pre></td></tr><tr><td><code>heavy</code></td><td><code>Font.weight.heavy</code></td><td><pre><code>FontWeight.ExtraBold
</code></pre></td></tr><tr><td><code>black</code></td><td><code>Font.weight.black</code></td><td><pre><code>FontWeight.Black
</code></pre></td></tr></tbody></table>

#### Text Decoration / Emphasis

To provide text decoration/emphasis, text view content supports a field named `textEmphasis` which represents an array of text decoration/emphasis to apply to the text.  The possible values that can be added to the array can be "bold", "italic" & "underline".  Following is an example of textEmphasis field, showing all the possible text decorations applied:

```json
"textEmphasis": [
    "italic",
    "bold",
    "underline"
]
```

#### Font Size

For any custom font family used, the font size must be specified by using the `fontSize` field with a numeric value.  Following example shows a text view with a specified font name and `fontSize`.

```json
{
    "type": "text",
    "font": "Georgia",
    "fontSize": 24,
    "text": "Installed Font with 24 font size"
}
```

### Markdown Support

Currently Appstent iOS SDK support basic Markdown functionality as provided by iOS Framework.  To enable processing markdown content, add a boolean field `isMarkdown` and set it to `true`.  Following example shows markdown content with the support of basic text decorations and hyperlink support.

```json
{
    "type": "text",
    "isMarkdown": true,
    "font": "Georgia",
    "fontSize": 12,
    "text": "This is **bold** text, this is *italic* text, and this is ***bold, italic*** text.\n~~A strikethrough example~~\n`Monospaced works too`\nVisit Appversation: [click here](https://www.appversation.com)"                
}
```


---

# Agent Instructions: 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://appversation.gitbook.io/appstent/content-authoring/individual-views/text-view.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.
