microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.97k stars 29.19k forks source link

Font rendering looks ugly on Linux #35675

Closed sivakov512 closed 6 years ago

sivakov512 commented 7 years ago

Console output (when runs with verbose option):

node[23225]: pthread_create: Invalid argument
[23231:1006/140049.274771:ERROR:platform_thread_posix.cc(119)] pthread_create: Invalid argument
[23231:1006/140049.275482:ERROR:atom_browser_main_parts_posix.cc(199)] Failed to create shutdown detector task.
[main 2:00:49 PM] Starting VS Code in verbose mode
[main 2:00:49 PM] from: /home/cryptomaniac/Downloads/VSCode-linux-x64/resources/app
[main 2:00:49 PM] args: { _: [],
  help: false,
  h: false,
  version: false,
  v: false,
  wait: false,
  w: false,
  diff: false,
  d: false,
  add: false,
  a: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'unity-launch': false,
  'reuse-window': false,
  r: false,
  performance: false,
  p: false,
  'prof-startup': false,
  verbose: true,
  logExtensionHostCommunication: false,
  'disable-extensions': true,
  disableExtensions: true,
  'list-extensions': false,
  'show-versions': false,
  nolazy: false,
  'skip-getting-started': false,
  'sticky-quickopen': false }
[main 2:00:49 PM] Unable to read folders in /home/cryptomaniac/.config/Code/Workspaces (Error: ENOENT: no such file or directory, scandir '/home/cryptomaniac/.config/Code/Workspaces').
[main 2:00:50 PM] IPC#vscode-machineId
node[23309]: pthread_create: Invalid argument
[23231:1006/140050.847055:INFO:CONSOLE(28)] "%c[Extension Host] %cdebugger inspector at %cnode[23308]: pthread_create: Invalid argument
", source: file:///home/cryptomaniac/Downloads/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.main.js (28)
[main 2:00:51 PM] IPC#vscode-workbenchLoaded

Also, vscode font size outside editor (tabs, menus, etc) too small, - this is not from my gtk settings. For example, this is a screenshot of working emacs - all fonts are looks well. image

I'm working on Void Linux, VSCode ran from downloaded archive. Also, I use Chromium and have no any troubles.

Reproduces without extensions: Yes

chrmarti commented 7 years ago

@Tyriar There might be a font that is missing? (This is Linux.)

sivakov512 commented 7 years ago

@chrmarti as for editor, I set exists fonts for editor (Droid Sans Mono Slashed, DejaVu Sans Mono and Droid Sans)

Tyriar commented 7 years ago

@cryptomaniac512 does it look right when you remove your custom font setting?

sivakov512 commented 7 years ago

@Tyriar, no.

bpasero commented 7 years ago

@cryptomaniac512 is this a recent regression or are you using VS Code for the first time?

sivakov512 commented 7 years ago

@bpasero, I used the editor about 2 months ago and everything was fine.

sivakov512 commented 7 years ago

