7

I have been using Sublime Text 2 for a while and are trying to switch to GitHub's Atom editor. Probably the only issue I still haven't resolved is font rendering. The text in the Atom editor is very blurry.

Everywhere else (including Chrome), the text is sharp and OK to read. But not for Atom. For comparison: text rendering for Atom (first line) and Sublime Text 2 (second line).

enter image description here

Both editors use the Monokai theme, with the same font (Consolas, size 12) and font color.

My OS is Windows 8.1 Pro x64 and I have ClearType disabled. I am using the latest version of Atom, which is currently 1.0.11.

I have already done an extensive search and found a lot of solutions, but none of them worked. For example: this, this, this, and this.


UPDATE

I have made some progress on the topic. If I disable DirectWrite, then the text becomes more sharp, but other images and graphics become more jaggy. But since I look at the text 99% of the time, this is not an issue.

My solution to disable DirectWrite is to add --disable-direct-write when launching Atom from command prompt. However, I am not satisfied with this solution, since it does not work when I open Atom from Start Menu, Taskbar or Context menu ("Open with Atom").

Updated question: how do I permanently add --disable-direct-write argument to Atom so that it applies when launching from Taskbar, Start Menu or Open with Atom context menu.

  • 1
    Hmm, the text rendering only seems blurry on my Windows machine when I have ClearType disabled - and like you, setting the -webkit-font-smoothing option seems to do nothing on Windows. – Breakthrough Sep 25 '15 at 5:00
  • 1
    Also, if you're comfortable hacking the source code and recompiling, you should be able to modify the atom/src/browser/atom-window.coffee file by changing the direct-write option to false. This is set in the AtomWindow class, so it may be possible to change with scripting as well (investigating that now). – Breakthrough Sep 25 '15 at 5:16
  • Nice! Hope you come up with something simple and effective. Because a new Atom version is announced every few days and if the compiling is a complex process it probably won't be convenient. Make sure to write an answer in order to get the bounty. – alesc Sep 25 '15 at 7:35
3

I have solved the issue with a custom post-update script, which fixes Registry entries and Start Menu shortcuts in order to add the --disable-direct-write argument.

Shortcuts

As I have stated at @codeSwift4Life's answer, appending --disable-direct-write won't work with shortcuts to the Update.exe process (which is actually a Squirrel program). However, I did found out how to append arguments to the --processStart atom.exe command. See this issue.

Therefore, If you wish to change the Atom shortcut to append --disable-direct-write, you have to change it from:

C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe

to one of the following lines:

C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe -a "--disable-direct-write"
C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe --process-start-args "--disable-direct-write"

Context menu

To change the "Open with Atom" context menu, you have to update a few registry entries. Change them from:

X:\Path\to\atom\app-1.0.xx\atom.exe "%V"

to:

X:\Path\to\atom\app-1.0.xx\atom.exe "%V" --disable-direct-write

Automated post-update script

But since there are many registry entries and since you have to repeat everything after every update (and updates are very frequent), manual changes aren't feasible.

Therefore I have created an automated post-update script, which updates everything automatically. You just have to run it after every Atom update.

The base of my post-update script was this coffee script, which is actually the stock script that overrides all our manual changes.

You have to change the aforementioned script in the following manner:

Change:

createShortcuts = (callback) ->
  spawnUpdate(['--createShortcut', exeName], callback)

to:

createShortcuts = (callback) ->
  spawnUpdate(['--createShortcut', exeName, '--process-start-args', '--disable-direct-write'], callback)

Change:

  installMenu = (keyPath, arg, callback) ->
    args = [keyPath, '/ve', '/d', 'Open with Atom']
    addToRegistry args, ->
      args = [keyPath, '/v', 'Icon', '/d', process.execPath]
      addToRegistry args, ->
        args = ["#{keyPath}\\command", '/ve', '/d', "#{process.execPath} \"#{arg}\""]
        addToRegistry(args, callback)

to:

  installMenu = (keyPath, arg, callback) ->
    args = [keyPath, '/ve', '/d', 'Open with Atom']
    addToRegistry args, ->
      args = [keyPath, '/v', 'Icon', '/d', atomExe]
      addToRegistry args, ->
        args = ["#{keyPath}\\command", '/ve', '/d', "#{atomExe} \"#{arg}\" --disable-direct-write"]
        addToRegistry(args, callback)

The atomExe variable is defined as following (put it at the top, but after the require lines):

# Get the latest version of atom.exe
parentDir = fs.listSync('..').filter (x) -> x.indexOf('app-') > -1;
[..., atomDir] = parentDir
atomExe = path.join(path.resolve(atomDir), 'atom.exe')

Also, you have to find/replace process.execPath with atomExe. This is needed because the script will be run directly via Node, and the process variable points to Node instead of Atom.

Finally, add the following lines to the end of the script, in order to execute shortcuts and registry updates:

# Update shortcuts, install context menu
updateShortcuts ->
  installContextMenu ->

The script is executed with coffee squirrel-update.coffee. You should place it into a new subfolder inside the AppData\Local\atom folder. You will also need fs-plus and coffee-script node packages in order to successfully run the script.

2
+50

If you're comfortable hacking the Atom source code, you can manually disable direct-write by modifying the following file in the source tree: atom/src/browser/atom-window.coffee

Specifically, on lines 29-31:

  'web-preferences':
    'direct-write': true
    'subpixel-font-scaling': false

I don't believe the direct-write option is exposed to the scripting API yet, so you would have to modify & recompile Atom manually. I would also try the subpixel-font-scaling option, which also might help to increase text rendering clarity.

  • I have found a better solution. See my answer for more details. – alesc Sep 26 '15 at 15:56
0

Open in File Browser. C:\Users\your-username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc Then right click on Atom, choose properties. Then under target, add --disable-direct-write at the end. Make sure you replace your-username with your home folder's name. Also, make sure that if there are other shortcuts, you fix them.

Properties

  • Have you even tried your solution out? Because it doesn't work. This was the first thing I have done before even writing the update and setting the bounty. And also (if it worked) this is only the solution for launching Atom from Start Menu. My primary goal is to fix the "Open with Atom" context menu, which you must update in Registry - but it changes after every Atom update. – alesc Sep 21 '15 at 17:49
  • A temporary work around would be navigating to HKEY_CLASSES_ROOT\*\shell\Atom\command and adding --disable-direct-write to the end – juniorRubyist Sep 21 '15 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.