Vscode: "l路l" Ligature in "Source Code Pro" incorrectly invoked when render whitespace is enabled

Created on 13 Sep 2020  路  5Comments  路  Source: microsoft/vscode




  • VSCode Version: 1.49.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Set editor.renderWhitespace to all.
  2. Set editor.fontFamily to Source Code Pro (ensure you have the font installed on your system).
  3. Set editor.fontLigatures to false (this issue is not reproducible if this setting is not set to false).
  4. Open a new editor and type l l (a lowercase letter "l", followed by a space, followed by another lowercase letter "l").

Screenshot of this bug:

When editor.renderWhitespace is set to all, the whitespace character (U+0020) is rendered as the middle dot unicode character, (U+00B7). Coincidentally, "Source Code Pro" has a ligature that comprise of the characters l路l (see the screenshot above), so this might be the reason why the ligature is invoked.


Does this issue occur when all extensions are disabled?: Yes

bug electron-9-update font-rendering

Most helpful comment

Workaround: configure "editor.fontLigatures": "'liga' off, 'calt' off"
configure "editor.fontLigatures": "'ccmp' off"

All 5 comments

This does not reproduce when running with --disable-features=LayoutNG

Workaround: configure "editor.fontLigatures": "'liga' off, 'calt' off"
configure "editor.fontLigatures": "'ccmp' off"

OK. I have actually found out quite a number of things while investigating this:

  • https://wakamaifondue.com/ can be used to upload a font and get a list of all the font features settings available in that font
  • Source Code Pro has 37 available font feature settings: 'case', 'ccmp', 'cv01', 'cv02', 'cv04', 'cv06', 'cv07', 'cv08', 'cv09', 'cv10', 'cv11', 'cv12', 'cv14', 'cv15', 'cv16', 'cv17', 'dnom', 'frac', 'locl', 'numr', 'onum', 'ordn', 'salt', 'sinf', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'subs', 'sups', 'zero', 'mark', 'mkmk', 'size'
  • By doing a binary search on them, it is the font feature setting named 'ccmp' that is causing l路l to be rendered with a different glyph.
  • Here is what I could find about ccmp
  • It looks like Source Code Pro registers a ligature for the character sequence l路l. The is the character we use to render whitespace.
  • This ligature is no longer disabled via 'liga' off, 'calt' off as it used to be the case in the past.

TL;DR: This has changed since VS Code 1.49 because we have upgraded to Electron 9, which ships layoutNG. I am not convinced this is a bug, it might just be something unique about Source Code Pro. The workaround is to use "editor.fontLigatures": "'ccmp' off"

TL;DR: This has changed since VS Code 1.49 because we have upgraded to Electron 9, which ships layoutNG. I am not convinced this is a bug, it might just be something unique about Source Code Pro. The workaround is to use "editor.fontLigatures": "'ccmp' off"

I run into this issue as well. If this is a not a bug, what is it? I don't mind having fine control over font features (that sounds great actually). However, there really should be a simple setting that effectively disables all use of font ligatures. Something like "editor.fontLigatures": "all off", but it would be even better if false actually meant "all off".

The fact that the editor uses an actual text character () to implement whitespace indicators seems like an implementation detail. I'd say since the user didn't intentionally insert , its a bug if ligatures fire on that character sequence. Maybe not easy to fix (I don't know), but I do think this is a bug. The user entered l l (elle space elle) not l路l (elle dot elle) and the ligature is not intended to trigger for l l.

Furthermore, the caret positioning for the rest of the line becomes incorrect:
See this result with the problematic ligature turned on:
image
See this result once "editor.fontLigatures": "'ccmp' off" is applied:
image

Furthermore, the caret position jumps around when faced with navigating the line after the ligature occurs, and selection also assumes it is rendered as if the ccmp feature is off:
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukehoban picture lukehoban  路  3Comments

trstringer picture trstringer  路  3Comments

vsccarl picture vsccarl  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

borekb picture borekb  路  3Comments