Inter: Issue when using -webkit-text-stroke

Created on 21 Jun 2020  路  5Comments  路  Source: rsms/inter

Describe the bug
When using css class -webkit-text-stroke-color & -webkit-text-stroke-widthto put a border fitting the text, there are some unwantend border. Like this :

To Reproduce
Steps to reproduce the behavior:

  1. Create a <div>
  2. Put some text in it, especialy these characters : t, k, &, e
  3. Add these css classes : -webkit-text-stroke-color: red; -webkit-text-stroke-width: .8px; color: transparent (it also works when setting a color to the text)

Expected behavior
This should looks like this (here, using system font) :
Capture d鈥檈虂cran 2020-06-21 a虁 11 26 04

Environment

  • OS: macOS 10.14
  • App that renders the font : firefox
  • Version of font : 3.13

Most helpful comment

I see! You are using the variable font.

TL;DR: Use static/constant fonts instead of the variable version.

Screen Shot 2020-08-17 at 09 47 43

This is unfortunately a bug (or really, a limitation) of the rendering engine in some web browsers. The variable font uses overlapping shapes to be able to be variable (technical reasons.) Most quality font renderers will apply what is usually called "boolean union" on the shapes of a glyph prior to rendering. Not doing this causes issues with regular "filled" rendering in addition to stroked rendering.

For example, Figma correctly applies the boolean union on the glyph's shapes _before_ generating stroke geometry:
Screen Shot 2020-08-17 at 09 55 42

However, some design tools like Sketch fails, just like some web browsers:
Screen Shot 2020-08-17 at 09 54 52

So, this is unfortunately an issue with the _software_ rendering the font.

All 5 comments

I came here for the same reason! +1

Did you by any chance use the fonts from Google Fonts?
If you did, can you please try with the official release from https://github.com/rsms/inter/releases/latest ?
If you didn't can you please provide information about what exact font files you are using? (otf, ttf, hinted or not, etc. And if you can, a sha or md5 checksum of the file data for the font file.)

I鈥檓 using the official files downloaded from your website.
Here is an example using the CDN https://jsfiddle.net/fc47r3b6/

I also use the CDN: https://rsms.me/inter/inter.css

I see! You are using the variable font.

TL;DR: Use static/constant fonts instead of the variable version.

Screen Shot 2020-08-17 at 09 47 43

This is unfortunately a bug (or really, a limitation) of the rendering engine in some web browsers. The variable font uses overlapping shapes to be able to be variable (technical reasons.) Most quality font renderers will apply what is usually called "boolean union" on the shapes of a glyph prior to rendering. Not doing this causes issues with regular "filled" rendering in addition to stroked rendering.

For example, Figma correctly applies the boolean union on the glyph's shapes _before_ generating stroke geometry:
Screen Shot 2020-08-17 at 09 55 42

However, some design tools like Sketch fails, just like some web browsers:
Screen Shot 2020-08-17 at 09 54 52

So, this is unfortunately an issue with the _software_ rendering the font.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jenil picture jenil  路  7Comments

ivan-kleshnin picture ivan-kleshnin  路  6Comments

vilav picture vilav  路  5Comments

vladmoroz picture vladmoroz  路  3Comments

chrisdrackett picture chrisdrackett  路  6Comments