Getting started
Resources
Flex
Spacing
Layout
Size
Typography
Background
Border
Transition
Utility classes for changing an element's font weight property.
By default, Doddle contains no imported font, and will need to be imported during setup. You will need to import and create font assets of your desired font. For instructions, read Installation.
Classes for font weight are named using the format: [fw]-[weight]-[style]
.
Where weight includes:
100
- for -unity-font-definition: var(--font-thin)
300
- for -unity-font-definition: var(--font-light)
400
- for -unity-font-definition: var(--font-regular)
700
- for -unity-font-definition: var(--font-bold)
900
- for -unity-font-definition: var(--font-black)
Where style includes:
nothing
- for the defined font weight, in non italic formitalic
- for unity-font-definition: var(--font-[weight]-italic)
Class | Contents |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Changing font weight, and style through your imported font's supported weights is the recommended approach for consistency and accuracy. However, classes '.bold', and '.italic' still exist and can be stacked. You can still manually apply a bold or italics property in the UI toolkit inspector to an already bolded/italicized font asset. You end up with a bolded italicized bold italics font. The bold and italics amount applied by Unity seems to be some arbitrary amount, as applying the class '.bold' will result in a slightly different look than applying your font's '.fw-700'.
UXML
UXML
Doddle USS provides extension and helper methods. One of those methods are SetFontWeightByEnum()
which allows you to pre-define multiple instances of static UI content from ScriptableObjets with simple population scripts. Supported font weight enums are:
Black = 0
- for the .fw-100
classBlackItalic = 1
- for the .fw-100-italic
classBold = 2
- for the .fw-300
classBoldItalic = 3
- for the .fw-300-italic
classRegular = 4
- for the .fw-400
classRegularItalic = 5
- for the .fw-500-italic
classLight = 6
- for the .fw-700
classLightItalic = 7
- for the .fw-700-italic
classThin = 8
- for the .fw-900
classThinItalic = 9
- for the .fw-900-italic
classUXML
On this page