test
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Color emojis
|
||||
|
||||
You can include color glyphs and emojis in text. To do so, import a font file that has color emojis in it and set it as the fallback emojis text assets.
|
||||
|
||||

|
||||
|
||||
## Set up color emojis
|
||||
|
||||
Create a color font asset and add it to the TMP Settings Fallback. Note this is the same as the Project Settings/TextMeshPro/Settings as depicted in the image.
|
||||
|
||||
1. In your project, import a font file that has color emojis in it.
|
||||
2. Right-click in the `Asset` folder, and then select **Create > TextMeshPro > FontAsset > Color**. This ensures that you create the font asset with the right shader (Sprite) and the right atlas rendering mode (Color).
|
||||
3. Open the TMP Settings asset or alternatively via the **Edit > ProjectSettings > TextMesh Pro > Settings**.
|
||||
4. Add the emoji font asset to the **Fallback Emoji Text Assets** section.
|
||||
|
||||

|
||||
|
||||
Alternatively, assigning a color font asset to the text object will work fine provided that the [Emoji Fallback Support](ColorEmojis) option in the Extra Settings of the text component is disabled.
|
||||
|
||||
## Include emojis in text
|
||||
|
||||
To include emojis in text, do the following:
|
||||
|
||||
- Include emojis in text through their Unicode. For example, enter `\U00001f60` to represent a smile.
|
||||
- Use OS Virtual Keyboard.
|
||||
- Copy the emojis from an external Text Editing tool and paste them in your text field.
|
||||
|
||||
To find more information about the Unicode Emojis Standard, see this [link](http://unicode.org/Public/emoji/14.0/).
|
||||
|
||||
## Control Emoji Fallback Search
|
||||
|
||||
The "Emoji Fallback Support" option controls where we search for characters defined in the Unicode Standards as Emojis.
|
||||
|
||||
When this option is enabled (default), the "Fallback Emoji Text Assets" list will be search first for any characters defined as Emojis.
|
||||
|
||||
When this option is disabled, the Primary font asset assigned to the text component will be searched first.
|
||||
|
||||
Basically, this option overrides the character search to prioritize searching thru the "Fallback Emoji Text Assets" list first when the character is an emoji.
|
||||
|
||||
This option is also useful when a font contains black-and-white emojis as it allows the user to control if the emojis contained in the primary will be used or those from the "Fallback Emoji Text Assets" list.
|
||||
|
||||
To update the `Emoji Fallback Support`:
|
||||
1. Select the **Text (TMP)** field in the hierarchy.
|
||||
2. In the Inspector window, under the `Extra Settings` foldout of the **Text (TMP)** field, select the **Emoji Fallback Support** toggle.
|
||||
|
||||

|
||||
|
||||
## Limitations
|
||||
|
||||
The color emojis feature has the following limitations:
|
||||
|
||||
- It doesn't support some OpenType font features, such as chain context and single substitution.
|
||||
- It doesn't support Apple fonts that use the AAT format. It's a predecessor to OpenType.
|
||||
- It doesn't support SVG color glyphs.
|
||||
- Dynamic OS FontAsset has limited support on some iOS devices. The `Apple Color Emoji` font file found on OSX and several iOS devices works fine. However, the `Apple Color Emoji-160px` found on newer iOS devices is not support as the emoji's are encoded in JPEG format which is not supported by FreeType.
|
||||
- Prior to Unity 2023.1, adding a UTF-32 through the inspector sends an error. The emojis won't display in the inspector.
|
@@ -0,0 +1,42 @@
|
||||
# Color Gradients
|
||||
|
||||
You can apply gradients of up to four colors to TextMesh Pro GameObjects. When you add a gradient, TextMesh Pro applies it to each character in the text individually. It stores gradient colors as in each character sprite's vertex colors.
|
||||
|
||||

|
||||
|
||||
_TextMesh Pro text with a four-color gradient_
|
||||
|
||||
Because each character sprite consists of two triangles, gradients tend to have a dominant direction. This is most obvious in diagonal gradients.
|
||||
|
||||
For example, the dominant direction in gradient below favors the red and black colors in the bottom-left and top-right corners
|
||||
|
||||

|
||||
|
||||
When you reverse the gradient colors, so both the top-right and bottom-left corners are yellow, the dominant color changes.
|
||||
|
||||

|
||||
|
||||
|
||||
TextMesh Pro multiplies gradient colors with the text's main vertex color (**Main Settings > Vertex Color** in the TextMesh Pro Inspector). If the main vertex color is white you see only the gradient colors. If it’s black you don’t see the gradient colors at all.
|
||||
|
||||
## Applying a Gradient
|
||||
|
||||
To apply a gradient to a TextMesh Pro GameObject, edit the [Gradient properties](TMPObjectUIText.md#color) in the Inspector.
|
||||
|
||||
> [!NOTE]
|
||||
> - To apply a gradient to only a portion of the text, use the [gradient](RichTextGradient.md) rich text tag.
|
||||
> - To apply a gradient to multiple text objects, use a [gradient preset](ColorGradientsPresets.md).
|
||||
|
||||

|
||||
|
||||
**To apply a color gradient to a TextMesh Pro GameObject:**
|
||||
|
||||
1. Enable the **Main Settings > Color Gradient** property.
|
||||
|
||||
1. Set **Main Settings > Color Gradient > Color Mode** to the [type of gradient](ColorGradientsTypes.md) you want to apply.
|
||||
|
||||
1. Use the **Main Settings > Color Gradient > Colors** settings to choose colors for the gradient. For each color you can:
|
||||
|
||||
- Click the color swatch to open a [Color Picker](https://docs.unity3d.com/Manual/EditingValueProperties.html).
|
||||
- Use the eyedropper to pick a color from anywhere on your screen.
|
||||
- Enter the color’s hexadecimal value directly in the text field.
|
@@ -0,0 +1,36 @@
|
||||
# Gradient Presets
|
||||
|
||||
Use gradient presets to reuse the same color gradients across text objects. A gradient preset overrides the text’s local gradient type and colors.
|
||||
|
||||
You have to store Gradient presets in a specific folder so TextMesh Pro can find them and include them in builds. You can change the folder from the [TextMesh Pro settings](Settings.md#color-gradient-presets).
|
||||
|
||||
## Creating gradient presets
|
||||
|
||||
To create a gradient preset, choose **Assets > Create > TextMesh Pro > Color Gradient** from the menu.
|
||||
|
||||
This adds a new TextMesh Pro Color Gradient Asset to the Scene, and opens it in the Inspector.
|
||||
|
||||

|
||||
|
||||
You can then select a [gradient type](ColorGradientTypes.md) from the **Color Mode** dropdown, and set the gradient **Colors**.
|
||||
|
||||
## Applying gradient presets
|
||||
|
||||
You apply a gradient preset to text from the TextMesh Pro Inspector.
|
||||
|
||||
**To apply a gradient preset:**
|
||||
|
||||
1. Enable the **Main Settings > Color Gradient** property.
|
||||
|
||||
1. Open the Object Picker (circle icon) for **Main Settings > Color Preset**, and choose choose a preset
|
||||
|
||||
When you apply a gradient preset, the Inspector overrides the text's gradient type and colors with the values from the preset.
|
||||
|
||||
> [!CAUTION]
|
||||
> If you modify the gradient settings in the TextMesh Pro Inspector after you apply a preset, it affects the preset itself. Changes affect every object that uses the same preset.
|
||||
|
||||
## Removing gradient presets
|
||||
|
||||
To remove a gradient preset, open the Object Picker (circle icon) for **Main Settings > Color Preset**, and choose **None**.
|
||||
|
||||
When you remove the preset, the text reverts to its local gradient properties.
|
@@ -0,0 +1,81 @@
|
||||
# Color Gradient Types
|
||||
|
||||
You can apply the following types of gradients to text.
|
||||
|
||||
- **[Single](#single-color):** A single color that is TextMesh Pro multiplies with the text object's vertex color.
|
||||
|
||||
- **[Horizontal](#horizontal-gradients):** A two-color side-to-side gradient.
|
||||
|
||||
- **[Vertical](#vertical-gradients):** A two-color up-and-down gradient.
|
||||
|
||||
- **[Four Corner](#four-corner-gradients):** A four-color gradient. Each color radiates from one corner.
|
||||
|
||||
<br/>
|
||||
_The TexMesh Pro color gradient settings_ <br/><br/>
|
||||
|
||||
The number of colors available in the **Colors** settings depends on the type of gradient you choose. Each swatch corresponds to the color's origin on a character sprite.
|
||||
|
||||
The image above shows a the settings for a four color gradient. Each color originates in the corresponding corner of the sprite (top-left, top-right, bottom-left, bottom-right). IT produces the following gradient:
|
||||
|
||||

|
||||
|
||||
|
||||
## Single Color
|
||||
|
||||
The **Single** gradient type applies a single color.
|
||||
|
||||

|
||||
|
||||
## Horizontal Gradients
|
||||
|
||||
The **Horizontal** gradient type applies two colors, and produces a side to side transition between them on each character.
|
||||
|
||||

|
||||
|
||||
<br/><br/>
|
||||
|
||||
## Vertical Gradients
|
||||
|
||||
The **Vertical** gradient type consists of two colors, and produces an up and down transition between the two on each character.
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
## Four Corner Gradients
|
||||
|
||||
The **Four Corner** gradient type applies four colors. Each one radiates out from its assigned corner of each character.
|
||||
|
||||
<br/><br/>
|
||||
|
||||

|
||||
|
||||
This is the most versatile gradient type. By varying some colors and keeping others identical, you can create different kinds of gradients. For example:
|
||||
|
||||
- Give three corners one color and the fourth a different color.
|
||||
|
||||

|
||||
|
||||
- Give pairs of adjacent corners the same color to create horizontal or vertical gradients.
|
||||
|
||||
<br/><br/>
|
||||
|
||||

|
||||
|
||||
- Give pairs of diagonally opposite corners the same color to create diagonal gradients.
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
- Create horizontal and vertical 3-color gradients with a dominant color at one end and a transition between two colors at the other.
|
||||
|
||||
<br/><br/>
|
||||
|
||||

|
||||
|
||||
- Give two diagonally opposite corners same color and give the other two corners different colors to create a diagonal stripe 3-color gradient.
|
||||
|
||||
<br/><br/>
|
||||
|
||||

|
@@ -0,0 +1,27 @@
|
||||
# Styles
|
||||
|
||||
Use styles to apply additional formatting to some or all of the text in a TextMesh Pro object. A style is a combination of opening and closing [rich text tags](RichText.md), and can also include leading and trailing characters.
|
||||
|
||||
* To define styles, use a TextMesh Pro [style sheet](StyleSheets.md).
|
||||
|
||||
* To apply styles to your text, use the [`<style>` rich text tag](RichTextStyle.md) in the text editor.
|
||||
|
||||
## Custom styles example
|
||||
|
||||
Say you want headings in your text to be big, red, and bold with an asterisk to either side and a line break at the end.
|
||||
|
||||

|
||||
|
||||
That requires several tags for each heading, which makes the formatting cumbersome to maintain, and the text more difficult to read in the editor.
|
||||
|
||||
`<font-weight=700><size=2em><color=#FF0000>*Heading*</color></size></font-weight><br>`
|
||||
|
||||
It's easier to put all of the markup in a style. The example below shows a style called `H1`.
|
||||
|
||||

|
||||
|
||||
Once you create the style you can format all of your headings with a single `<style>` tag.
|
||||
|
||||
`<style="H1">Heading</style>`
|
||||
|
||||
Not only does that make the text easier to read in the editor, you can now update all of the headings in your text just by changing the style.
|
@@ -0,0 +1,36 @@
|
||||
# Debugging TextMesh Pro text
|
||||
|
||||
Use the Text Info Debug Tool to display diagnostic information about a TextMesh Pro GameObject in the Scene view and the Inspector.
|
||||
|
||||
For example, you can display lines that indicate font metrics such as the line height, or the offset for superscript and subscript text. This can help you diagnose problems with fonts you import.
|
||||
|
||||

|
||||
_The TextMesh Pro debug tool set to show character bounding boxes and font metrics_
|
||||
|
||||
>[NOTE!]
|
||||
>The debug tool is part of the TextMesh Pro Examples & Extras package. You can install the package from the menu (select **Window > TextMesh Pro > Import TMP Examples and Extras**) or the [TextMesh Pro settings](Settings.md).
|
||||
|
||||
To use the debug tool:
|
||||
|
||||
1. Open a TextMesh Pro GameObject in the Inspector.
|
||||
|
||||
2. [Add](https://docs.unity3d.com/Manual/UsingComponents.html) a **TMP_TextInfoDebugTool** component.
|
||||
|
||||
3. From the **TMP_Text Info Debug Tool** section, turn debug [settings](#text-info-debug-tool-properties) on and off. You can see the results in the Scene view.
|
||||
|
||||
|
||||
## Text Info Debug Tool properties
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Show Characters** | Displays each character's bounding box, as well as reference lines for font metrics, in the Scene view. |
|
||||
|**Show Words** | Displays the bounding box for each word in the Scene view. |
|
||||
|**Show Links** | Displays the bounding box for each link in the Scene view. |
|
||||
|**Show Lines** | Displays the bounding box for line of text word in the Scene view. |
|
||||
|**Show Mesh Bounds** | Displays the bounding box for the entire block of text in the Scene view. |
|
||||
|**Show Text Bounds** | Displays the boundary of the area that text can occupy, as defined by the font metrics, in the Scene view. |
|
||||
|**Object Stats** | Shows statistics about the TextMesh Pro GameObject, such as the number of characters, words, lines, and spaces. |
|
||||
|**Text Component** | Links to the TextMesh Pro GameObject's Text component. |
|
||||
|**Transform** | Links to the TextMesh Pro GameObject's RectTransform component. |
|
@@ -0,0 +1 @@
|
||||
# Debugging TextMesh Pro text
|
@@ -0,0 +1,75 @@
|
||||
# Font Assets
|
||||
|
||||
To use different fonts with TextMesh Pro, you need to create font assets. TextMesh Pro has its own font Asset format that is distinct from, but related to, [Unity's regular font Asset format](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Font.html). You create TextMesh Pro font assets _from_ Unity font assets.
|
||||
|
||||
Every TextMesh Pro font Asset has two sub-Assets:
|
||||
|
||||
* **Font atlas:** a black and white or grayscale texture file that contains all of the characters included in the font Asset.<br/><br/><br/>_Example of a font atlas_
|
||||
* **Font material:** a material that controls the appearance of TextMesh Pro text using one of the [TextMesh Pro shaders](Shaders.md).
|
||||
|
||||
Font assets must be in a specific folder so TextMesh Pro can find them and include them in builds. To change the default folder for font assets, got to the [TextMesh Pro settings](Settings.md) and set the **Default Font Asset > Path** option.
|
||||
|
||||
## Creating Font Assets
|
||||
|
||||
To create a TextMesh Pro font Asset, use the TexMesh Pro [Font Asset Creator](FontAssetsCreator.md).
|
||||
|
||||
You can also create an empty TextMesh Pro font Asset from the Unity main menu. An empty font asset does not contain any characters by default, you must add them later. To create an empty TextMesh Pro font asset, select a Unity font Asset and then select **Asset > Create > TextMeshPro > Font Asset** from the menu.
|
||||
|
||||
## Types of font atlas
|
||||
|
||||
Font Assets can have the following types of font atlas:
|
||||
|
||||
* **Distance Field:** This type of atlas contains [signed distance field (SDF)](FontAssetsSDF.md) information.<br/><br/>This is the recommended Font Asset type for most applications because SDF atlases produce text that is smooth when transformed.
|
||||
|
||||
* **Smooth/Hinted Smooth:** This type of atlas is an antialiased bitmap texture. A Hinted smooth atlas aligns glyph pixels with texture pixels to produce a smoother result.<br/><br/>Smooth atlases work well for static text that is viewed head on, in situations where there is a good correspondence between texture pixels and screen pixels. Transforming text generated from a smooth atlas blurs the text edges.
|
||||
|
||||
* **Raster/Raster Hinted:** Raster atlases are un-smoothed bitmap textures. They almost always produce text with jagged, pixellated edges. The Hinted rater atlases align glyph pixels with texture pixels to produce a smoother result.
|
||||
|
||||
## Get Font Features
|
||||
|
||||
This option determines if OpenType font features should be retrieved from the source font file as new characters and glyphs are added to the font asset. Disabling this option will prevent extracting font features.
|
||||
|
||||
To update the Get Font Features option on a FontAsset:
|
||||
1. Select the FontAsset
|
||||
2. In the FontAsset inspector, navigate to the Generation Settings section.
|
||||
3. Select **Get Font Features**.
|
||||
|
||||

|
||||
|
||||
## Reset
|
||||
The `Reset` context menu option clears all tables which includes the Character and Glyph tables along with all font features tables such as the Ligature, Glyph Adjustment, Mark to Base, Mark to Mark tables. This option also clears the font asset's atlas texture and resets it back to size zero.
|
||||
|
||||
To reset a FontAsset:
|
||||
1. Select the FontAsset
|
||||
2. Expand the top right menu in the FontAsset Inspector.
|
||||
3. Select **Reset**.
|
||||
|
||||

|
||||
|
||||
## Clear Dynamic Data
|
||||
The `Clear Dynamic Data` context menu option clears the character and glyph tables as well as the font asset's atlas texture which is also resized back to size zero. This option preserves all font feature table data such as Ligatures, Glyph Adjustment, Mark to Base, Mark to Mark, etc.
|
||||
|
||||
To clear a FontAsset:
|
||||
1. Select the FontAsset
|
||||
2. Expand the top right menu in the FontAsset Inspector.
|
||||
3. Select **Clear Dynamic Data**.
|
||||
|
||||

|
||||
|
||||
This preserves the custom ligatures, kernings, and diacritical marks you added to the font asset when clearing the atlas.
|
||||
|
||||
## Clear Dynamic Data on Build
|
||||
|
||||
The "Clear Dynamic Data on Build" option works like the "Clear Dynamic Data" context menu option but also clears data when building the project or closing the Editor.
|
||||
|
||||
When enabled, this option resizes the texture to 0 (empty) during the build process.
|
||||
|
||||
For dynamic FontAssets, it resets the glyph atlas, character table, and glyph table to their initial states. This feature helps reduce build size by minimizing the FontAsset's data footprint.
|
||||
|
||||
To update the Clear Dynamic Data on Build option:
|
||||
|
||||
1. Select the FontAsset
|
||||
2. In the FontAsset inspector, navigate to the Generation Settings section.
|
||||
3. Select **Clear Dynamic Data on Build**.
|
||||
|
||||

|
@@ -0,0 +1,86 @@
|
||||
## Font Asset Creator
|
||||
|
||||
The Font Asset Creator converts [Unity font assets](FontAssets.md) into TextMesh Pro font assets. You can use it to create both Signed [Distance Field (SDF)](FontAssetsSDF.md) fonts and bitmap fonts.
|
||||
|
||||
When you create a new font Asset, TextMesh Pro generates the Asset itself, as well as the atlas texture and material for the font.
|
||||
|
||||
After you create a TextMesh Pro font Asset, you can delete the Unity font Asset you used as a source, although you may want to keep it in the Scene in case you need to regenerate the TextMesh Pro font Asset.
|
||||
|
||||
## Creating a font Asset
|
||||
|
||||
Before you start, make sure that you've already imported the font (usually a TrueType .ttf file) you want to use into the project. For more information about importing fonts into Unity, see the documentation on [Fonts](https://docs.unity3d.com/Manual/class-Font.html) in the Unity manual.
|
||||
|
||||
**To create a TextMesh Pro font Asset:**
|
||||
|
||||
1. From the menu, choose: **Window > TextMesh Pro > Font Asset Creator** to open the Font Asset Creator.
|
||||
|
||||
1. Choose a **Source Font File**. This the Unity font Asset that you want to convert into a TextMesh Pro font Asset.
|
||||
|
||||
1. Adjust the **[Font Settings](#FontAssetCreatorSettings)** as needed, then click **Generate Font Atlas** to create the atlas texture<br/><br/>The atlas, and information about the font Asset appear in the texture preview area.<br/><br/>IMAGE
|
||||
|
||||
1. Continue adjusting the settings and regenerating the atlas until you're satisfied with the result.
|
||||
|
||||
1. Click **Save** or **Save as...** to save the font Asset to your project.<br/><br/>You must save the Asset to a **Resources** folder to make it accessible to TextMesh Pro.
|
||||
|
||||
<a name="FontAssetCreatorSettings"></a>
|
||||
## Font Asset Creator Settings:
|
||||
|
||||
|Property:||Function:|
|
||||
|-|-|-|
|
||||
|**Source Font File**||Select a font from which to generate a Text Mesh Pro font Asset.<br/><br/>This font is not included in project builds, unless you use it elsewhere in the project, or put it in a Resources folder.<br/><br/>You can use one of the default TextMesh Pro font assets, or [import your own](https://docs.unity3d.com/Manual/class-Font.html).|
|
||||
|**Sampling Point Size**||Set the font size, in points, used to generate the font texture.|
|
||||
|**Auto Sizing**||Use the largest point size possible while still fitting all characters on the texture.<br/><br/>This is the usual setting for SDF fonts.|
|
||||
|**Custom Size**||Use a custom point size. Enter the desired size in the text box.<br/><br/>Use this setting to achieve pixel-accurate control over bitmap-only fonts.|
|
||||
|**Padding**||Specify the space, in pixels, between characters in the font texture.<br/><br/>Padding provides the space required to render character separately, and to generate the SDF gradient (See the documentation on [Font Assets](FontAssetsSDF.md) for details).<br/><br/>The larger the padding, the smoother the transition, which allows for higher-quality rendering and larger effects, like thick outlines.<br/><br/>A padding of 5 is often fine for a 512x512 texture.|
|
||||
|**Packing Method**||Specify how to fit the characters into the font texture.|
|
||||
||Optimum|Finds the largest possible automatic font size that still fits all characters in the texture.<br/><br/>Use this setting to generate the final font texture.
|
||||
||Fast|Computes character packing more quickly, but may use a smaller font size than Optimum mode.<br/><br/>Use this setting when testing out font Asset creation settings.|
|
||||
|**Atlas Resolution**||Set the size width and height of the font texture, in pixels.<br/><br/>A resolution of 512 x 512 is fine for most fonts, as long as you are only including ASCII characters. Fonts with more characters may require larger resolutions, or multiple atlases. <br/><br/>When using an SDF font, a higher resolution produces finer gradients, and therefore higher quality text.|
|
||||
|**Character Set**||The characters in a font file aren't included in the font Asset automatically. You have to specify which ones you need. You can select a predefined character set, provide a list of characters to include, or include all of the characters in an existing font Asset or text Asset.|
|
||||
||ASCII|Includes the visible characters in the ASCII character set.|
|
||||
||Extended ASCII|Includes the visible characters in the extended ASCII character set.|
|
||||
||ASCII Lowercase|Includes only visible lower-case characters from the ASCII character set.|
|
||||
||ASCII Uppercase|Includes only visible upper-case characters from the ASCII character set.|
|
||||
||Numbers + Symbols|Includes only the visible numbers and symbols from the ASCII character set.|
|
||||
||Custom Range|Includes a range of characters that you define.<br/><br/>Enter a sequence of decimal values, or ranges of values, to specify which characters to include.<br/><br/>Use a hyphen to separate the first and last values of a range. Use commas to separate values and ranges (for example `32-126,160,8230`).<br/><br/>You can also choose an existing font Asset to include the characters in that Asset.|
|
||||
||Unicode Range (Hex)|Includes a range of characters that you define.<br/><br/>Enter a sequence of unicode hexadecimal values, or ranges of values, to specify which characters to include.<br/><br/>Use a hyphen to separate the first and last values of a range. Use commas to separate values and ranges (for example `20-7E,A0,2026`).<br/><br/>You can also choose an existing font Asset to include the characters in that Asset.|
|
||||
||Custom Characters|Includes a range of characters that you define.<br/><br/>Enter a sequence of characters to specify which characters to include.<br/><br/>Enter characters one after the other, with no spaces or delimiting characters in between (for example `abc123*#%`).<br/><br/>You can also choose an existing font Asset to include the characters in that Asset.|
|
||||
||Characters from File|Includes all the characters in a text Asset that you specify.<br/><br/>Use this option when you want to save your character set.|
|
||||
|**Font Style**||Apply basic font styling when creating a bitmap-only font Asset.<br/><br/>For SDF fonts, you configure the styling in the shader rather than the font Asset.|
|
||||
||Normal|Generates characters with no styling.|
|
||||
||Bold, Italic, Bold_Italic|Generates the font Asset with bold characters, italicized characters, or both.<br/><br/>With these settings, you can set a strength value that applied to bolding and italicization|
|
||||
||Outline|Generates the font Asset with outline characters.|
|
||||
||Bold_Sim|Generates the font Asset with a simulated bold.|
|
||||
|**Render Mode**||Specify the render mode to use when outputting the font atlas.|
|
||||
||SMOOTH|Renders the atlas to an antialiased bitmap.|
|
||||
||RASTER|Renders the atlas to a non-antialiased bitmap.|
|
||||
||SMOOTH_HINTED|Renders the atlas to an antialiased bitmap, and aligns character pixels with texture pixels for a crisper result.|
|
||||
||RASTER_HINTED|Renders the atlas to a non-antialiased bitmap and aligns character pixels with texture pixels for a crisper result.|
|
||||
| |SDF| Renders the atlas using a slower, but more accurate SDF generation mode, and no oversampling. |
|
||||
| |SDFAA| Renders the atlas using a faster, but less accurate SDF generation mode. It produces font atlases that are sufficient for most situations.|
|
||||
| |SDFAA_HINTED| Renders the atlas using a faster, but less accurate SDF generation mode, and aligns character pixels with texture pixels for a crisper result.. It produces font atlases that are sufficient for most situations |
|
||||
| |SDF8| Renders the atlas using a slower, but more accurate SDF generation mode, and 8x oversampling. |
|
||||
| |SDF16| Renders the atlas using a slower, but more accurate SDF generation mode, and 16x oversampling. |
|
||||
| |SDF32| Renders the atlas using a slower, but more accurate SDF generation mode, and 32x oversampling. Use this setting for fonts with complex or small characters. |
|
||||
|**Get Kerning Pairs**||Enable this option to copy the kerning data from the font.<br/><br/>Kerning data is used to adjust the spacing between specific character pairs to produce a more visually pleasing result.<br/><br/>**Note:** It isn't always possible to import kerning data. Some fonts store kerning pairs in their glyph positioning (GPOS) table, which is not supported by FreeType, the font engine used by TextMesh Pro. Other fonts do not store kerning pairs at all.|
|
||||
|**Generate Font Atlas**||Generate the font atlas texture.|
|
||||
|**Save**||Save the current font atlas.|
|
||||
|**Save As**||Save the current font atlas as a new font Asset.|
|
||||
|
||||
## Tips for creating font assets
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Characters in the font texture need some padding between them so they can be rendered separately. This padding is specified in pixels.
|
||||
Padding also creates room for the SDF gradient. The larger the padding, the smoother the transition, which allows for higher-quality rendering and larger effects, like thick outlines. A padding of 5 is often fine for a 512x512 texture.
|
||||
|
||||
|
||||
For most fonts, a 512x512 texture resolution is fine when including all ASCII characters.
|
||||
When you need to support thousands of character, you will have to use large textures. But even at maximum resolution, you might not be able to fit everything. In that case, you can split the characters by creating multiple font assets. Put the most often used characters in a main font Asset, and the others in a fallback font assets.
|
@@ -0,0 +1,52 @@
|
||||
|
||||
# Dynamic fonts assets
|
||||
Normally when you generate a font Asset using the Font Asset Creator, you choose which characters to include, and bake them into a Font Atlas texture.
|
||||
|
||||
Dynamic font assets work the other way around. Instead of baking characters into an atlas in advance, you start with an empty atlas to which characters are added automatically as you use them.
|
||||
|
||||
This makes dynamic fonts assets more flexible, but that flexibility comes at a cost.
|
||||
|
||||
* Dynamic fonts require more computational resources than static fonts.
|
||||
|
||||
* Dynamic font assets maintain a link to the original font file used to create them. That means:
|
||||
|
||||
* During development, you must keep the font file in the project. You cannot delete it as you can the source fonts of static font assets.
|
||||
* Source fonts of any dynamic font assets in your game are included in builds, which can increase build size.
|
||||
|
||||
|
||||
This has several uses, for example:
|
||||
|
||||
* Use dynamic fonts during development to capture characters you forgot to include in your baked font assets.
|
||||
|
||||
* Use dynamic fonts in runtime when you don't know in advance which characters the user will enter in a text field.
|
||||
|
||||
## Creating a dynamic font Asset
|
||||
|
||||
Empty font assets are dynamic by default. To create one:
|
||||
|
||||
* From Unity's main menu, choose **Assets > Create > TextMeshPro > Font Asset** or press **Ctrl/Cmd + Shift + F12**.
|
||||
|
||||
To make an existing font Asset dynamic:
|
||||
|
||||
1. Select Asset and open it in the Inspector.
|
||||
|
||||
1. Set the **Generation Settings > Atlas Population Mode** property to **Dynamic**.
|
||||
|
||||
## Resetting a dynamic font Asset
|
||||
|
||||
You reset TextMesh Pro dynamic font assets, the same way you reset other components: by choosing **Reset** from the gear icon menu or context menu in the Inspector.
|
||||
|
||||
[IMAGE]
|
||||
|
||||
However, instead of resetting all of the Asset's properties to their default values, the command affects only:
|
||||
|
||||
* The Font Atlas
|
||||
* The Character Table
|
||||
* The Glyph Table
|
||||
* The Glyph Adjustment Table (kerning)
|
||||
|
||||
These are reset to include only the characters/glyphs used by TextMesh Pro text objects that use the font Asset.
|
||||
|
||||
If the Asset is currently unused, TextMesh Pro resizes the atlas texture to 0 x 0 pixels.
|
||||
|
||||
**NOTE:** Resetting a static font Asset leaves the atlas texture as-is, but empties the character-, glyph-, and glyph adjustment tables.
|
@@ -0,0 +1,34 @@
|
||||
# Fallback font assets
|
||||
|
||||
A font atlas, and by extension a font Asset, can only contain a certain number of glyphs. The exact number depends on the font, the size of the atlas texture, and the settings you use when generating the atlas. The fallback font system allows you to specify other font assets to search when TextMesh Pro can't find a glyph in a text object's font Asset.
|
||||
|
||||
This is useful in a variety of situations, including:
|
||||
* Working with languages that have very large alphabets (Chinese, Korean, and Japanese, for example). Use fallback fonts to distribute an alphabet across several assets.
|
||||
|
||||
* Designing for mobile devices, where an imposed maximum texture size prevents you from fitting an entire set of glyphs in a single atlas of sufficient quality.
|
||||
|
||||
* Including special characters from other alphabets in your text.
|
||||
|
||||
## Local and general fallback font assets
|
||||
|
||||
Every font Asset can have its own list of fallback font assets. You set these in the [font Asset properties](FontAssetsProperties.md).
|
||||
|
||||
You can also set general fallback font assets that apply to every TextMesh Pro font Asset in your project. You set these in the [TextMesh Pro settings](Settings.md).
|
||||
|
||||
## The fallback chain
|
||||
|
||||
In addition to a text object's fallback fonts, TextMesh Pro searches several other assets for missing glyphs. Together, these assets form the fallback chain.
|
||||
|
||||
The table below lists the assets in the fallback chain in the order in which they are searched.
|
||||
|
||||
|Position:| Asset: | Defined in:|Notes:|
|
||||
|:-:|-|-||
|
||||
|1 | TextMesh Pro object's primary **Font Asset** | [Text object properties](TMPObjects.md) ||
|
||||
|2 | Primary font assets **Fallback Font Assets** | [Font Asset properties](FontAssetsProperties.md) |TexMesh Pro searches these assets in the order they're listed in the [font Asset properties](FontAssetsProperties.md). <br/><br/>The search is recursive, and includes each fallback Asset's fallback assets. |
|
||||
|3 | Text object's **Sprite Asset** | [Text object properties](TMPObjects.md) |When searching sprite assets, TextMesh Pro looks for sprites with an assigned unicode value that matches the missing character's unicode value.|
|
||||
|4 | General **Fallback Font Assets** | [TextMesh Pro settings](Settings.md) |TexMesh Pro searches these assets in the order they're listed in the [font Asset properties](FontAssetsProperties.md). <br/><br/>The search is recursive, and includes each fallback Asset's fallback assets. |
|
||||
|5 | **Default Sprite Asset** | [TextMesh Pro settings](Settings.md) |When searching sprite assets, TextMesh Pro looks for sprites with an assigned unicode value that matches the missing character's unicode value.|
|
||||
|6 | **Default Font Asset** | [TextMesh Pro settings](Settings.md) | |
|
||||
|7 | **Missing glyphs** character | [TextMesh Pro settings](Settings.md) | |
|
||||
|
||||
The fallback chain search is designed to detect circular references so each Asset in the chain is only searched once.
|
@@ -0,0 +1,26 @@
|
||||
# Line metrics.
|
||||
|
||||
TextMesh Pro sets line metrics automatically when you generate a font Asset.
|
||||
|
||||
If the generated values produce strange or incorrect results, you can tweak the line metrics settings to fine-tune the font.
|
||||
|
||||
Most line metric values are relative to the **Baseline**, which is the horizontal line that characters sit on.
|
||||
|
||||
- Values for above-the-baseline metrics, such as the **Ascender** height, are greater that the **Baseline** value.
|
||||
- Values for below-the-baseline metrics, such as the **Descender** height, are less than **Baseline** value.
|
||||
|
||||

|
||||
|
||||
|Metric:|Function:|
|
||||
|-|-|
|
||||
|**Line Height**|The distance between the tops of consecutive lines.<br/><br/>If you set the line height to a value greater than the combined size of the **Ascender** and **Descender**, it creates a gap between lines.<br/><br/>If you set a line height to a value less than the combined size of the ascender and descender results in potential overlap between characters on different lines.|
|
||||
|**Ascender**|The ascender height, which specifies how far characters can extend above the baseline. It corresponds to the top of a line.|
|
||||
|**Cap Height**|The height of capital letters from the baseline.|
|
||||
|**Baseline**|The baseline height.<br/><br/>The baseline is the horizontal line that characters sit on.|
|
||||
|**Descender**|The descender height, which specifies how far characters can extend below the baseline.|
|
||||
|**Underline Offset**|The position of underlines relative to the baseline.|
|
||||
|**Strikethrough Offset**|The position of strikethrough lines relative to the baseline.|
|
||||
|**Superscript/ Subscript Offset**|Adjust the baseline for superscript and subscript text.|
|
||||
|**Super/ Subscript Size**|The scale of superscript and subscript text relative to the normal font size.|
|
||||
|**Padding**|The amount of padding between characters in the font atlas texture.<br/><br/>TextMesh Pro sets this value when you generate the font Asset. It is not editable.|
|
||||
|**Width/Height**|The font atlas texture's width and height, in pixels.<br/><br/>TextMesh Pro sets these values when you generate the font Asset. They are not editable.|
|
@@ -0,0 +1,157 @@
|
||||
# Font Asset Properties
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||

|
||||
|
||||
Properties are divided into the following sections:
|
||||
|
||||
||||
|
||||
|-|-|-|
|
||||
|**A** | **[Face Info](#face-info)** ||
|
||||
|**B** | **[Generation Settings](#generation-settings)** ||
|
||||
|**C** | **[Atlas & Material](#atlas-material)** ||
|
||||
|**D** | **[Font Weights](#font-weights)** ||
|
||||
|**E** | **[Fallback Font Assets](#fallback-font-assets)** ||
|
||||
|**F** | **[Character Table](#character-table)** | |
|
||||
|**G** | **[Glyph Table](#glyph-table)** ||
|
||||
|**H** | **[Glyph Adjustment Table](#glyph-adjustment-table)** ||
|
||||
|
||||
### Face Info
|
||||
|
||||
The Face Info properties control the font's line metrics. They also include read-only properties that the [Font Asset Creator](FontAssetsCreator.md) generates when you create the Asset.
|
||||
|
||||

|
||||
_Line metrics_
|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Update Texture Atlas**|Open the [Font Asset Creator](FontAssetsCreator.md) pre-configured to modify and regenerate this font Asset.|
|
||||
|**Family Name**|The name of the font used to create this font Asset.<br/><br/>TextMesh Pro sets this value when you generate the font Asset. You cannot change it manually.|
|
||||
|**Style Name**|The style of the font used to create this font Asset. For example, **Regular**, **Bold**, **Italic**, and so on.<br/><br/>TextMesh Pro sets this value when you generate the font Asset. You cannot change it manually.|
|
||||
|**Point Size**|The font size in points.<br/><br/>TextMesh Pro bakes this value into the atlas texture when you generate the font Asset. You cannot change it manually.|
|
||||
|**Scale**|Scales the font by this amount. For example, a value of **1.5** scales glyphs to 150% of their normal size.|
|
||||
|**Line Height**|Controls the distance between the tops of consecutive lines.<br/><br/>If you set a line height greater than the sum of the **Ascent Line** and **Descent Line** values, it creates in a gap between lines.<br/><br/>If you set a line height greater than the sum of the **Ascent Line** and **Descent Line** values, characters on different lines might overlap.|
|
||||
|**Ascent Line**|Controls the maximum distance that glyphs can extend above the baseline. It corresponds to the top of a line.|
|
||||
|**Cap Line**|Controls the distance between the base line and the tops of uppercase glyphs.|
|
||||
|**Mean Line**|Controls the maximum height for non-ascending lowercase glyphs (for example. "a" and "c", but not "b" and "d," which have ascenders).<br/><br/>The tops of rounded glyphs sometimes extend a slightly above the mean line.|
|
||||
|**Baseline**|Controls the height of the baseline.<br/><br/>The baseline is the horizontal line that characters sit on.|
|
||||
|**Descent Line**|Controls the maximum distance that glyphs can extend below the baseline.|
|
||||
|**Underline Offset**|Controls the position of underlines relative to the baseline.|
|
||||
|**Underline Thickness** | Controls the thickness of underlines. |
|
||||
|**Strikethrough Offset**|Controls the position of strikethrough lines relative to the baseline.|
|
||||
|**Superscript Offset**| Offsets superscript text from the baseline.|
|
||||
|**Superscript Size**|Scales superscript text relative to the normal font size.|
|
||||
|**Subscript Offset**| Offsets subscript text from the baseline.|
|
||||
|**Subscript Size**|Scales subscript text relative to the normal font size.|
|
||||
| **Tab Width** | Specifies the width of a TAB character. |
|
||||
|
||||
### Generation Settings
|
||||
|
||||
The [Font Asset Creator](FontAssetsCreator.md) generates these values when you generate the Font Asset.
|
||||
|
||||
> [!NOTE]
|
||||
> When the **Atlas Population Mode** is set to **Dynamic**, you can change the atlas size without regenerating the atlas.
|
||||
|
||||
|Property:||Function:|
|
||||
|-|-|-|
|
||||
|**Source Font File** || |
|
||||
|**Atlas Population Mode** || |
|
||||
| |Dynamic| |
|
||||
| |Static| |
|
||||
|**Atlas Render Mode** || |
|
||||
||SMOOTH|Renders the atlas to an antialiased bitmap.|
|
||||
||RASTER|Renders the atlas to a non-antialiased bitmap.|
|
||||
||SMOOTH_HINTED|Renders the atlas to an antialiased bitmap, and aligns character pixels with texture pixels for a crisper result.|
|
||||
||RASTER_HINTED|Renders the atlas to a non-antialiased bitmap and aligns character pixels with texture pixels for a crisper result.|
|
||||
| |SDF| Renders the atlas using a slower, but more accurate SDF generation mode, and no oversampling. |
|
||||
| |SDFAA| Renders the atlas using a faster, but less accurate SDF generation mode. It produces font atlases that are sufficient for most situations.|
|
||||
| |SDFAA_HINTED| Renders the atlas using a faster, but less accurate SDF generation mode, and aligns character pixels with texture pixels for a crisper result.. It produces font atlases that are sufficient for most situations |
|
||||
| |SDF8| Renders the atlas using a slower, but more accurate SDF generation mode, and 8x oversampling. |
|
||||
| |SDF16| Renders the atlas using a slower, but more accurate SDF generation mode, and 16x oversampling. |
|
||||
| |SDF32| Renders the atlas using a slower, but more accurate SDF generation mode, and 32x oversampling. Use this setting for fonts with complex or small characters. |
|
||||
|**Sampling Point Size** || The size, in points, of characters in the font texture. |
|
||||
|**Padding**||The amount of padding between characters in the font atlas texture.<br/><br/>This value is set when you generate the font Asset, and is not editable.|
|
||||
|**Atlas Width/Height**||The width and height the font atlas texture.<br/><br/>Choose for each dimension, choose one of the available values from the drop-down menu.|
|
||||
|**Multi Atlas Textures** | | |
|
||||
|
||||
|
||||
### Atlas & Material
|
||||
|
||||
This section lists the sub-assets that the [Font Asset Creator](FontAssetsCreator.md) creates when you generate the Asset. Do not edit these directly.
|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|Font Atlas|The font texture atlas created when you generated the font Asset.|
|
||||
|Font Material|The font material created when you generated the font Asset.|
|
||||
|
||||
### Font Weights
|
||||
|
||||
The Font Weights options control the appearance of bold and italicized text. There are two ways of doing this:
|
||||
|
||||
1. Create different bold and italic variants of the font Asset, and add them to the **Font Table**.<br/><br/>You can specify regular and italic fonts for weights ranging from 100 (Thin) to 900 (Black).
|
||||
|
||||
1. Define "fake" bolding and italicization by setting the **Font Weight > Italic Style** and **Bold Weight** properties.<br/><br/>These settings tell TextMesh Pro how to adjust characters in the current font Asset when you bold or italicize text.
|
||||
|
||||
|
||||
|Property:||Function:|
|
||||
|-|-|-|
|
||||
|**Font Table**||Specify font assets to use for the following font variants.<br/><br/>100 - Thin<br/>200 - Extra-Light<br/>300 - Light<br/>400 - Regular (italic only)<br/>500 - Medium<br/>600 - Semi-Bold<br/>700 - Bold<br/>800 - Heavy<br/>900 - Black <br/><br/> * **400 - Regular > Regular Typeface** is the current font Asset. You cannot change it.<br/><br/> If you don't specify font assets, TextMesh Pro "fakes" bolding and italicization according to the rest of the the **Font Weights** settings. Using "faked" font weights limits you to regular and italic versions of normal and bold text (equivalent to weights of 400 and 700 respectively). |
|
||||
|**Normal Weight**||Set the regular font weight to use when no font Asset is available.|
|
||||
|**Bold Weight**||Set the bold font weight assumed when no font Asset is available.|
|
||||
|**Spacing Offset**||Add space between characters when using the normal text style.|
|
||||
|**Bold Spacing**||Add space between characters when using the fake bold text style (meaning you haven’t specified a Bold font Asset).|
|
||||
|**Italic Style**||If you don’t specify a font Asset for **400 - Regular > Italic Style** variant, TextMeshPro slanting the character sprites in the Normal Style font Asset by an amount defined in the **Italic Style** setting.<br/><br/>Set this value to control the |
|
||||
|**Tab Multiple**||Set the tab size. This value is multiplied by the width of the font's space character to calculate the tab size used.|
|
||||
|
||||
<a name="FallbackFontAssets"></a>
|
||||
### Fallback Font Assets
|
||||
|
||||
Each font Asset contains a limited number of characters. When you use a character that the current Font Asset does not contain, TextMesh Pro searches the fallback font list until it finds a font Asset that includes it. The text object then uses that font to render the character.
|
||||
|
||||
You can use this feature to distribute fonts over multiple textures, or use different fonts for specific characters. Be aware that searching the list for missing characters requires extra computing resources, and that using additional fonts requires additional draw calls.
|
||||
|
||||
For more information about how fallback fonts work, see [The Fallback font chain](FontAssetsFallback.md).
|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Fallback Font Asset list**|Manage the fallback fonts for this font Asset.<br/><br/>Click **+** and **-** to add and remove font slots.<br/><br/>Click the circle icon next to a font to open an Object Picker where you can choose a font Asset.<br/><br/>Drag the handles on the left side of any font Asset to reorder the list.|
|
||||
|
||||
### Character Table
|
||||
|
||||
|
||||
|
||||
### Glyph Table
|
||||
|
||||
The glyph table contains information about each of the glyphs in the Font Asset. You can adjust the attributes of individual glyphs, which is useful when you need to correct problems that can occur when TextMesh Pro imports font data.
|
||||
|
||||
|Property:||Function:|
|
||||
|-|-|-|
|
||||
|**Glyph Search**||Search the character list by character, ASCII value, or Hex value.<br/><br/>Search results are ordered by ASCII value, lowest to highest.|
|
||||
|**Previous Page/Next Page**||Long character lists are split into pages, which you can navigate using these buttons (also located at the bottom of the section).|
|
||||
|**Glyph Properties**||Displays a single glyph’s properties. Each glyph has its own entry.<br/><br/>Click an entry to make it active. You can then edit the glyph, copy it, or remove it from the list.|
|
||||
||Ascii|Displays the character’s ASCII decimal value.|
|
||||
||Hex|Displays the character’s Unicode Hex value.|
|
||||
||Char|Displays the character.|
|
||||
||X, Y, W, H|Define the rectangular area the character occupies in the font atlas.|
|
||||
||OX, OY|Control the placement of the character's sprite, defined at its top-left corner relative to its origin on the baseline.|
|
||||
||ADV|Specify how far to advance along the baseline before placing the next character.|
|
||||
||SF|Change this scaling factor value to adjust the size of the character.|
|
||||
|**Copy to**||Duplicate this glyph.<br/><br/>To make a copy, enter an unused Unicode (Hex) ID in the text field and click **Copy to**.|
|
||||
|**Remove**||Remove this glyph from the list.|
|
||||
|
||||
### Glyph Adjustment Table
|
||||
|
||||
The glyph adjustment table controls spacing between specific pairs of characters. Some fonts include kerning information, which is imported automatically. You can add kerning pairs for fonts that don’t include them.
|
||||
|
||||
|Property:||Function:|
|
||||
|-|-|-|
|
||||
|**Adjustment Pair Search**||Search the adjustment table by character or ASCII value.<br/><br/>Search results include entries where either the left or right character matches the search string.<br/><br/>Search results are ordered by the ASCII value of the left character, lowest to highest.|
|
||||
|**Previous Page/Next Page**||Long adjustment tables are split into pages, which you can navigate using these buttons (also located at the bottom of the section).|
|
||||
|**Glyph Properties**||Displays a single glyph’s properties. Each glyph has its own entry.<br/><br/>Click an entry to make it active. You can then edit the glyph, copy it, or remove it from the list.|
|
||||
||Char (left and right)|Display the left and right characters for the kerning pair.<br/><br/>When you add anew kerning pair, you can specify the left and right characters to use by typing them in these fields.|
|
||||
||ID (left and right)|Display the left and right characters’ ASCII decimal values.<br/><br/>When you add anew kerning pair, you can specify the left and right characters to use by typing their ASCII values in these fields.|
|
||||
||OX, OY|For each character in the kerning pair, set the horizontal (**X**) and vertical (**Y**) offset relative to the character's initial position.|
|
||||
||AX|For each character in the kerning pair, specify how far to advance along the baseline before placing the next character.<br/><br/>Practically speaking, the left **AX** value controls the distance between the characters in the kerning pair, while the right **AX** value controls the distance between the kerning pair and the next character.|
|
||||
|**Add New Kerning Pair**||Add a new entry to the Glyph Adjustment Table.<br/><br/>You cannot duplicate an existing entry.|
|
@@ -0,0 +1,16 @@
|
||||
## About SDF fonts
|
||||
|
||||
TextMesh Pro takes advantage of Signed Distance Field (SDF) rendering to generate font assets that look crisp when you transform and magnify them, and support effects such as outlines and drop shadows.
|
||||
|
||||
Unlike black and white bitmap font textures, SDF font assets contain contour distance information. In font atlases, this information looks like grayscale gradients running from the middle of each glyph to a point past its edge. The gradient's mid-point corresponds to the edge of the glyph.
|
||||
|
||||
The images below show bitmap and SDF font assets and the rendered text they produce. Notice that the bitmap fonts produce text whose edges are more or less jagged/blurry, depending on how far the text is from the camera, and how it is transformed/distorted. The SDF font, on the other hand produces text with completely smooth edges regardless of the distance from the camera.
|
||||
|
||||

|
||||
_A bitmap font, atlas texture and rendered result_
|
||||
|
||||

|
||||
_A smoothed bitmap, atlas texture and rendered result_
|
||||
|
||||

|
||||
_An SDF font, atlas texture and rendered result_
|
@@ -0,0 +1,88 @@
|
||||
# Rich Text
|
||||
|
||||
Rich text tags alter the appearance and layout of text by supplementing or overriding TextMesh Pro GameObject properties. For example, you can use rich text tags to change the color or alignment of some, or all of your text without modifying its properties or material.
|
||||
|
||||
**To use rich text tags:**
|
||||
* Enter any [supported rich text tags](RichTextSupportedTags.md) in the TextMeshPro [**Text** input field](TMPObjectUIText.md#text), inline with the text you want to display.
|
||||
|
||||
**To disable rich text for a TextMesh Pro object:**
|
||||
* Open the TextMesh Pro GameObject in the Inspector, and disable the **Text Mesh Pro > Extra Settings > Rich Text** property.
|
||||
|
||||
## Rich Text Tags
|
||||
|
||||
Rich text tags are similar to HTML or XML tags, but have less strict syntax.
|
||||
|
||||
A simple tag consists of only the tag name, and looks like this:
|
||||
|
||||
`<tag>`
|
||||
|
||||
For example, the `<b>` tag makes text bold, while the `<u>` tag underlines it.
|
||||
|
||||
### Tag attributes and values
|
||||
|
||||
Some tags have additional values or attributes, and look like this:
|
||||
|
||||
`<tag="value">` or `<tag attribute="value">`
|
||||
|
||||
For example `<color=”red”>` makes text red. `Red` is the `color` tag’s value.
|
||||
|
||||
Similarly `<sprite index=3>` inserts the fourth sprite from the default Sprite Asset. `index` is an attribute of the `sprite` tag, and its value is `3`.
|
||||
|
||||
A tag, including its attributes, can be up to 128 characters long.
|
||||
|
||||
The table below lists possible attribute/value types.
|
||||
|
||||
|Attribute/value type:|Example|
|
||||
|-------------|-------------|
|
||||
|Decimals|`0.5`|
|
||||
|Percentages|`25%`|
|
||||
|Pixel values|`5px`|
|
||||
|Font units|`1.5em`|
|
||||
|Hex color values|`#FFFFFF` (RGB)<br/>`#FFFFFFFF` (RGBA)<br/>`#FF` (A)|
|
||||
|Names|Both `<link=”ID”>` and `<link=ID>` are valid.|
|
||||
|
||||
## Tag scope and nested tags
|
||||
|
||||
Tags have a scope that defines how much of the text they affect. Most of the time, a tag added to a given point in the text affects all of the text from that point forward.
|
||||
|
||||
For example, adding the tag `<color="red">` at the beginning of the text affects the entire text block:
|
||||
|
||||
`<color="red">This text is red`
|
||||
|
||||
<br/>
|
||||
_Successive color tags_
|
||||
|
||||
Adding the same tag in the middle of the text block affects only the text between the tag and the end of the block :
|
||||
|
||||
`This text turns<color="red"> red`
|
||||
|
||||
<br/>
|
||||
_Successive color tags_
|
||||
|
||||
If you use the same tag more than once in a text block, the last tag supersedes all previous tags of the same type.
|
||||
|
||||
`<color="red">This text goes from red<color="green"> to green`
|
||||
|
||||
<br/>
|
||||
_Successive color tags_
|
||||
|
||||
You can also limit the scope of most tags using a closing tag. Closing tags contain only a forward slash and the tag name, like this: `</tag>`
|
||||
|
||||
Tags can also be _nested_ so one tag’s scope is within another tag’s scope. For example:
|
||||
|
||||
```
|
||||
<color=red>This text is <color=green>mostly </color>red.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Successive color tags_
|
||||
|
||||
The first `<color>` tag’s scope is the entire text block. The the second `<color>` tag has a closing tag that limits its scope to one word.
|
||||
|
||||
When you nest tags, you don't have to close their scopes in the same order that you started them.
|
||||
|
||||
## Rich-text tags and right-to-left text
|
||||
|
||||
TextMesh Pro's right-to-left editor does not distinguish between regular text and rich text tags. Rich text tags that you enter in the right-to-left editor do not work unless you type them right-to-left as well.
|
||||
|
||||
The easiest way to apply rich text tags to right-to-left text is to type the text in the right-to-left editor, and then apply the tags in the regular editor.
|
@@ -0,0 +1,24 @@
|
||||
# Text Alignment
|
||||
|
||||
Each text object has an overall alignment, but you can override this with `<align>` tags. All [horizontal alignment options](TMPObjectUIText.md#alignment) are available except for **Geometry Center**.
|
||||
|
||||
Normally you put these tags at the start of a paragraph. Successive alignment scopes don't stack. If you put multiple alignment tags on the same line, the last one overrides the others.
|
||||
|
||||
The closing `</align>` tag reverts back to the object's overall alignment.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<align="left"><b>Left-aligned</b>
|
||||
|
||||
<align="center"><b>Center-aligned</b>
|
||||
|
||||
<align="right"><b>Right-aligned</b>
|
||||
|
||||
<align="justified"><b>Justified:</b> stretched to fill the display area (except for the last line)
|
||||
|
||||
<align="flush"><b>Flush:</b> stretched to fill the display area (including the last line)
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Text Alignment_
|
@@ -0,0 +1,14 @@
|
||||
# Bold and Italic
|
||||
|
||||
You can apply bold and italic styling to your text with the `<b>` and `<i>` tags respectively. The [font Asset](FontAssetsProperties.md) defines how bold and italicized text looks when rendered.
|
||||
|
||||
The closing `</b>` and `</i>` tags revert to the text's normal appearance.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
The <i>quick brown fox</i> jumps over the <b>lazy dog</b>.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Bold and italic._
|
@@ -0,0 +1,16 @@
|
||||
# Character Spacing
|
||||
|
||||
The `<cspace>` tag allows you to adjust character spacing, either absolute or relative to the original font Asset. You can use pixels or font units.
|
||||
|
||||
Postive adjustments push the characters apart, negative adjustments pull them together.
|
||||
|
||||
The closing `</cspace>` tag reverts back to the font's normal spacing.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<cspace=1em>Spacing</cspace> is just as important as <cspace=-0.5em>timing.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Character spacing_
|
@@ -0,0 +1,25 @@
|
||||
# Text Color
|
||||
|
||||
There are two ways to change text color with color tags:
|
||||
|
||||
* Use named colors, as in `<color="colorName">`<br/><br/>
|
||||
The following color names are supported: `black`, `blue`, `green`, `orange`, `purple`, `red`, `white`, and `yellow`.<br/><br/>
|
||||
* Use hexadecimal values, as in `<color=#FFFFFF>` or `<color=#FFFFFFFF>` if you also want to define the alpha value.
|
||||
|
||||
If you apply successive `<color>` tags in the same text, the last one takes precedence over the others until you either add another `<color>`tage or use a closing `</color>` tag to end the current color's scope.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<color="red">Red <color=#005500>Dark Green <#0000FF>Blue <color=#FF000088>Semitransparent Red
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Successive color tags_
|
||||
|
||||
```
|
||||
<color="red">Red, <color="blue">Blue,</color> and red again.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Closing color tag_
|
@@ -0,0 +1,22 @@
|
||||
# Font
|
||||
|
||||
You can switch to a different font using `<font="fontAssetName">`.
|
||||
|
||||
The font you specify replaces the default font until you insert a closing `<font>` tag. Font tags can be nested.
|
||||
|
||||
You can also use the `material` attribute to switch between different materials for a single font.
|
||||
|
||||
You must place the font and material assets in the directory that is specified in the **TextMesh Settings > Default Font Asset > Path** field. The default path is `Assets/TextMesh Pro/Resources/Fonts & Materials`. If you don't have it in your project, select **Window > TextMeshPro > Import TMP Essential Resources** to add it. For more information, refer to [Importing required resources into projects](index.md).
|
||||
|
||||
To revert to the default font:
|
||||
* Close all open font tags using `</font>` tag
|
||||
* Use another `<font>` tag and set the font Asset name to `default`
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Would you like <font="Impact SDF">a different font?</font> or just <font="NotoSans" material="NotoSans Outline">a different material?
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Mixing fonts and materials_
|
@@ -0,0 +1,26 @@
|
||||
# Font weight
|
||||
|
||||
Use the `<font-weight>` tag to switch between the font weights available for the current [Font Asset](FontAssets.md).
|
||||
|
||||
You specify the weight using its numeric value, for example `400` for **normal**, `700` for **bold**, and so on.
|
||||
|
||||
You can only apply font weights defined in the [Font Asset properties](FontAssetsProperties.md#FontWeights). If you have not defined any font weights, you can still use values of **400** and **700** to apply the multipliers set in the **Normal Weight** and **Bold Weight** properties.
|
||||
|
||||
The closing `</font-weight>` tag reverts to the original font specified for the TextMesh Pro object.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<font-weight="100">Thin</font-weight>
|
||||
<font-weight="200">Extra-Light</font-weight>
|
||||
<font-weight="300">Light</font-weight>
|
||||
<font-weight="400">Regular</font-weight>
|
||||
<font-weight="500">Medium</font-weight>
|
||||
<font-weight="600">Semi-Bold</font-weight>
|
||||
<font-weight="700">Bold</font-weight>
|
||||
<font-weight="800">Heavy</font-weight>
|
||||
<font-weight="900">Black</font-weight>
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Font weights_
|
@@ -0,0 +1,36 @@
|
||||
# Gradient
|
||||
|
||||
The `<gradient>` tag applies a pre-defined gradient preset to text.
|
||||
|
||||
For more information about creating gradient presets, see the documentation on [Gradient Presets](ColorGradientsPresets.md).
|
||||
|
||||
The closing `</gradient>` tag reverts to the TextMesh pro object's original color.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Apply<b>
|
||||
<gradient="Yellow to Orange - Vertical">any
|
||||
<gradient="Light to Dark Green - Vertical">gradient
|
||||
<gradient="Blue to Purple - Vertical">preset</gradient>
|
||||
</b>to your text
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Successive gradient tags ended with a closing `</gradient>`_
|
||||
|
||||
**Note:** When you apply a gradient using this tag, it's multiplied by the TextMesh Pro object's current vertex colors.
|
||||
|
||||
```
|
||||
This <gradient="Light to Dark Green - Vertical">Light to Dark Green gradient</gradient> is tinted by the red vertex color
|
||||
```
|
||||
<br/>
|
||||
_Applying a green gradient to red text_
|
||||
|
||||
To apply the pure gradient to a selection of text, you can use a `<color>` tag to "reset" the color to white before applying the gradient.
|
||||
|
||||
```
|
||||
This <color=#FFFFFFFF><gradient="Light to Dark Green - Vertical">Light to Dark Green gradient</gradient></color> is no longer tinted by the red vertex color
|
||||
```
|
||||
<br/>
|
||||
_"Resetting" the text's vertex color before applying a gradient_
|
@@ -0,0 +1,17 @@
|
||||
# Indentation
|
||||
|
||||
The `<indent>` tag controls the horizontal caret position the same way the [`<pos>`](RichTextPos.md) tag does, but the effect persists across lines.
|
||||
|
||||
Use this tag to create text patterns, such as bullet points, that work with word-wrapping.
|
||||
|
||||
You specify indentation in pixels, font units, or percentages.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
1. <indent=15%>It is useful for things like bullet points.</indent>
|
||||
2. <indent=15%>It is handy.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Using indentation to make a list._
|
@@ -0,0 +1,20 @@
|
||||
# Lowercase, Uppercase, and Smallcaps
|
||||
|
||||
The `<lowercase>`, `<uppercase>`, `<allcaps>` and `<smallcaps>` tags alter the capitalization of your text before rendering. The text in the **Text** field remains as you entered it.
|
||||
|
||||
* The `<lowercase>` and `<uppercase>` tags work as you would expect, converting to all capitals or no capitals before rendering.
|
||||
|
||||
* The `<allcaps>` tag is functionally identical to `<uppercase>`.
|
||||
|
||||
* The `<smallcaps>` tag works like `<uppercase>`, but also reduces the size of all characters that you entered in lowercase.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<lowercase>Alice and Bob watched TV.</lowercase>
|
||||
<uppercase>Alice and Bob watched TV.</uppercase>
|
||||
<allcaps>Alice and Bob watched TV.</allcaps>
|
||||
<smallcaps>Alice and Bob watched TV.</smallcaps>
|
||||
```
|
||||
<br/>
|
||||
_Modifying capitalization._
|
@@ -0,0 +1,14 @@
|
||||
# Line Break
|
||||
|
||||
Use the `<br>` tag to force a line break in text.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Add line breaks wherever you want
|
||||
|
||||
Add line breaks <br>wherever <br>you <br>want
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Adding line breaks_
|
@@ -0,0 +1,22 @@
|
||||
# Line Height
|
||||
|
||||
Use the `<line-height>` tag to manually control line height. The line-height controls how far down from the current line the next line starts. It does not change the current line.
|
||||
|
||||
Smaller values pull lines closer together. Larger values push them farther apart.
|
||||
|
||||
You can specify the line height in pixels, font units, or percentages.
|
||||
|
||||
Adjustments you make using this tag are relative to the line-height specified in the [Font Asset](FontAssetsProperties.md#FaceInfo). The `</line-height>` closing tag reverts to this height.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Line height at 100%
|
||||
<line-height=50%>Line height at 50%
|
||||
<line-height=100%>Rather cozy.
|
||||
<line-height=150%>Line height at 150%
|
||||
Such distance!
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Different line heights_
|
@@ -0,0 +1,16 @@
|
||||
# Line Indentation
|
||||
|
||||
The `<line-indent>` tag inserts horizontal space directly after it, and before the start of each new line. It only affects manual line breaks (including line breaks created with the [`<br>` tag](RichTextLineBreak.md), not word-wrapped lines.
|
||||
|
||||
You can specify the indentation in pixels, font units, or percentages.
|
||||
|
||||
The `</line-indent>` closing tag ends the indentation of lines.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<line-indent=15%>This is the first line of this text example.
|
||||
This is the second line of the same text.
|
||||
```
|
||||
<br/>
|
||||
_Indent every new line, with one tag_
|
@@ -0,0 +1,7 @@
|
||||
# Text Link
|
||||
|
||||
You can use `<link="ID">my link</link>` to add link metadata to a text segment. The link ID should be unique to allow you to retrieve its ID and link text content when the user interacts with your text.
|
||||
|
||||
You do not have to give each link a unique ID. You can reuse IDs when it makes sense, for example when linking to the same data multiple times. The `linkInfo` array contains each ID only once.
|
||||
|
||||
While this link enables user interaction, it does not change the appearance of the linked text. You have to use other tags for that.
|
@@ -0,0 +1,19 @@
|
||||
# Margin
|
||||
|
||||
You can increase the horizontal margins of the text with the `<margin>` tag.
|
||||
|
||||
If you only want to adjust the left or right margin, you can use the `<margin-left>` or `<margin-right>` tag.
|
||||
|
||||
You can specify the margins in pixels, font units, and percentages. Negative values have no effect.
|
||||
|
||||
Adjustments you make using this tag are relative to the margins specified in the [TexMesh Pro object](TMPObjectUIText.md#extra-settings). The `</margin>` closing tag reverts to this value.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Our margins used to be very wide.
|
||||
<margin=5em>But those days are long gone.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Adjusting margins_
|
@@ -0,0 +1,16 @@
|
||||
# Mark
|
||||
|
||||
The `<mark>` tag adds an overlay on top of the text. You can use it to highlight portions of your text.
|
||||
|
||||
Because markings are overlaid on the text, you have to give them a semitransparent color for the text to show through. You can do this by specifying the color using a hex value that includes Alpha.
|
||||
|
||||
You cannot combine marks. Each tag affects the text between itself and the next `<mark>` tag or a closing `</mark>` tag.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Text <mark=#ffff00aa>can be marked with</mark> an overlay.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Marked text_
|
@@ -0,0 +1,16 @@
|
||||
# Monospacing
|
||||
|
||||
You can override a font's character spacing and turn it into a monospace font with the `<mspace>` tag. This gives all characters the same amount of horizontal space.
|
||||
|
||||
You can specify the character width in pixels or font units.
|
||||
|
||||
The `</mspace>` closing tag clears all monospace overrides.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Any font can become <mspace=2.75em>monospace, if you really want it.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Treating a font as monospace_
|
@@ -0,0 +1,16 @@
|
||||
# No Break
|
||||
|
||||
Use the `<nobr>` tag to keep specific words together, and not be separated by word wrapping.
|
||||
|
||||
The closing `</nobr>` tag reverts to the default behavior of allowing words to break where the line wraps.
|
||||
|
||||
If you apply the `<nobr>` tag to a segment of text that is too big to fit on one line, the segment will break wherever the line wraps.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
You don't want <nobr>I M P O R T A N T</nobr> things to be broken up.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_The important parts stay together_
|
@@ -0,0 +1,14 @@
|
||||
# Noparse
|
||||
|
||||
The `<noparse>` tag creates a scope that TextMesh Pro does not parse.
|
||||
|
||||
This is useful for rendering text that TextMesh Pro normally interprets as a rich text tag, without disabling rich text tags.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Use <noparse><b></noparse> for <b>bold</b> text.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Prevent parsing of some tags_
|
@@ -0,0 +1,12 @@
|
||||
# Text Opacity (Alpha)
|
||||
|
||||
Use the `<alpha>` tag to change text opacity. It works with hexadecimal values.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<alpha=#FF>FF <alpha=#CC>CC <alpha=#AA>AA <alpha=#88>88 <alpha=#66>66 <alpha=#44>44 <alpha=#22>22 <alpha=#00>00
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Successive `<alpha>` tags_
|
@@ -0,0 +1,5 @@
|
||||
# Page Break
|
||||
|
||||
You can use the `<page>` tag to insert page breaks in your text. This cuts the text into separate blocks.
|
||||
|
||||
For page breaks to work, you must set the TextMesh Pro object's [**Overflow** mode](TMPObjectUIText.md#wrapping) to **Page**.
|
@@ -0,0 +1,21 @@
|
||||
# Horizontal Position
|
||||
|
||||
The `<pos>` tag gives you direct control over the horizontal caret position. This works best with horizontal alignment.
|
||||
|
||||
The `<pos>` tag's position in the line has no effect on the caret position.
|
||||
|
||||
This tag is best used with left alignment.
|
||||
|
||||
You can specify the horizontal position in pixels, font units, or percentages.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
at <pos=75%>75%
|
||||
at <pos=25%>25%
|
||||
at <pos=50%>50%
|
||||
at 0%
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Setting caret positions_
|
@@ -0,0 +1,28 @@
|
||||
# Rotate
|
||||
|
||||
Use the `<rotate>` tag to rotate each character about its center. Specify the amount of rotation in degrees. Positive values rotate characters counter-clockwise. Negative values rotate them clockwise.
|
||||
|
||||
Rotation affects the spacing between characters, and may cause characters to overlap in some cases. Use the [`<cspace>`](RichTextCharacterSpacing) tag to correct character spacing as needed.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Rotate text <rotate="-10">counter-clockwise</rotate> or <rotate="10">clockwise</rotate>
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Text rotated counter-clockwise (left) and clockwise (right)_
|
||||
|
||||
```
|
||||
Rotate text <rotate="45">counter-clockwise</rotate>
|
||||
```
|
||||
|
||||
<br/>
|
||||
_More rotation makes it more likely that characters overlap_
|
||||
|
||||
```
|
||||
Rotate text <cspace="15"><rotate="45">counter-clockwise</rotate></cspace>
|
||||
```
|
||||
|
||||
<br/>
|
||||
_The `<cspace>` tag adjusts character spacing, and can help correct overlap caused by rotation_
|
@@ -0,0 +1,18 @@
|
||||
# Font Size
|
||||
|
||||
Use the `<size>` tag to adjust the font size of your text.
|
||||
|
||||
You can specify the new size in pixels (`px`), font units (`em`), or percentages (`%`).
|
||||
|
||||
Pixel adjustments can be absolute (`5px`, `10px`, and so on) or relative (`+1` or `-1`, for example). Relative sizes are based on the original font size, so they're not cumulative.
|
||||
|
||||
Font unit adjustments are always relative to the original font size. For example, `<size=1em>` sets the font size to the original size, `<size=2em>` doubles the size, and `<size=0.5em>` halves it.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<size=100%>Echo <size=80%>Echo <size=60%>Echo <size=40%>Echo <size=20%>Echo
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Adjusting font size_
|
@@ -0,0 +1,16 @@
|
||||
# Horizontal Space
|
||||
|
||||
The `<space>` tag inserts a horizontal offset, as if you inserted multiple spaces.
|
||||
|
||||
You can specify the offset in pixels or font units.
|
||||
|
||||
When the `<space>` tag touches adjacent text, it appends or prepends the offset to that text, which affects how the text wraps. If you do not want the offset to wrap independently of adjacent text, make sure to add a space character on either side of the `<space>` tag.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Give me some <space=5em> space.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Adding some space_
|
@@ -0,0 +1,18 @@
|
||||
# Sprite
|
||||
|
||||
The `<sprite>` tag inserts images from a [Sprite Asset](Sprites.md) into your text. Sprite assets must be located in the folder specified in the [TextMesh Pro settings](Settings.md).
|
||||
|
||||
You can access sprites from the default sprite assets by index `<sprite index=1>` or by name `<sprite name="spriteName">`. When accessing a sprite from the default Asset by index, you can also use the index shorthand, `<sprite=1>`,
|
||||
|
||||
To use sprites from a different Asset, specify the Asset before accessing the sprites by index `<sprite="assetName" index=1>` or by name `<sprite="assetName" name="spriteName">`.
|
||||
|
||||
Adding the `tint=1` attribute to the tag tints the sprite with the [TextMesh Pro object's](TMPObjectUIText.md#Color) **Vertex Color**. You can choose a different color by adding a `color` attribute to the tag (`color=#FFFFFF`).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Sprites! <sprite=0> More sprites! <sprite index=3> And even more! <sprite name="Default Sprite Asset_4" color=#55FF55FF>
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Inserting sprites from the default sprite asset_
|
@@ -0,0 +1,16 @@
|
||||
# Strikethrough and Underline
|
||||
|
||||
You can add additional lines that run along your text.
|
||||
|
||||
- The `<underline>` tag draws the line slightly below the baseline to underline the text. The vertical offset is defined in the [Font Asset](FontAssetsProperties.md#FaceInfo).
|
||||
|
||||
- The `<strikethrough>` tag places the line slightly above the baseline so it crosses out the text.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
The <s>quick brown</s> fox jumps over <u>the lazy dog</u>.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Strikethrough and underline_
|
@@ -0,0 +1,15 @@
|
||||
# Style
|
||||
|
||||
Apply custom styles using the `<style>` tag. For more information about creating custom styles, see the documentation on [Style Sheets](StyleSheets.md).
|
||||
|
||||
The opening `<style>` tag must contain the style name. The closing `</style>` tag, which simply closes the last style opened.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
<style="Title">Styles</style>
|
||||
You can create your own.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Applying a custom style_
|
@@ -0,0 +1,14 @@
|
||||
# Subscript and Superscript
|
||||
|
||||
Use the `<sub>` and `<sup>` tags to render text as superscript or subscript. This is often used in scientific notation and ordinal numbering (1st, 2nd, etc.).
|
||||
|
||||
Set the offset and size for sub- and superscript in the [Font Asset](FontAssetsProperties.md#FaceInfo).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
We have 1m<sup>3</sup> of H<sub>2</sub>O.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Subscript and superscript_
|
@@ -0,0 +1,5 @@
|
||||
# Supported Rich Text Tags
|
||||
|
||||
The following table is a quick reference of supported rich text tags. For details, see the main pages for specific tags.
|
||||
|
||||
[!include[](include-rich-text-tags.md)]
|
@@ -0,0 +1,16 @@
|
||||
# Vertical Offset
|
||||
|
||||
Use the `<voffset>` tag to offset the text baseline vertically. This adjusts the line height accordingly to accommodate the text's offset position. You can compensate for that adjustment by manually adjusting the line height.
|
||||
|
||||
Specify the offset in pixels or font units. The offset is always relative to the original baseline.
|
||||
|
||||
The `</voffset>` closing tag resets the baseline back to its original position.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Up <voffset=1em>up <voffset=2em>UP</voffset> and <voffset=-0.5em>down</voffset> we go again.
|
||||
```
|
||||
|
||||
<br/>
|
||||
_Vertical offset_
|
@@ -0,0 +1,18 @@
|
||||
# Text Width
|
||||
|
||||
Use the `<width>` tag adjust the horizontal size of text area. The change takes effect on the current line, after the tag. Typically, you place the tag at the start of a paragraph.
|
||||
|
||||
If you add more than one `,width>` tag to a line, the last one takes precedence over the others.
|
||||
|
||||
You can specify the width in either pixels, font units, or percentages. The adjusted width cannot exceed the TextMesh Pro object's original width.
|
||||
|
||||
The closing `</width>` tag reverts to the original width.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
I remember when we had lots of space for text.
|
||||
<width=60%>But those days are long gone.
|
||||
```
|
||||
<br/>
|
||||
_Adjusting text area width_
|
@@ -0,0 +1,129 @@
|
||||
# Settings
|
||||
|
||||
TextMesh Pro’s project-wide settings are stored in a special Asset named TMP Settings. This Asset must be stored in a Resources folder. By default it’s in the `Assets/TextMesh` Pro folder.
|
||||
|
||||
To edit the settings, either select the Asset in the Project View or open the **Project Settings** window and choose **TextMesh Pro** from the category list.
|
||||
|
||||
<br/>
|
||||
_TextMesh Pro Settings_
|
||||
|
||||
The Settings are divided into the following groups:
|
||||
|
||||
|Group:|Function:|
|
||||
|-|-|
|
||||
|**A** | **[Default Font Asset](#default-font-asset):** Set the default font for text objects. |
|
||||
|**B** | **[Fallback Font Assets](#fallback-font-assets):** Choose font assets to search when TexMesh Pro can’t find a character in a text object’s main font Asset. |
|
||||
|**C** | **[Fallback Material Settings](#fallback-material-settings):** Set style options for characters retrieved from fallback fonts. |
|
||||
|**D** | **[Dynamic Font System Settings](#dynamic-font-system-settings):** Set options for handling missing characters. |
|
||||
|**E** | **[Text Container Default Settings](#text-container-default-settings):** Control the size of the text container for new text objects. |
|
||||
|**F** | **[Text Component Default Settings](#text-component-default-settings):** Set the basic text formatting options for new text objects. |
|
||||
|**G** | **[Default Sprite Asset](#default-sprite-asset):** Choose a default Sprite Asset to use for for rich text sprite tags that do not specify an Asset, and set other sprite-related options. |
|
||||
|**H** | **[Default Style Sheet](#default-style-sheet):** Choose a default style sheet. |
|
||||
|**I** | **[Color Gradient Presets](#color-gradient-presets):** Choose a location to store color gradient presets. |
|
||||
|**J** | **[Line Breaking for Asian Languages](#line-breaking-for-asian-languages):** Define leading and following characters in order to get proper line breaking when using Asian fonts. |
|
||||
|
||||
## Default Font Asset
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|---------|---------|
|
||||
|**Default Font Asset**|Specify the default font used when you create a new text object.
|
||||
|**Path**|Specify where to store font assets.<br/><br/>The **Path** must point to a subfolder of a Resources folder.|
|
||||
|
||||
## Fallback Font Assets
|
||||
|
||||
When a text object contains a character that is not in its font Asset, TextMesh Pro searches these font assets for the glyph. If the object’s font assets has a local fallback font list, TextMesh Pro searches the fonts in that list first.
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Fallback Font Assets List**|Manage the global fallback font assets.<br/><br/>Click **+** and **-** to add and remove font slots.<br/><br/>Click the circle icon next to a font to choose a font Asset using the Object Picker.<br/><br/>Drag the handles on the left side of any font Asset to reorder the list.|
|
||||
|
||||
## Fallback Material Settings
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Match Material Presets**|Enable this setting to make glyphs from the fallback font match the style of the main font.<br/><br/>When TextMesh Pro uses a glyph from a fallback font, it creates a material with the same settings as the main font’s material.<br/><br/>This looks best when the main font and the fallback font are similar.|
|
||||
|
||||
## Dynamic Font System Settings
|
||||
|
||||
These are project-wide settings for handling missing glyphs.
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Get Font Features at Runtime** | |
|
||||
|**Replacement**|Specify the ID of the character to use when TextMesh Pro cannot find a missing glyph in any of the fallback fonts.<br/><br/>The default value of 0 produces the outline of a square.|
|
||||
|**Disable Warnings**|Enable this setting to prevent Unity from logging a warning for every missing glyph.|
|
||||
|
||||
## Text Container Default Settings
|
||||
|
||||
These settings define the default size for text containers in new text objects.
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**TextMeshPro**|Set the default size of text containers for new TextMesh Pro 3D GameObjects, in Unity units.|
|
||||
|**TextMeshPro UI**|Set the default size of text containers for new TextMesh Pro UI GameObjects, in Unity units.|
|
||||
|**Enable Raycast Target** | Enable this option to make TextMesh Pro GameObjects targets for raycasting by default. <br/><br/> When you disable this option, the UI ignores TextMesh Pro GameObjects by default when determining what the cursor interacts with. |
|
||||
|**Auto Size Text Container**|Enable this option to automatically size text containers to fit the text when creating new TextMesh Pro UI GameObjects.|
|
||||
|
||||
## Text Component Default Settings
|
||||
|
||||
These settings define default values for new text objects. After adding a text object to the Scene, you can adjust these settings in the object's TextMesh Pro Inspector.
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Default Font Size**|Set the default font size, in points.|
|
||||
|**Text Auto Size Ratios**|Set the default **Min** to **Max** size ratio TextMesh Pro uses when it [sets font size automatically](TMPObjectUIText.md#font).|
|
||||
|**Word Wrapping**|Enable this option to turn word wrapping on for all new text objects.|
|
||||
|**Kerning**|Enable this option to toggle kerning on for all new text objects.<br/><br/>If new objects use a font with no kerning data, enabling this setting has no effect.|
|
||||
|**Extra Padding**|Enable this option to add extra padding to character sprites.<br/><br/>TextMesh Pro creates sprites to fit the visible text, but the results aren't always perfect. This setting reduces the chances that glyphs are cut off at the boundaries of their sprites.|
|
||||
|**Tint All Sprites**|By default, sprites aren't affected by the text's vertex colors. Enable Tint All Sprites changes this.|
|
||||
|**Parse Escape Sequence**|Enable this option to make TextMesh Pro interpret backslash-escaped characters as special characters.<br/><br/>For example `\n` is interpreted as a newline, `\t` as a tab, and so on.<br/><br/>**Note:** This applies to rendered text. In code, escaped characters are already parsed by the compiler.|
|
||||
|
||||
## Default Sprite Asset
|
||||
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Default Sprite Asset** | Choose the [Sprite Asset](Sprites.md) for TextMesh Pro GameObjects to use by default. |
|
||||
|**IOS Emoji Support** | Toggle support for iOS emoji. |
|
||||
|**Path** | Specify where to store Sprite Assets.<br/><br/>The **Path** must point to a subfolder of a Resources folder. |
|
||||
|
||||
## Default Style Sheet
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Default Style Sheet**|You can choose a single [style sheet](StyleSheets.md) Asset, which is used by all text objects in the project.|
|
||||
|
||||
## Color Gradient Presets
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Path**|Specify where to store Sprite Assets.<br/><br/>The **Path** must point to a subfolder of a Resources folder.|
|
||||
|
||||
## Line Breaking for Asian Languages
|
||||
|
||||
To obtain correct line-breaking behavior for Asian languages, you must specify which characters behave as leading and following characters. This is done via two text assets.
|
||||
|
||||

|
||||
|
||||
|Property:|Function:|
|
||||
|-|-|
|
||||
|**Leading Characters**|Specify the text file that contains the list of leading characters.|
|
||||
|**Following Characters**|Specify the text file that contains the list of following characters.|
|
@@ -0,0 +1,15 @@
|
||||
# Shaders
|
||||
|
||||
TextMesh Pro has been designed to take advantage of signed distance field (SDF) rendering and includes a collection of shaders for this purpose. There are also bitmap-only shaders, in case you don't want to use SDF rendering.
|
||||
|
||||
All shaders have a desktop and a mobile version. The mobile versions are less demanding and suitable for mobile devices, but support fewer effects. All shaders can be found in the shader menu under TextMeshPro and TextMeshPro / Mobile.
|
||||
|
||||
## SDF Shaders
|
||||
|
||||
There are three variants of the SDF shader, known as Distance Field, Distance Field (Surface), and Distance Field Overlay. The regular and overlay shaders are unlit, so they don't interact with the Scene lighting. They can support locally simulated lighting effects instead.
|
||||
|
||||
The surface shader versions do interact with the Scene lighting. They use Unity's surface shader framework and are quite flexible, but also more demanding on the GPU. They are not physically based shaders.
|
||||
|
||||
SDF shaders can use the distance data to generate special effects, like outlines, underlays, and bevels. These effects often increase the visual size of the text. When taken to their extremes, you might see artifacts appear around the edges of character sprites. If this happens, scale down the effects. For example, a soft dilated underlay with large offsets might take things too far.
|
||||
|
||||
The artifacts occur because data from adjacent characters in the font atlas will bleed into the current character. You can increase the padding when importing a font to give the effects more space.
|
@@ -0,0 +1,38 @@
|
||||
# Bitmap Shader
|
||||
|
||||
The Bitmap shader is designed to use bitmap-only fonts. It treats the font atlas like a regular texture, displaying it directly, and does not support any text effects. Bitmap-textured text becomes blocky when you zoom in on it.
|
||||
|
||||
## Properties
|
||||
|
||||

|
||||
|
||||
 **[Face](#Face):** Controls the text's overall appearance.
|
||||
|
||||
 **[Debug Settings](#DebugSettings):** Exposes internal shader properties that are sometimes useful for troubleshooting.
|
||||
|
||||
<a name="Face"></a>
|
||||
### Face
|
||||
|
||||
Description
|
||||
|
||||
|
||||
| Property: ||Description |
|
||||
|--------------|-------------|--|
|
||||
| **Color** ||Adjust the face color of the text.<br/><br/>The value you set here is multiplied with the vertex **Colors** you set in the TextMeshPro component.<br/><br/>Set this to white to use the original vertex colors.<br/><br/>Set this to black to cancel out the vertex colors.<br/><br/>Similarly, setting the Alpha to **1** uses the original vertex-color alpha, while setting it to **0** removes any alpha set in the original vertex colors.|
|
||||
| **Texture** ||Apply a texture to the text face.<br/><br/>The texture is multiplied with the face **Color** and the vertex colors in the TextMesh Pro component to produce the final face color.<br/><br/>The **Horizontal Mapping** and **Vertical Mapping** properties in the TextMesh Pro component determine how TextMesh Pro fits the texture to the text face.|
|
||||
||**Tiling X/Y** |Increase these values to repeat the texture across the text surface, in accordance with the TextMesh Pro object's **Horizontal Mapping** and **Vertical Mapping** properties.|
|
||||
||**Offset X/Y** |Adjust these values to change the texture's relative position, horizontally or vertically, on the text surface.|
|
||||
|
||||
<a name="DebugSettings"></a>
|
||||
### Debug Settings
|
||||
|
||||
The debug section exposes some of the shader’s internal properties. They can be helpful for troubleshooting problems you encounter with the shader.
|
||||
|
||||
| Property: | Description |
|
||||
|----------------------------------|---------------|
|
||||
| **Font Atlas** | Points to the atlas texture used by the font Asset. |
|
||||
| **Offset X/Offset Y** | Offset the vertex positions of each character in X and Y.<br/><br/>You can change these values using a script to create simulated crawl or scrolling FX. |
|
||||
| **Softness X/Softness Y** | When **Mask** is set to **Soft**, set these to adjust the softness of the edge of the text. |
|
||||
| **Clip Rect** | Clip Rect defines the Left (**L**), Bottom (**B**), Right (**R**) and Top (**T**) world space coordinates of the masking rectangle.<br/><br/> This is normally set automatically by the **2D RectMask**. However when using a normal **TextMeshPro** component, this allows you to set / control the masking region. |
|
||||
| **Stencil ID** | The reference value. For more information, refer to [the `ref` parameter in ShaderLab command: Stencil](https://docs.unity3d.com/Manual/SL-Stencil.html). |
|
||||
| **Stencil Comp** | A comparison operation. For more information, refer to [the `comparisonOperation` parameter in ShaderLab command: Stencil](https://docs.unity3d.com/Manual/SL-Stencil.html). |
|
@@ -0,0 +1,38 @@
|
||||
# Bitmap Custom Atlas Shader
|
||||
|
||||
The Bitmap shader is designed to use bitmap-only fonts. It treats the font atlas like a regular texture, displaying it directly, and does not support any text effects. Bitmap-textured text becomes blocky when you zoom in on it.
|
||||
|
||||
## Properties
|
||||
|
||||

|
||||
|
||||
 **[Face](#Face):** Controls the text's overall appearance.
|
||||
|
||||
 **[Debug Settings](#DebugSettings):** Exposes internal shader properties that are sometimes useful for troubleshooting.
|
||||
|
||||
<a name="Face"></a>
|
||||
### Face
|
||||
|
||||
Description
|
||||
|
||||
|
||||
| Property: ||Description |
|
||||
|--------------|-------------|--|
|
||||
| **Color** ||Adjust the face color of the text.<br/><br/>The value you set here is multiplied with the vertex **Colors** you set in the TextMeshPro component.<br/><br/>Set this to white to use the original vertex colors.<br/><br/>Set this to black to cancel out the vertex colors.<br/><br/>Similarly, setting the Alpha to **1** uses the original vertex-color alpha, while setting it to **0** removes any alpha set in the original vertex colors.|
|
||||
| **Texture** ||Apply a texture to the text face.<br/><br/>The texture is multiplied with the face **Color** and the vertex colors in the TextMesh Pro component to produce the final face color.<br/><br/>The **Horizontal Mapping** and **Vertical Mapping** properties in the TextMesh Pro component determine how TextMesh Pro fits the texture to the text face.|
|
||||
||**Tiling X/Y** |Increase these values to repeat the texture across the text surface, in accordance with the TextMesh Pro object's **Horizontal Mapping** and **Vertical Mapping** properties.|
|
||||
||**Offset X/Y** |Adjust these values to change the texture's relative position, horizontally or vertically, on the text surface. |
|
||||
|
||||
<a name="DebugSettings"></a>
|
||||
### Debug Settings
|
||||
|
||||
The debug section exposes some of the shader’s internal properties. They can be helpful for troubleshooting problems you encounter with the shader.
|
||||
|
||||
| Property: | Description |
|
||||
|----------------------------------|--------------|
|
||||
| **Font Atlas** | Points to the atlas texture used by the font Asset. |
|
||||
| **Offset X/Offset Y** | Offset the vertex positions of each character in X and Y.<br/><br/>You can change these values using a script to create simulated crawl or scrolling FX. |
|
||||
| **Softness X/Softness Y** | When **Mask** is set to **Soft**, set these to adjust the softness of the edge of the text. |
|
||||
| **Clip Rect** | Clip Rect defines the Left (**L**), Bottom (**B**), Right (**R**) and Top (**T**) world space coordinates of the masking rectangle.<br/><br/> This is normally set automatically by the **2D RectMask**. However when using a normal **TextMeshPro** component, this allows you to set / control the masking region. |
|
||||
| **Stencil ID** | The reference value. For more information, refer to [the `ref` parameter in ShaderLab command: Stencil](https://docs.unity3d.com/Manual/SL-Stencil.html). |
|
||||
| **Stencil Comp** | A comparison operation. For more information, refer to [the `comparisonOperation` parameter in ShaderLab command: Stencil](https://docs.unity3d.com/Manual/SL-Stencil.html). |
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user