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:
{
"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
largeTitle
Font.largeTitle
androidx.compose.material.MaterialTheme.typography.h3
title
Font.title
androidx.compose.material.MaterialTheme.typography.h4
title2
Font.title2
androidx.compose.material.MaterialTheme.typography.h5
title3
Font.title3
androidx.compose.material.MaterialTheme.typography.h6
headline
Font.headline
androidx.compose.material.MaterialTheme.typography.subtitle
subheadline
Font.subheadline
androidx.compose.material.MaterialTheme.typography.subtitle2
body
Font.body
androidx.compose.material.MaterialTheme.typography.body1
callout
Font.callout
androidx.compose.material.MaterialTheme.typography.body2
footnote
Font.footnote
androidx.compose.material.MaterialTheme.typography.overline
caption
Font.caption
androidx.compose.material.MaterialTheme.typography.caption
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.
ultraLight
Font.weight.ultraLight
FontWeight.ExtraLight
thin
Font.weight.thin
FontWeight.Thin
light
Font.weight.light
FontWeight.Light
regular
Font.weight.regular
FontWeight.Normal
medium
Font.weight.medium
FontWeight.Medium
semibold
Font.weight.semibold
FontWeight.SemiBold
bold
Font.weight.bold
FontWeight.Bold
heavy
Font.weight.heavy
FontWeight.ExtraBold
black
Font.weight.black
FontWeight.Black
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:
"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
.
{
"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.
{
"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)"
}
Last updated