Right side bearing (source code)

= Right side bearing
{title2=$\mathrm{rsb}$}

The <right side bearing> measures the signed gap from the right edge of a <glyph>'s ink <bounding box> to the point specified by its default horizontal <glyph advance>. If the origin is $x=0$, the advance is $a$, and the ink edges are $x_L,x_R$, then
$$
\boxed{\mathrm{rsb}=a-x_R=a-\mathrm{lsb}-(x_R-x_L).}
$$
Thus the advance splits into a <left side bearing>, an ink width and a <right side bearing>. <OpenType> uses this relation to derive the <right side bearing> from the horizontal metrics and outline bounds.<Horizontal Metrics Table by Microsoft>[Deriving rsb from aw, lsb, xMin and xMax]{ref}

For the hypothetical ink interval $40\le x\le540$ and advance 600 <font units>, the <right side bearing> is 60 <font units>. If a different <glyph> extends to $x_R=650$ with the same advance 600, its <right side bearing> is $-50$ <font units>: ink crosses the next nominal origin. A negative bearing is therefore meaningful rather than an invalid width.

These are metrics of an individual default <glyph>. <Kerning> and other <glyph positioning> rules can change the actual gap between adjacent shapes, so the <right side bearing> alone does not determine the visual spacing of a whole run.