files/en-us/web/api/canvasrenderingcontext2d/fontkerning/index.md
{{APIRef("Canvas API")}}
The CanvasRenderingContext2D.fontKerning property of the Canvas API specifies how font kerning information is used.
Kerning adjusts how adjacent letters are spaced in a proportional font, allowing them to edge into each other's visual area if there is space available.
For example, in well-kerned fonts, the characters AV, Ta and We nest together and make character spacing more uniform and pleasant to read than the equivalent text without kerning.
The property corresponds to the {{cssxref("font-kerning")}} CSS property.
The property can be used to get or set the value.
Allowed values are:
auto
normal
none
In this example we display the text "AVA Ta We" using each of the supported values of the textRendering property.
<canvas id="canvas" width="700" height="140"></canvas>
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
ctx.font = "30px serif";
// Default (auto)
ctx.fillText(`AVA Ta We (default: ${ctx.fontKerning})`, 5, 30);
// Font kerning: normal
ctx.fontKerning = "normal";
ctx.fillText(`AVA Ta We (${ctx.fontKerning})`, 5, 70);
// Font kerning: none
ctx.fontKerning = "none";
ctx.fillText(`AVA Ta We (${ctx.fontKerning})`, 5, 110);
Note that the last string has font kerning disabled, so adjacent characters are evenly spread.
{{ EmbedLiveSample('Examples', 700, 150) }}
{{Specifications}}
{{Compat}}