Get Down to the Nitty-Gritty of Text Rendering in Sketch

Have you ever worked with text layers in Sketch and didn’t understand what was going on? I know I have. Out of frustration I decided to do some research and testing to figure out how Sketch renders text layers.

Text rendering is a complex thing with many layers of abstraction. In this article I’ll share with you what I found out about Text Rendering in Sketch.

What does the bounding box represent?

You’ve seen it in Sketch, that grey lined box around a text layer on your canvas. It has handles on the outside to resize it. But why is it the size that it is? Why doesn’t it snap to the actual pixels that make up the letters? What is all this white space around the characters?

Turns out that these measurements are based on the specific font you use. Each font has global font metrics embedded inside of it. Sketch uses the following metrics of a font to determine that box that shows around your text layer on the canvas:

  • Cap Height: how high the capitals are.
  • x-Height: how high the lowercase letters are. (specifically the lowercase x)
  • Ascender: how far the letters stick out at the top (e.g. b k, l, ß)
  • Descender: How far the letters stick out under the baseline.(e.g. p, j, y, q)

These standards are defined in the Adobe Font Metrics File Format Specification on which most modern fonts are based on.

Font metrics.

These metrics summed together are what we call the em. You might recognize these boxes. They’re very similar to movable type. This is a typesetting technology in which you use use metal blocks with a character carved out of them. By putting these letters next to each other you form a sentence that you can print onto paper.

Sketch renders the height of the text layers based on the layer’s line-height, which is based on the above-mentioned metrics (source).

Willi Heidelbach, GFDL, CC-BY-SA-3.0 or CC BY 2.5, via Wikimedia Commons.

How does Sketch handle text that is on subpixels?

Now that you understand how the height of a text layer is rendered by Sketch you may ask yourself; what if a text layer is placed on subpixels? To prevent your text from looking blurry Sketch will always snap the baseline of your text to the nearest rounded y-position. Pretty neat!

This is also true for when you use a line-height with decimal places.

Baseline pixel snapping behavior in Sketch.


The y-value placement of the entire text layer is just one of the many things you can adjust in Sketch. Lucky for typography lovers there are also plenty of adjustments you can make to what happens inside the text box.

Character spacing

With character spacing (often also referred to as letter spacing, or tracking) you can adjust the overall horizontal spacing between individual letters. Character spacing is measured in pixels. By default Sketch uses increments of 0.1px, but you can also hold shift while adjusting the value to increase in 1px increments.

There is one big caveat though in using character spacing: it disabled kerning. Kerning is information embedded in a font file that specifies character spacing information for specific letter combinations. This is basically the subtle adjustments a font-designer has proposed to create the optical ‘ideal’ distance between characters, honering the overall font design to make letters appear as if they have optically the same space between them.

Note that even if you set your character spacing to 0, kerning will still be disabled, which will undo all the hard work the font designer has done to improve the spacing issues within a font.

To re-enable kerning, remove the number from the input field and submit the empty input field. This will set the value in the input field back to auto which makes sure that you are using the kerning that the font designer intended. This will save your design from some bad typography.

Also note that when you use 0 instead of auto this will also clutter up your CSS when you copy it from Sketch since it adds a line with letter-spacing: 0. In CSS this doesn’t have the same issues as in Sketch, but it may conflict with any other letter-spacing settings you’ve already set up in your stylesheet.

After you’ll notice bad kerning you’ll always read this as “T ext”.

Another thing to keep in mind when you use a large character spacing is that ligatures won’t respect this. A Ligature is a character that replaces a series of characters to fix spacing issues when the two are typed after each other. A common ligature is since the top of the f and the i intersect. When you alter the default character spacing it’s best to disable ligatures to keep the rhythm of the text going.

Using ligatures with a large character spacing hinders the rhythm of the text.

Here’s how you can disable ligatures in Sketch:

  1. Go to ViewShow Fonts
  2. In the Fonts window click on Typography
  3. Go into the Ligatures section and uncheck the options
The macOS OpenType settings panel.

Line spacing

Not only can you set spacing between individual characters. Spacing can also be set in between two lines of text. In Sketch you can either use the default line-spacing set by the font, or use a custom pixel-value. The default line height for a newly created text layer is set by the font. To use this default line-height after you’ve altered it you need to remove the number in the line spacing input field and submit. This will (re)set any custom line spacing and the correct line-height pixel value for the set font-size will be shown in light-grey inside the line spacing input field.

Note that if you adjust the line-height the baseline of the first line will stay on the same y-position.

Paragraph spacing

There are two types of line breaks in Sketch: paragraph breaks and line breaks. If you hit return you start a new paragraph (or alt + return for symbol overrides). If you hit shift + return you create a line break.

The amount of pixels you enter in the paragraph spacing field will be added in between the lines where you added the new paragraph.

This can be very helpful if you’re making list items that wrap to the next line.

One thing I found during some testing is that you can’t create line breaks within symbol overrides.

Line vs. paragraph breaks.


As with anything in typography: small changes don’t have a big impact, but they do add up to something greater when you combine all of the tiny changes together. While typography is something people don’t recognize often enough, it’s something that’s felt.

Leave a Reply

Your email address will not be published. Required fields are marked *