Skip to main content

ValueUnit

A pair of a floating point number and a unit (ValueUnit<T>) where T represents the unit type.

If the unit is not provided it will default to a sensible value depending on the type. For example a UIMeasurement defaults to px and a UIAngle defaults to deg

Different unit postfixes are available for different ValueUnit T values. The possible postfix values are listed in the following tables.

Element Relative Size

UnitShorthandDescription
WidthwThe width of the element
HeighthThe height of the element
Percent%A percentage based value, the value that this is relative to changes based on the property usage. See individual properties to see what the % relative value is
PixelpxA fixed pixel value that accounts for any dpi scaling
BackgroundImageWidthbwThe width of the currently assigned background texture in unscaled texels
BackgroundImageHeightbhThe height of the currently assigned background texture in unscaled texels
MinWidthHeightmnwhThe minimum of the target's width or height
MaxWidthHeightmxwhThe maximum of the target's width or height

Alignment Offset

UnitShorthandDescription
WidthwThe width of the element
HeighthThe height of the element
ContentHeightcnthThe content height of the element
ContentWidthcntwThe content width of the element
EmemThe em size resolved for this element
ParentWidthpwThe post layout width of the parent element or the view size if parent is null
ParentHeightphThe post layout height of the parent element or the view size if parent is null
ParentContentAreaWidthpcawThe parent's width (or viewport width if parent is null) minus any border and padding on the horizontal axis
ParentContentAreaHeightpcahThe parent's height (or viewport height if parent is null) minus any border and padding on the vertical axis
ContentAreaWidthcawThe post layout width of the element minus any padding and border on the horizontal axis
ContentAreaHeightcahThe post layout height of the element minus any padding and border on the vertical axis
Percent%A percentage based value, the value that this is relative to changes based on the property usage. See individual properties to see what the % relative value is
PixelpxA fixed pixel value that accounts for any dpi scaling
ScreenWidthswThe total screen width in dpi scaled pixels
ScreenHeightshThe total screen height in dpi scaled pixels
ViewportWidthvwThe width of the view that an element belongs to in dpi scaled pixels
ViewportHeightvhThe height of the view that an element belongs to in dpi scaled pixels
BackgroundImageWidthbwThe width of the currently assigned background texture in unscaled texels
BackgroundImageHeightbhThe height of the currently assigned background texture in unscaled texels

Texture Relative Size

UnitShorthandDescription
Percent%A percentage based value, the value that this is relative to changes based on the property usage. See individual properties to see what the % relative value is
PixelpxA fixed pixel value that accounts for any dpi scaling
ImageWidthbwThe width of the currently assigned background texture in unscaled texels
ImageHeightbhThe height of the currently assigned background texture in unscaled texels

Font Size

UnitShorthandDescription
EmemThe em size resolved for this element
RemremThe root em size resolved for this element
PointptA size specified in units defined by the currently assigned font file or the default font if none is assigned
PixelpxA fixed pixel value that accounts for any dpi scaling

Measurement

UnitShorthandDescription
ContentcntThe content size of the element
EmemThe em size resolved for this element
LineHeightlhThe line height of the element computed from the current font size
ParentSizepszThe size of the parent. Note that if there exists a paradox where the parent sizes itself based on content size and some child sizes itself based on the parent size. In this case the child will set its size to zero. This paradox is only applicable for layout
Percent%A percentage based value, the value that this is relative to changes based on the property usage. See individual properties to see what the % relative value is
PixelpxA fixed pixel value that accounts for any dpi scaling
ViewportWidthvwThe width of the view that an element belongs to in dpi scaled pixels
ViewportHeightvhThe height of the view that an element belongs to in dpi scaled pixels
BackgroundImageWidthbwThe width of the currently assigned background texture in unscaled texels
BackgroundImageHeightbhThe height of the currently assigned background texture in unscaled texels
StretchsA portion of 'remaining space' that should be attributed to this element.
ApplicationWidthawThe total width of the root view in dpi scaled pixels
ApplicationHeightahThe total width of the root view in dpi scaled pixels
MaxChildmxThe size of the largest child
MinChildmnThe size of the smallest child
StretchContentstrcntA unit that reserves at least 1x the content size and then adds n stretch pieces
FitContentfcNot Supported
FillRemainingfrA fixed percentage of the remaining space in a layout before stretch values are distributed

Size Constraint

UnitShorthandDescription
ContentcntThe content size of the element
EmemThe em size resolved for this element
LineHeightlhThe line height of the element computed from the current font size
ParentSizepszThe size of the parent. Note that if there exists a paradox where the parent sizes itself based on content size and some child sizes itself based on the parent size. In this case the child will set its size to zero. This paradox is only applicable for layout
Percent%A percentage based value, the value that this is relative to changes based on the property usage. See individual properties to see what the % relative value is
PixelpxA fixed pixel value that accounts for any dpi scaling
ViewportWidthvwThe width of the view that an element belongs to in dpi scaled pixels
ViewportHeightvhThe height of the view that an element belongs to in dpi scaled pixels
BackgroundImageWidthbwThe width of the currently assigned background texture in unscaled texels
BackgroundImageHeightbhThe height of the currently assigned background texture in unscaled texels
ApplicationWidthawThe total width of the root view in dpi scaled pixels
ApplicationHeightahThe total width of the root view in dpi scaled pixels
MaxChildmxThe size of the largest child
MinChildmnThe size of the smallest child

Space Size

UnitShorthandDescription
EmemThe em size resolved for this element
PixelpxA fixed pixel value that accounts for any dpi scaling
ViewportWidthvwThe width of the view that an element belongs to in dpi scaled pixels
ViewportHeightvhThe height of the view that an element belongs to in dpi scaled pixels
StretchsA portion of 'remaining space' that should be attributed to this element.
ApplicationWidthawThe total width of the root view in dpi scaled pixels
ApplicationHeightahThe total width of the root view in dpi scaled pixels

Examples

style value_units {
PaddingLeft = 1s;
PreferredWidth = 2.5cnt;
TextFontSize = 3em;
AlignmentOffsetX = 0.5w;
}