Contour

Various ways to draw following a shape's border.

This is usually called "outline", but it's avoided here since it can very well be drawn inside.

Instructions are given for typical interface layout.

Dedicated docks and context menus in them often have shortcuts.

Conventions
Terms used here :
 * border: The precise limit of the shape to follow.
 * inside/outside: Relative to the border.
 * gap: Optional space between the border and the contour.

Other conventions here : Draw will clobber content. Draw will leave shape untouched, and may be modified independently.
 * «Select pixels»: Use whatever method is suitable to get or select the raster to contour.
 * «Get path»: Use whatever method is suitable to get or select the path to contour.
 * «File►Command»: Open the "File" menu, select the "Command" item.
 * "Pick layer to draw in" : Either :
 * Stay on the same layer.
 * Create or re-use another layer, place it above or under the shape's layer, and select it.
 * «Fill or paint» : Use one of «Edit►Fill»… or click inside the selection with a drawing tool.

Path vs Selection
(tested using GIMP v2.10.14)

Both can be struck, for slightly different results.

«Select►From Path» or path context menu«►Path to Selection» to get a selection from a path.

«Select►To Path» to get a path from a selection.

Caveat: Cuts and rounds through pixel corners, ending smaller than the original shape and significantly off-shape for small details.

Case of text layers
(tested using GIMP v2.10.14)

Layer's context menu►«Alpha to Selection» to obtain selection.

«Layer►Text to Path» to obtain path.

Drawing on a text layer turns it into a special raster layer, making the text unavailable.

Clicking with the "Text" tool on such a layer offers to discard the draw changes or copy text to a new layer to recover original text.

«Antialiasing» on "Text" tool mixes badly with selection and contouring, especially at small sizes.

By Selection Fill
(tested using GIMP v2.10.14)

Caveat: Loses the original anti-aliasing. Set «Border style» to…
 * 1) Select pixels.
 * 2) «Select►Grow…» or «►Shrink…» by how much the contour must extend out or gap in the border…
 * 1) *Grow > Width : Outside the border with gap of Grow-Width.
 * 2) *Grow = Width : Right outside the border
 * 3) *Grow = Width÷2 : Straddling the border.
 * 4) *No Grow : Right inside the border.
 * 5) *Shrink : Inside the border with that gap.
 * 6) «Select►Border…» by how wide the contour must be.
 * 1) *«Smooth» to round outside corners.
 * 2) *«Feathered» to round corners even more and anti-alias, on both sides.
 * 3) Fill or paint.

By Selection Stroke
(tested using GIMP v2.10.14)

Caveat: The contour is squarish and solid fill. Reduce width by 1 (anything from 0 to 2 both excluded in fact) to anti-alias the outermost pixel. This makes a 1-2px contour sufficiently smooth. Bug: Shifts half a pixel to the bottom right. (very noticeable under a few pixels of width) Caveat: Tight spaces may get painted twice. (can be bad for transparency)
 * 1) Select pixels.
 * 2) Either…
 * 3) *No change to draw inside.
 * 4) *«Select►Invert» to draw outside.
 * 5) Pick layer to draw in.
 * 6) «Edit►Stroke Selection…» then either of…
 * 7) *Choose «Stroke line», set «Solid», «Antialiasing«, «Line width» to intended outline width×2.
 * 1) *«Stroke with a paint tool», after setting the tool's «Size» to intended outline width×2.

Bug: Stroking on a different layer ignores selection limit as of GIMP v2.10.14.

By Path Stroke
(tested using GIMP v2.10.14)

Like Selection Stroke above, except : Adding a selection will do as Selection Stroke above, but then this makes using a path pointless.
 * Select and stroke path instead of selection.
 * The stroke straddles the border, and intended width should be doubled.