Skip to content

Commit

Permalink
Revert freeform dimension units
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow committed Aug 17, 2024
1 parent f5af127 commit fe937cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions technical-reports/format/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ $translucent-shadow: hsla(300, 100%, 50%, 0.5);

## Dimension

Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `$type` property MUST be set to the string `dimension`. The value MUST be an object with `value` and `unit` keys.
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `$type` property MUST be set to the string `dimension`. The value MUST be an object with both `value` and `unit` keys.

| Key | Type | Required | Description |
| :------ | :------: | :------: | :----------------------------------------------------------------- |
| `value` | `number` | Y | An integer or floating-point value representing the numeric value. |
| `unit` | `string` | Y | A string specifying the units of measurement |
| `unit` | `string` | Y | Specify `"px"` or `"rem"`. |

For example:

Expand Down Expand Up @@ -85,8 +85,9 @@ For example:

### Validation

- `$value.unit` may be any string. It is up to tooling to translate units into the appropriate platform.
- `$value.unit` may NOT be an empty string (`""`).
- `$value.unit` may only be `"px"` or `"rem"`.
- **px**: Represents an idealized pixel on the viewport. The equivalent in Android is `dp` and iOS is `pt`. Translation tools SHOULD therefore convert to these or other equivalent units as needed.
- **rem**: Represents a multiple of the system's default font size (which MAY be configurable by the user). 1rem is 100% of the default font size. The equivalent of 1rem on Android is 16sp. Not all platforms have an equivalent to rem, so translation tools MAY need to do a lossy conversion to a fixed px size by assuming a default font size (usually 16px) for such platforms.
- `$value.unit` is still requird even if `$value.value` is `0`.

## Font family
Expand Down

0 comments on commit fe937cb

Please sign in to comment.