Class TextContentSizing
Many core helper methods for auto-sizing Text/UI.Text/TextMeshPro when doing content-sizing calculations using
IContentSizeCalculator4x1 for FlexBuilder.
Contains the crucial method LayoutSizeWithFontSize(Text, CSSContentLengthConstrainable, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, Boolean) which is where 99% of the hard work in auto-sizing
text happens.
NB: this was originally private internal implementation, and the APIs in this class are subject to change without
notice, but for a few advanced use-cases we had to expose this (e.g. for people doing advanced customization of
content-sizing, so that they can re-use the existing complex text calculations instead of having to re-invent the
wheel).
Inheritance
TextContentSizing
Assembly: cs.temp.dll.dll
Syntax
public class TextContentSizing
Methods
- (Single)
ContentSizeForTextPaddedElement(IContentSizeCalculator4x1, Int32, Text, FlexItem, Axis, CSSAvailableSpace, Boolean, Single, Single, Single, Single, Single, Single)
Unity reserves a very small amount of padding on several elements - e.g. Button - and doesn't display text outside that area,
so this method allows you to specify corrective-padding to workaround this undocumented problem in UnityUI
Parameters
Returns
- (Int32)
FontLineHeight(Text, Int32)
Parameters
Text |
textObject |
|
Int32 |
fontSize |
|
Returns
- (Vector2)
LayoutSizeWithFontSize(Text, CSSContentLengthConstrainable, Nullable, Nullable, Nullable, Boolean, Boolean, Boolean)
- (ContentLength)
MinContentSize_PaddedTextElements(Text, FlexItem, Axis, Boolean, Single, Single, Single, Single, Single, Single, Boolean)
- (String)
PlainTextFromRichText(String)