기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Font Asset properties reference

Information about each Font Asset property.
읽는 시간 6분최근 업데이트: 한 달 전

You can adjust the properties of a font asset after the font asset is created. To adjust the properties of a font asset, select the font asset, and change the values of its properties in the Inspector window.

Font Asset properties

This section describes all the Font Asset properties.

Face Info

Use the Face Info properties to control the font's line metrics.

Line metrics

Property

Description

Family NameName of the font used to create this font asset.
Style NameStyle of the font used to create this font asset. For example, Regular, Bold, or Italic.
Point SizeFont size in points used to generate the font asset.
ScaleScale the font. For example, a value of
1.5
scales glyphs to 150% of the original font size.
Line HeightDistance between the tops of consecutive lines.

If you set a line height greater than the sum of the Ascent Line and Descent Line, it creates in a gap between lines.

If you set a line height smaller than the sum of the Ascent Line and Descent Line values, characters on different lines might overlap.
Ascent LineMaximum distance that glyphs can extend above the baseline. It corresponds to the top of a line.
Cap LineDistance between the base line and the tops of uppercase glyphs.
Mean LineMaximum height for non-ascending lowercase glyphs. For example, "a" and "c", but not "b" and "d" which have ascenders.

The tops of rounded glyphs sometimes extend a slightly above the mean line.
BaselineHeight of the baseline.

The baseline is the horizontal line that characters sit on.
Descent LineMaximum distance that glyphs can extend below the baseline.
Underline OffsetPosition of underlines relative to the baseline.
Underline ThicknessThickness of underlines.
Strikethrough OffsetPosition of strikethrough lines relative to the baseline.
Superscript OffsetOffset superscript text from the baseline.
Superscript SizeScale superscript text relative to the original font size.
Subscript OffsetOffset subscript text from the baseline.
Subscript SizeScale subscript text relative to the original font size.
Tab WidthWidth of a TAB character.

Generation Settings

You can change the generation settings for a font asset. For dynamic or dynamic OS font assets, you can change the settings directly in the Inspector Window without regenerating the atlas. To update the generation settings for a static font asset, select Update Atlas Texture, and make changes in the Font Asset Creator window and regenerate the font atlas.

Property

Description

Source Font FileSource file used to generate the font asset.
Atlas Population ModeMode to populate the font atlas.
Atlas Render ModeMode to render the font atlas.
Sampling Point SizeSize, in points, of characters in the font texture.
PaddingPadding, in pixels, between characters in the font atlas texture.
Atlas WidthWidth of the font atlas texture.
Atlas HeightHeight of the font atlas texture.
Multi Atlas TexturesStore glyphs in multiple atlas textures. Enable this option if you need more than one atlas.
Clear Dynamic DataClear all dynamic data and restore the font asset back to its default creation and empty state.
Get Font FeaturesDetermines whether to automatically retrieve OpenType font features as needed. Currently, UI Toolkit supports only Kerning Pair adjustments. When enabled (default), Kerning Pair adjustments are dynamically added to the Glyph Adjustment Table when required.

Atlas & Material

참고
Font material isn't supported in the current release.

Property

Description

Font AtlasFont texture atlas created when you generated the font Asset.

Font Weights

You can use the Font Weights options to control the appearance of bold and italicized text in the following ways:
  • Specify regular and italic fonts for weights ranging from 100 (Thin) to 900 (Black).
  • Use the Italic Slant and Bold Weight properties to define "fake" bolding and italicization. These settings adjust characters in the current font asset when you bold or italicize text. This limits you to regular and italic versions of original and bold text (equal to weights of 400 and 700 respectively).
The following table describes the properties for the Italic Slant and Bold Weight properties:

Property

Description

Regular WeightRegular font weight to use when no font asset is available.
Bold WeightBold font weight assumed when no font asset is available.
Regular SpacingSpace between characters when using the regular text style.
Bold SpacingSpace between characters when using the bold text style if you haven't specified a Bold font asset.
Italic SlantSlant value for the italic typeface.
Tab MultipleThis value is multiplied by the width of the font's space character to calculate the tab size.

Fallback Font Assets

Manage the local fallback font assets list for this font asset.
참고
The local fallback has precedence over the global fallback set in the UITK Text Settings asset.

Property

Description

Fallback Font Assets ListClick + and - to add and remove font slots.
Click the circle icon next to a font to open an Object Picker where you can choose a font asset.
Drag the handles on the left side of any font asset to reorder the list.

Character Table

The character table contains information about each character in the font asset. You can adjust the attributes of an individual glyph to correct font problems. To do so, select Edit Glyph.

Property

Description

Character SearchSearch the character list by character, ASCII value or Hex value.
UTF16ASCII decimal value of the character.
UnicodeUnicode Hex value of the character.
Glyph IDID of the character's glyph.

Glyph Table

The glyph table contains information about each glyph in the font asset. You can adjust the attributes of an individual glyph to correct font problems.

Property

Description

Glyph SearchSearch the character list by character, ASCII value, or Hex value.

Search results are ordered by ASCII value, lowest to highest.
Glyph RectDefine the rectangular area the character occupies in the font atlas.
Glyph MetricsDefine the metrics of the glyph. The following metrics are available:
  • W: Width of the character.
  • H: Height of the character.
  • BX, BY: Control the placement of the character's sprite, defined at its top-left corner relative to its origin on the baseline.
  • AD: How far to advance along the baseline before placing the next character.
  • Scale: Scaling value that adjusts the size of the character.

Glyph Adjustment Table

The glyph adjustment table Control 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

Description

Adjustment Pair SearchSearch the adjustment table by character or ASCII value.

Search results include entries where either the left or right character matches the search string.

Search results are ordered by the ASCII value of the left character, lowest to highest.
Glyph PropertiesDisplay a single glyph's properties. Each glyph has its own entry.

Click an entry to make it active. You can then edit the glyph, copy it, or remove it from the list. The following properties are available:
  • Char (left and right): Left and right characters for the kerning pair.
  • ID (left and right): Left and right characters' ASCII decimal values for the kerning pair.
  • OX, OY (left and right): Left and right horizontal (X) and vertical (Y) offsets relative to the character's initial position in the kerning pair.
  • AX (left and right): How far to advance along the baseline before placing the next character in the kerning pair. 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.

Additional resources