Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.2.0-pre.2] - 2021-10-31
### Changes
- Fixed incorrect character spacing when using the <scale> tag. See [forum post](https://forum.unity.com/threads/inconsistent-spacing-between-characters-when-scaling-width.1156967/) for details.
- Added Unicode code point range for Arabic Mark glyphs. See [forum post](https://forum.unity.com/threads/no-kerning-pairs-on-tmp-font-import.620587/#post-7428380) for details.
- Added support for creating multiple Sprite Assets at once by selecting multiple sprite textures and using the "Create - TextMeshPro - Sprite Asset" context menu.
- Added new class definition type to the glyph class. This new property will only be visible when included in a new release of the Unity Editor.
- Fixed incorrect update of SDF Scale when text object scale is zero. The previous optimization where SDF Scale only gets updated when lossy scale change exceeds 20% of the previous value remains. See [forum post](https://forum.unity.com/threads/3-2-0-pre-1-text-as-squares-in-rare-case.1164875/) for details.
- Fixed text objects not being visible when using a mixture of <TextMeshPro> objects with ≶TextMeshProUGUI> objects in Screenspace Overlay when these objects share the same material preset. See [forum post](https://forum.unity.com/threads/text-missing-on-apple-m1-mac-builds.1021987/) for details.
- Updated TMP Essential Resources to include updated shaders to address texture mapping issue with one of the SDF shaders.
- Fixed a few inspector issues related to fallback glyph caching when adding, deleting and reordering fallback font asset lists.
- Minor change to the Font Asset Creator to prevent setting a face size of zero when using Auto Sizing mode. Case #1368638.
- Fixed incorrect selection of font face in the Font Asset Creator when using the "Update Atlas Texture" button in the Font Asset inspector. Case #1366468.
- Fixed incorrect Character Set selection being recalled when using the "Update Atlas Texture" button in the Font Asset inspector. Case #1368517.
- Fixed scene remaining dirty after undoing a change to a TMP text component which dirtied the scene. Case #1296400
- Improved Android / Chrome OS hardware keyboard support.
- Fixed incorrect parsing of invalid UTF16 and UTF32 character sequences. Case #1367695
- Added new example to the TMP Examples & Extras to showcase new HDRP shaders and inspector.
- Added support for GameCore platform support in the TMP Input Field.
- Added new Ligature Table to Font Assets allowing users to manually define Ligatures. This is a first pass at adding support for Ligatures.
  • Loading branch information
Unity Technologies committed Oct 31, 2021
1 parent 9737d20 commit f2d5cfb
Show file tree
Hide file tree
Showing 336 changed files with 8,449 additions and 990 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Changelog
These are the release notes for the TextMesh Pro UPM package which was first introduced with Unity 2018.1. Please see the following link for the Release Notes for prior versions of TextMesh Pro. http://digitalnativestudios.com/forum/index.php?topic=1363.0

## [3.2.0-pre.2] - 2021-10-31
### Changes
- Fixed incorrect character spacing when using the <scale> tag. See [forum post](https://forum.unity.com/threads/inconsistent-spacing-between-characters-when-scaling-width.1156967/) for details.
- Added Unicode code point range for Arabic Mark glyphs. See [forum post](https://forum.unity.com/threads/no-kerning-pairs-on-tmp-font-import.620587/#post-7428380) for details.
- Added support for creating multiple Sprite Assets at once by selecting multiple sprite textures and using the "Create - TextMeshPro - Sprite Asset" context menu.
- Added new class definition type to the glyph class. This new property will only be visible when included in a new release of the Unity Editor.
- Fixed incorrect update of SDF Scale when text object scale is zero. The previous optimization where SDF Scale only gets updated when lossy scale change exceeds 20% of the previous value remains. See [forum post](https://forum.unity.com/threads/3-2-0-pre-1-text-as-squares-in-rare-case.1164875/) for details.
- Fixed text objects not being visible when using a mixture of <TextMeshPro> objects with ≶TextMeshProUGUI> objects in Screenspace Overlay when these objects share the same material preset. See [forum post](https://forum.unity.com/threads/text-missing-on-apple-m1-mac-builds.1021987/) for details.
- Updated TMP Essential Resources to include updated shaders to address texture mapping issue with one of the SDF shaders.
- Fixed a few inspector issues related to fallback glyph caching when adding, deleting and reordering fallback font asset lists.
- Minor change to the Font Asset Creator to prevent setting a face size of zero when using Auto Sizing mode. Case #1368638.
- Fixed incorrect selection of font face in the Font Asset Creator when using the "Update Atlas Texture" button in the Font Asset inspector. Case #1366468.
- Fixed incorrect Character Set selection being recalled when using the "Update Atlas Texture" button in the Font Asset inspector. Case #1368517.
- Fixed scene remaining dirty after undoing a change to a TMP text component which dirtied the scene. Case #1296400
- Improved Android / Chrome OS hardware keyboard support.
- Fixed incorrect parsing of invalid UTF16 and UTF32 character sequences. Case #1367695
- Added new example to the TMP Examples & Extras to showcase new HDRP shaders and inspector.
- Added support for GameCore platform support in the TMP Input Field.
- Added new Ligature Table to Font Assets allowing users to manually define Ligatures. This is a first pass at adding support for Ligatures.

## [3.2.0-pre.1] - 2021-08-06
## [2.2.0-preview.1] - 2021-08-06
## [1.6.0-preview.1] - 2021-08-06
Expand Down
42 changes: 42 additions & 0 deletions Documentation~/ColorGradients.md
Original file line number Diff line number Diff line change
@@ -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.

![](images/TMP_ColorGradient_4-Corner-no-legend.png)

_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

![](images/TMP_ColorGradient_3-Corner-YBRY_half.png)

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

![](images/TMP_ColorGradient_3-Corner-RYYB_half.png)


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).
![](images/TMP_ColorGradientInspector.png)

**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.
36 changes: 36 additions & 0 deletions Documentation~/ColorGradientsPresets.md
Original file line number Diff line number Diff line change
@@ -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.

![](images/TMP_ColorGradientPresetCreator.png)

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.
81 changes: 81 additions & 0 deletions Documentation~/ColorGradientsTypes.md
Original file line number Diff line number Diff line change
@@ -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.

![](images/TMP_ColorGradientInspector.png)<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:

![](images/TMP_ColorGradient_4-Corner-YBRG_half.png)


## Single Color

The **Single** gradient type applies a single color.

![](images/TMP_ColorGradient_Single-Y_half.png)

## Horizontal Gradients

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

![](images/TMP_ColorGradient_Horiz-YB_half.png)

![](images/TMP_ColorGradient_Horiz-BY_half.png)<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.

![](images/TMP_ColorGradient_Vert-BY_half.png)<br/><br/>

![](images/TMP_ColorGradient_Vert-YB_half.png)<br/><br/>

## Four Corner Gradients

The **Four Corner** gradient type applies four colors. Each one radiates out from its assigned corner of each character.

![](images/TMP_ColorGradient_4-Corner-YBRG_half.png)<br/><br/>

![](images/TMP_ColorGradient_4-Corner-YBRO_half.png)

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.

![](images/TMP_ColorGradient_1-Corner-BYYY_half.png)

- Give pairs of adjacent corners the same color to create horizontal or vertical gradients.

![](images/TMP_ColorGradient_2-Corner-BYBY_half.png)<br/><br/>

![](images/TMP_ColorGradient_2-Corner-BBYY_half.png)

- Give pairs of diagonally opposite corners the same color to create diagonal gradients.

![](images/TMP_ColorGradient_2-Corner-BYYB_half.png)<br/><br/>

![](images/TMP_ColorGradient_2-Corner-YBBY_half.png)<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.

![](images/TMP_ColorGradient_3-Corner-YRYB_half.png)<br/><br/>

![](images/TMP_ColorGradient_3-Corner-YYRB_half.png)

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

![](images/TMP_ColorGradient_3-Corner-RYYB_half.png)<br/><br/>

![](images/TMP_ColorGradient_3-Corner-YBRY_half.png)
27 changes: 27 additions & 0 deletions Documentation~/CustomStyles.md
Original file line number Diff line number Diff line change
@@ -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.

![](images/TMP_StyleSheets_ExampleHeading_Render.png)

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`.

![](images/TMP_StyleSheets_ExampleHeading_Inspector.png)

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.
36 changes: 36 additions & 0 deletions Documentation~/DebugTool.md
Original file line number Diff line number Diff line change
@@ -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.

![](images/TMP_DebugToolChars.png)
_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

![](images/TMP_DebugTool.png)

|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. |
1 change: 1 addition & 0 deletions Documentation~/Debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Debugging TextMesh Pro text
26 changes: 26 additions & 0 deletions Documentation~/FontAssets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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/>![](images/FontAtlasExample.png)<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.
Loading

0 comments on commit f2d5cfb

Please sign in to comment.