---
url: /en-us/standard/common/nib.md
---
**The nib description `nib` states what shape of nib an Ink was written with, and the cap states the shape of the stroke's two ends.** The same set of fields is also used for the `lineCap` and `lineJoin` of Shape strokes. Without these fields, strokes are drawn with a circle nib and round caps, which is also how Core readers draw them.

::: tip Levels

* **Basic**: `nib`, Ink `cap`, Shape stroke `lineCap` and `lineJoin`.
* **Inkeys extension**: `nib` on Erase Ink (rectangle and square erasers).
* Core readers ignore these fields and draw with a circle nib and round caps.
  :::

## Nib Map

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `shape` | int32 | Optional | `0` Circle (default), `1` Rectangle; `2`–`127` reserved, `128`+ private |
| `aspect` | float32 | Conditional | Width ÷ height of a rectangle nib; must be greater than `0`; required when `shape = 1` |
| `orientation` | int32 | Optional | `0` Fixed (default), `1` FollowDirection |

### Nib size

Let `w` be the `width` at a point, `W` and `H` the width and height of a rectangle nib, and `a = aspect`.

* Circle nib: diameter = `w`.
* Rectangle nib: `H = w`, `W = a × H`. For example, with `w = 24`, a 1:8 highlighter is 3 × 24, a 2:3 rectangle eraser is 16 × 24, and a 1:1 square eraser is 24 × 24.

### Orientation

* `Fixed`: the rectangle is aligned with the Canvas axes, its height along the Canvas Y direction, and does not turn with the writing direction.
* `FollowDirection`: the rectangle's width lies along the writing direction at that point, and its height is perpendicular to the writing direction. The writing direction at each point is determined per NIB-8.

## Caps

`cap` (Ink) and `lineCap` (Shape stroke) use the same enumeration:

| Value | Name | Shape of the stroke's ends |
| --- | --- | --- |
| `0` | Round | A semicircle with a diameter equal to the width there is added at the endpoint |
| `1` | Square | The endpoint extends outward along the writing direction by half the width, forming a square end |
| `2` | Butt | Ends at the endpoint, with no extension |
| `3`–`127` | Reserved | — |
| `128`+ | Private | — |

Ink caps apply to circle nibs only; the two ends of a rectangle nib stroke are always the edges of the nib rectangle itself (NIB-3).

`lineJoin` (Shape strokes only):

| Value | Name | Polyline corner |
| --- | --- | --- |
| `0` | Round | Rounded corner |
| `1` | Miter | Sharp corner; drawn as Bevel when the miter is too long, see SHAPE-10 |
| `2` | Bevel | Beveled corner |

## Rules

* **NIB-1** Without `nib`, the nib is a circle and `width` is the diameter.
* **NIB-2** A stroke is the area swept by the nib along the point sequence. How to interpolate between points is up to the app (INK-7), but the nib's shape, size and orientation must follow the definitions on this page.
* **NIB-3** Ink `cap` applies to circle nibs only and defaults to Round when missing. The two ends of a rectangle nib stroke are always the edges of the nib rectangle itself and do not extend further: readers ignore `cap` on rectangle nibs, and writers may omit it.
* **NIB-4** When a Shape stroke is missing `lineCap`, Round is used; when it is missing `lineJoin`, Round is used.
* **NIB-5** A zero-length dash (a `0` in `dashArray`) is drawn as a round dot with a Round cap, as a square dot with a Square cap, and is invisible with a Butt cap. Writers expressing dotted lines must use a Round or Square cap.
* **NIB-6** When `shape = 1` and `aspect` is missing or invalid (non-positive, NaN, Infinity), readers draw with a circle nib and report a warning.
* **NIB-7** For unknown values of `shape`, `orientation`, `cap`, `lineCap` and `lineJoin`, readers use the respective default.
* **NIB-8** The writing direction of a `FollowDirection` nib at each point: the first point takes the direction of the first segment, the last point takes the direction of the last segment, and interior points take the bisector of the incoming and outgoing directions (unit vectors); when the two are exactly opposite, the outgoing direction is used. Zero-length segments are skipped; with only one point or all points coincident, it is drawn as `Fixed`. How the direction transitions between points is up to the app (INK-7).

## Inkeys values

| Tool | `shape` | `aspect` | `orientation` | Cap |
| --- | --- | --- | --- | --- |
| Pen | Circle | — | — | Round |
| Highlighter | Rectangle | `0.125` (1:8) | Fixed | — (nib edges) |
| Circle eraser | Circle | — | — | Round |
| Rectangle eraser | Rectangle | `0.6666667` (2:3) | Fixed | — (nib edges) |
| Square eraser | Rectangle | `1` | Fixed | — (nib edges) |

Inside the app, Inkeys sizes rectangle and square erasers by the convention of "equal area to a circle eraser of the same size". When writing the file, Inkeys converts the app's internal eraser size `s` into the nib height `H = (s / 2) × √(π / a)` and writes it into the points' `width`; the file stores only the intuitive width and height, and readers do not need to know about this conversion.

## Fallback

| Capability the reader lacks | How it is shown |
| --- | --- |
| `nib` (Core) | Circle nib; `width` treated as the diameter |
| `cap`, `lineCap`, `lineJoin` (Core) | Round cap, round join |

When a highlighter falls back to a circle nib, `width`, which originally meant the nib height, is treated as the diameter, so the stroke thickness stays the same; only the ends and corners become rounded.

## Related

* [Ink Block](../blocks/ink)
* [Shape Block](../blocks/shape)
