Dec 112014
 

FreeBSD + WineSince I’ve abandoned OpenBSD for FreeBSD in my recent attempts to actually use a ‘real’ UNIX system, and all that just because of Wine so I can use some small Windows tools I need (yeah…), I was a bit fed up with Wines’ font anti-aliasing not working. I remember having a similar problem on CentOS Linux some while back, but I can’t remember how I solved it on that OS. Thing is, I just want to document my solution here briefly, so I don’t forget it, if I have to re-do this any time soon. The problem seems to originate from the X11 render extension that is being used for compositing on X11 without any additional compositing engine like Compiz. Wines usage of the extension is actually controlled by its system registry, and the key that seems to need editing is HKEY_CURRENT_USER\Software\Wine\X11 Driver\ClientSideWithRender.

Interestingly, people suggested to switch the use of the X render extension off instead of on, but when inspecting my setup by running wine regedit, I found I didn’t even have the key, and its default is off! So what saved me was:

  1. [HKEY_CURRENT_USER\Software\Wine\X11 Driver]
  2. "ClientSideWithRender"="Y"

Setting this back to “N” is basically the same thing as just deleting the key altogether, at least with the current default configuration of my Wine version on FreeBSD, which is wine-1.6.2. See how it looks like with no anti-aliasing (click to enlarge):

Wine running its regedit on FreeBSD 10 with no font AA

Wine running its regedit on FreeBSD 10 with no font AA

And here with proper AA, again, please click to enlarge so you can see the effect applied:

Wine with proper font anti-aliasing

Wine with proper font anti-aliasing

To demonstrate the effect more prominently, let’s look at some zoomed in versions, click to enlarge again for all the glory or so:

No anti-aliased fonts here, all jagged

No anti-aliased fonts here, all jagged

And:

Wine font anti-aliasing up close, nice and smooth

Wine font anti-aliasing up close, nice and smooth

Now I heard that some people actually prefer the clearer look of jagged fonts, or they may prefer pure gray smoothing, but I actually like the look of this smoothing a lot more. This is with medium font hinting turned on in Xfce4, and it appears very smooth and nice to my eyes.

If you want to try this in case you’re offended by jagged fonts using wine, just take the following:

  1. [HKEY_CURRENT_USER\Software\Wine\X11 Driver]
  2. "ClientSideWithRender"="Y"

Save it into a file like wine-Xrender-fontAA.reg, and then import it into your wines registry database by opening a terminal, going into the directory where your reg file sits, and by running: wine regedit ./wine-Xrender-fontAA.reg. Then restart your wine application and it should work for 99% of the fonts. I’ve encountered one font in Bruce Schneiers [PasswordSafe] that wouldn’t anti-alias, ever. But it’s the same on Windows, so I’m guessing that’s ok.

Switching it off is just as easy, just edit the file, change “Y” to “N” and re-run the wine regedit command. But as I said, I’ll keep it, no more eye cancer when starting Win32 applications on FreeBSD. :)

CC BY-NC-SA 4.0 Wine and font anti-aliasing on FreeBSD 10.x (and others I guess) by The GAT at XIN.at is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

  4 Responses to “Wine and font anti-aliasing on FreeBSD 10.x (and others I guess)”

  1. Whether smoothing may look better, may also depend on the monitor used. I’ve seen a few monitors which can’t quite deal with the smoothed letters and turn it in to some sort of rainbow. It’s still readable, but it just doesn’t look right. With others, it’s just the other way around.

    I think there are more settings to this: http://www.howtogeek.com/howto/14800/using-cleartype-tuner-in-windows-7/ (sorry if that’s offensive ;-))

    • Nah, it’s ok. ;)

      Let’s be all cosmopolitan when it comes to operating systems today. ;) Besides, Cleartype on Windows is likely the most wide-spread font smoothing technique in use today, and it’s also subpixel based.

      Actually, the Cleartype Tuner also works on XP with [this Powertoy from Microsoft], as I tried to play around with it on my XP x64 installation to see how it really looks when it’s done wrong. And it’s pretty bad. Reason being the subpixel order of a screen. For all monitors I’ve encountered, the order was horizontal red-green-blue. There are varieties though, and this also applies when you pivot your monitor which will rotate the subpixel order into a vertical RGB or BGR. Here, see this macro photo I took of my Dell Ultrasharp 3008WfP monitor, where you can clearly see the RGB subpixel order, including some font anti-aliasing:

      Subpixel order on a Dell 3008WfP
      (Click to enlarge)

      Luckily, just like with the Cleartype Tuner, you’ll have tools on most Linux/UNIX window managers to adjust the subpixel order for the corresponding font smoothing algorithms. With Xfce4 on FreeBSD, it looks like this:

      Setting the font smoothing subpixel order with Xfce4 on FreeBSD 10.1 UNIX
      (Click to enlarge)

      So no worries there. :) And if you don’t like the introduction of colors into the font anti-aliasing at all (which also happens to some degree when using the correct subpixel order), some window managers / desktop environments will also allow you to use different algorithms like simple grey smoothing, which works well on all monitors. I know at least Gnome can do that, the other big ones too I assume.

      • Ah, thanks for explaining, I didn’t know about subpixel orders!

        • Yeah, so in essence, they’re trying to triple the horizontal resolution here – or the vertical, if you pivot by 90°. So they cannot only regulate the brightness of a whole pixel, but e.g. in a regular horizontal setting they can also selectively dim the leftmost (red) or rightmost (blue) subpixel by shifting the pixels color. What you get is a finer gradient, finer than your pixel dpi. For the price of color shifting.

          A dirty but interesting litte hack. :)

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

(required)

(required)