But font has always been small in spite of GTK settings :(

bpasero commented 7 years ago

@cryptomaniac512 any difference with our previous release (1.16) to see if this is a regression in 1.17 alone?

sivakov512 commented 7 years ago

Same problem image

bpasero commented 7 years ago

@cryptomaniac512 I should have posted the link for 1.15 because in 1.16 we updated our UI framework (Electron) and that might have an impact too. How does it look in VSCode 1.15?

sivakov512 commented 7 years ago

:( image

sivakov512 commented 7 years ago

Maybe try with 1.15.0 and 1.14?

sivakov512 commented 7 years ago

This problem reproduced with 1.14.2. It looks like a problem with another software, but I have no problem anywhere instead of vscode.

And I'm sure that everything was fine a couple of months ago

sivakov512 commented 7 years ago

Fonts look good when I set sub-pixel geometry to none instead of RGB image This screenshot is for the 1.14.2

sivakov512 commented 7 years ago

But fonts in latest release and 1.16 are too small (I'm working with 112 dpi) image Look at window bar (File, Edit, Selection, etc)

mgoku commented 7 years ago

Probably problem with Freetype.

I got the same problem when I upgrade to Freetype 2.8.1. Everything work fine with an older version of Freetype.

Someone on Phoronix forum said something about bugs with older version of Google Skia.

https://www.phoronix.com/forums/forum/software/desktop-linux/979076-freetype-improvements-for-the-adobe-engine?p=979131#post979131

christianburger commented 7 years ago

I have the same problem here, please advise if you find a solution / workaround. This font rendering issue occurs similarly with Atom in my case, no other applications are affected. Tested with Chromium Version 62.0.3202.18 (Developer Build) (64-bit) but also other versions, same result. I've tried also tweaking the antialias settings for my NVidia card and plasma5 environment, no success. It's really unuseable at the moment.

theychx commented 7 years ago

I can confirm that this is a FreeType related problem. Downgrading the libfreetype6 package on my Debian Sid box from 2.8.1-0.1 to 2.8-0.2 resolved this issue for me (I have also not had any problems with other applications).

christianburger commented 7 years ago

Yes, I`m amazed, I've also downgraded to 2.8.0 on my gentoo desktop and the issue is gone. Thanks a lot for your reply.

julian-klode commented 7 years ago

This seems to be Skia bug 6663:

https://bugs.chromium.org/p/skia/issues/detail?id=6663

wizardion commented 7 years ago

Hey guys, can anyone tell me how to downgrade the libfreetype6 in Ubuntu?

theychx commented 7 years ago

@wizardion The issue was introduced with freetype 2.8.1. As far as I can see, the latest version to have entered Ubuntu is 2.8 (which is the one we're downgrading to), so maybe your issue is not related to this?

wizardion commented 7 years ago

@theychx As I can see with the command apt-cache policy libfreetype6 - I have Installed version: 2.8.1-0.1~xenial. Not the 2.8-0.2ubuntu2 as you described. How can I downgrade to 2.8-0?

ragesoss commented 7 years ago

@wizardion try downloading the .deb and installing it manually: https://packages.ubuntu.com/bionic/amd64/libfreetype6/download

sudo dpkg -i libfreetype6_2.8-0.2ubuntu2_amd64.deb

The analogous process worked for me on Debian.

GreatDanton commented 7 years ago

I am on Debian Testing, downgrading libfreetype6 fixed this issue.

wizardion commented 7 years ago

@ragesoss Thank you for your help. I found another solution to do this on this page: https://github.com/achaphiv/ppa-fonts/tree/master/ppa. I changed the distribution from xenial to zesty after the adding a new repository, and I got 2.8-0ubuntu0.17.04ppa2 version.

Thank you for your help guys. Now the version 2.8-0 - solved my problem.

mgerner commented 6 years ago

For others who are on Debian, find libfreetype6 packages for downgrading here: http://snapshot.debian.org/package/freetype/2.8-0.2/#libfreetype6_2.8-0.2 and http://snapshot.debian.org/package/freetype/2.8-0.2/#libfreetype6-dev_2.8-0.2

Tyriar commented 6 years ago

There are open PRs to backport the skia fix for this to old versions of Electron https://github.com/electron/libchromiumcontent/issues/384#issuecomment-342741804

CaptainQwark commented 6 years ago

An alternative to downgrading libfreetype is extracting the older libfreetype.so.6.y.y from the .deb (libfreetype.so.6.12.3 for debian stretch), drop it in de code directory (/usr/share/code on debian) and rename it to libfreetype.so.6 . VSC will then pick up this version on a restart.

ismail commented 6 years ago

This seems to be fixed in electron 1.7 branch (https://github.com/electron/libchromiumcontent/pull/385) is there any chance to have the fix in next VSCode release?

cyphrack commented 6 years ago

I had the same issue. A workaround without having to change freetype, is to change your font rendering to standard grayscale antialiasing and slight / medium hinting. This issue only occured (at least for me) when I had the subpixel antialias.

Greets!

ricardojsmarques commented 6 years ago

@GreatDanton How did you downgrade in debian testing?

GreatDanton commented 6 years ago

@ddrjm, see @ragesoss's post above mine. Download old .deb package and run

sudo dpkg -i <your_package>

Package will be automatically downgraded for you.

josser commented 6 years ago

@cyphrack Can you please tell how did you managed to change font rendering?

cyphrack commented 6 years ago

@josser I used the Gnome Tweak Tool. But I'm pretty sure there's some X11 config file somewhere. Here's a great tutorial. https://wiki.archlinux.org/index.php/font_configuration

ngollan commented 6 years ago

Sadly not fixed in 1.19.0, but you do not need to downgrade libfreetype to make things look better. Just set FREETYPE_PROPERTIES to use the old renderer. Run

FREETYPE_PROPERTIES="truetype:interpreter-version=35" code

from a command line, or export it in your profile.

jgb commented 6 years ago

None of the suggested workarounds seem to fix this for me. Could this be picked up? This is quite a showstopper for a large amount of linux users.

ju1ius commented 6 years ago

Hi, I managed to get proper font rendering with this custom fontconfig:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <!-- Force RGBA subpixel aliasing to «none» in code and code-insiders -->
  <match target="pattern">
    <or>
      <test name="prgname">
        <string>code</string>
      </test>
      <test name="prgname">
        <string>code-insiders</string>
      </test>
    </or>
    <edit name="rgba" mode="assign">
      <const>none</const>
    </edit>
  </match>
</fontconfig>

Tested on Debian Sid, using:

code: 1.19.1-1513676
code-insiders: 1.20.0-1513750
libfreetype6: 2.8.1
fontconfig: 2.12.6

As a temporary workaround, maybe package maintainers could put this file in /usr/share/code/fontconfig.conf, then symlink it to /etc/fonts/conf.d/99-vscode.conf in a post-install script ?

evenfrost commented 6 years ago

Maybe a bit off-topic, but I ended up here looking how to improve Fira Code rendering in VSCode on Linux (Ubuntu 17.10). I have big 4K display, and Fira Code looked pretty ragged on it even with properly configured system anti-aliasing settings. And then I found out there is Fira Code Retina variation of the font. Set it as follows in VSCode settings:

 "editor.fontFamily": "'Fira Code Retina'"

Font looks a lot more juicy now, and I'm a lot more happier. :)

zero-master commented 6 years ago

Platform: Linux

VSCode:

image

Atom:

image

Sublime:

image

elmarsto commented 6 years ago

@cyphrack 's solution -- set hinting to medium and greyscale -- worked for me. Use gnome-tweak-tool to effect these changes on Xenial. I'm really grateful to them for sharing this easy, painless solution.

perfhunter commented 6 years ago

I can confirm font corruption problem on Ubuntu-18.04 alpha after updating libfreetype6 from 2.8.0 to 2.8.1. The proposed solution with setting truetype interpreter version doesn't work for me, disabling subpixel rendering via custom fontconfig does. P.S. vscode version is 1.19.2

ricardojsmarques commented 6 years ago

For those using gnome on debian, what font settings do you have? (size, font family, anti-aliasing, etc) I've used every method that doesn't require package holding but it doesn't seem to be working.

dgncn commented 6 years ago

I have encountered same issue on debian 9.3 stretch my libfreetype6 version was 2.8.1-1 I downgraded 2.6.3-3.2 with this command sudo apt-get install libfreetype6=2.6.3-3.2

you can know available versions with this command apt-cache showpkg libfreetype6

BanjoCam commented 6 years ago

I am running Antergos linux and this issue causes Vscode to be relatively unusable. (Unfortunately, coding in VScode is my primary reason for my linux machine...) Downgrading freetype2 worked perfectly for me (none of the other mentioned fixes do) but unfortunately recent system updates break my system unless I upgrade to a more recent freetype2. So I'm a bit stuck!

I noticed this recent post on the Atom version of this issue: https://github.com/atom/atom/issues/15737#issuecomment-361742630 I know very little about how VScode actually works, but could a similar solution be done here?

Thanks!

Tyriar commented 6 years ago

Thanks @BanjoCam, looks like this will be fixed when we upgrade Electron.

Hamper commented 6 years ago

I'm tried to build vscode 1.19.3 with electron 1.7.12 and this bug was really fixed.

zero-master commented 6 years ago

@BanjoCam I am also using the latest version of Antergos (no special tweaks, running out of box) and not experienced any font rendering issues with VSCode. Linux z97 4.14.15-1-ARCH #1 SMP PREEMPT

Full system upgrade should solve your issue:

sudo pacman -Syu

BanjoCam commented 6 years ago

@zero-master Thanks for the reply! I guess "unusable" was a bit of hyperbole, but to me the differences between the older freetype2 and the current one are pretty noticeable and I found to be hard on the eyes for longer coding sessions. I do have a fully updated system (actually with the most recent updates, something broke with keeping the older freetype installed... I ended up doing a full system reinstall, so my setup is REALLY fresh and updated and completely untweaked!).

If I get a chance later I will post a before/after shot but I am really looking forward to it being fixed!

zero-master commented 6 years ago

@BanjoCam Here is how it looks on my setup:

image

Looking forward to your screenshots! Thanks.