Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] TrueType Fonts Look Jagged When Antialias Is Off
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Fri Sep 01, 2017 11:12 pm    Post subject: [Solved] TrueType Fonts Look Jagged When Antialias Is Off Reply with quote

Here is what my terminal looks like:
https://ibin.co/3YpGTC9qbgx5.png

Code:
$ cat ~/.Xresources
urxvt.font:         xft:xos4 Terminus:pixelsize=16
urxvt.boldFont:     xft:xos4 Terminus:pixelsize=16

$ grep \*font ~/.fluxbox/styles/mystyle
*font: verdana-10
window.label.*font: dotum-10


The window label's font is "dotum" from a different machine, and the terminal's font is "media-fonts/terminus-font".
They all look quite sharp with no jaggedness, just the way I like it.

But "verdana" from "media-fonts/corefonts" in other parts of Fluxbox looks like this:
https://ibin.co/3YpGjk6ecmCt.png

It looks as if the font is drawn with anti-aliasing turned on, but somehow I'm missing the part that makes it smooth.

If I use "terminus" for the menu, I do get the sharpness back, but it's mono-space, which I don't want it in the menu.
https://ibin.co/3YvSBtjT4hYU.png

So, how do I make "verdana" (or anything from "corefonts" for that matter) look sharp like "dotum" or "terminus"? This wasn't a problem when I set up the machine a while ago, but I just noticed it after not using the graphical environment for quite a while (and several "emerge -vDuN @world" later).

Here are some of the settings that might be relevant.
Code:
$ fc-list | grep -i verdana
/usr/share/fonts/corefonts/verdanab.ttf: Verdana:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,Lodia
/usr/share/fonts/corefonts/verdana.ttf: Verdana:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/corefonts/verdanaz.ttf: Verdana:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,Lodi etzana
/usr/share/fonts/corefonts/verdanai.ttf: Verdana:style=Italic,Cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,Etzana

$ eselect fontconfig list
Available fontconfig .conf files (* is enabled):
  [1]   10-autohint.conf
  [2]   10-no-sub-pixel.conf
  [3]   10-scale-bitmap-fonts.conf *
  [4]   10-sub-pixel-bgr.conf
  [5]   10-sub-pixel-rgb.conf
  [6]   10-sub-pixel-vbgr.conf
  [7]   10-sub-pixel-vrgb.conf
  [8]   10-unhinted.conf
  [9]   11-lcdfilter-default.conf
  [10]  11-lcdfilter-legacy.conf
  [11]  11-lcdfilter-light.conf
  [12]  20-unhint-small-vera.conf *
  [13]  25-unhint-nonlatin.conf
  [14]  30-metric-aliases.conf *
  [15]  30-urw-aliases.conf *
  [16]  39-clearfonts.conf *
  [17]  40-nonlatin.conf *
  [18]  45-latin.conf *
  [19]  49-sansserif.conf *
  [20]  50-user.conf *
  [21]  51-local.conf *
  [22]  60-latin.conf *
  [23]  65-fonts-persian.conf *
  [24]  65-khmer.conf
  [25]  65-nonlatin.conf *
  [26]  69-unifont.conf *
  [27]  70-no-bitmaps.conf
  [28]  70-yes-bitmaps.conf
  [29]  75-yes-terminus.conf
  [30]  80-delicious.conf *
  [31]  90-synthetic.conf *
  [32]  99pdftoopvp.conf

$ emerge -pv fluxbox
[ebuild   R    ] x11-wm/fluxbox-1.3.7-r3::gentoo  USE="imlib nls slit systray toolbar truetype -bidi -vim-syntax -xinerama" 769 KiB


I'd appreciate any suggestions.
__
sol


Last edited by solamour on Fri Sep 08, 2017 7:24 pm; edited 2 times in total
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1129
Location: Romania

PostPosted: Mon Sep 04, 2017 7:23 pm    Post subject: Reply with quote

I have these settings for fonts:

.Xresources/.Xdefaults
Code:

Xft.antialias:true
Xft.hinting:true
Xft.hintstyle:hintfull
Xft.rgba:rgb
Xft.dpi:96
Xft.lcdfilter:lcddefault


.config/fontconfig/fonts.conf
Code:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <dir>~/.local/share/fonts</dir>
 <match target="font">
  <edit name="rgba" mode="assign">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit name="hinting" mode="assign">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit name="hintstyle" mode="assign">
   <const>hintfull</const>
  </edit>
 </match>
 <match target="font">
  <edit name="antialias" mode="assign">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit name="lcdfilter" mode="assign">
   <const>lcddefault</const>
  </edit>
 </match>
 <dir>~/.fonts</dir>
</fontconfig>


https://wiki.gentoo.org/wiki/Fontconfig
https://wiki.archlinux.org/index.php/font_configuration
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Mon Sep 04, 2017 8:27 pm    Post subject: Reply with quote

sebaro wrote:
I have these settings for fonts:


The magic keyword for me was "antialias".
Code:
~/.config/fontconfig/fonts.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="font">
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
    </match>
</fontconfig>


Now, the menu certainly looks better than before. No more blocky texts.
https://ibin.co/3ZGPxFThJVwx.png

But I personally prefer something like the following.
https://ibin.co/3ZGQ1vqBqpYY.png
I think all those antialias, subpixel, hinting would make everything look great if I had a really high resolution monitor.
__
sol
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1129
Location: Romania

PostPosted: Tue Sep 05, 2017 11:00 am    Post subject: Reply with quote

You can try the other hinting styles and lcd filtering options. See wikis above.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Wed Sep 06, 2017 12:28 am    Post subject: Reply with quote

sebaro wrote:
You can try the other hinting styles and lcd filtering options. See wikis above.


I tried pretty much all the variations of hinting, hintstyle, lcdfilter, and rgba, but I just couldn't make TrueType fonts to show up like "Terminus" does (i.e. not jagged nor blurry). Considering that certain fonts (e.g. "media-fonts/artwiz-latin1" or "media-fonts/terminus-font") do show up sharp, I think using a bitmap font would be my next best choice. I'm not sure why turning off "antialias" didn't result in jagged texts before, though.

Anyhow, I'll use "Terminus" for now (I wish there were a variable-width), although I'll keep looking. Thanks everyone for taking time to respond.
__
sol
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Thu Sep 07, 2017 12:59 am    Post subject: Reply with quote

In short, this is what I want my Gentoo/Fluxbox to look like.
https://ibin.co/3ZVoNJIeSwzR.png

The screen shot is from Ubuntu with "ttf-mscorefonts-installer" package installed, the default font set to "Verdana Regular", and antialiasing set to "none". No other changes.

I'm fairly positive my system looked like the screen shot, but something related to the text drawing must have changed while I wasn't using the graphical environment.
__
sol
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5593

PostPosted: Thu Sep 07, 2017 6:07 pm    Post subject: Reply with quote

Try this:
Code:
...
  <match target="font">
    <test name="family">
      <string>Verdana</string>
    </test>
    <edit name="antialias" mode="assign"><bool>false</bool></edit>
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="autohint" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
  </match>
</fontconfig>
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Fri Sep 08, 2017 12:27 am    Post subject: Reply with quote

Ant P. wrote:

Code:
...
    <edit name="autohint" mode="assign"><bool>true</bool></edit>


I must say "autohint" was the closest I've gotten so far. It's not quite there yet, but certainly closer than others.

The top is Gentoo/Fluxbox, and the bottom is Ubuntu/Fluxbox.
https://ibin.co/3ZcdOFarK3h6.png

Here is the comparison between the two.
Code:
[gentoo]

$ fc-match -v verdana
Pattern has 37 elts (size 48)
        family: "Verdana"(s)
        familylang: "en"(s)
        style: "Normal"(w) "obyčejné"(w) "Standard"(w) "Κανονικά"(w) "Regular"(w) "Normaali"(w) "Normál"(w) "Normale"(w) "Standaard"(w) "Normalny"(w) "Обычный"(w) "Normálne"(w) "Navadno"(w) "Arrunta"(w)
        stylelang: "ca"(w) "cs"(w) "de"(w) "el"(w) "en"(w) "fi"(w) "hu"(w) "it"(w) "nl"(w) "pl"(w) "ru"(w) "sk"(w) "sl"(w) "eu"(w)
        fullname: "Verdana"(w)
        fullnamelang: "en"(w)
        slant: 0(i)(s)
        weight: 80(i)(s)
        width: 100(i)(s)
        size: 12(f)(s)
        pixelsize: 12.5(f)(s)
        foundry: "microsoft"(w)
        antialias: False(w)
        hintstyle: 1(i)(w)
        hinting: True(s)
        verticallayout: False(s)
        autohint: False(s)
        globaladvance: True(s)
        file: "/usr/share/fonts/corefonts/verdana.ttf"(w)
        index: 0(i)(w)
        outline: True(w)
        scalable: True(w)
        dpi: 75(f)(s)
        scale: 1(f)(s)
        charset:
        0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
        0001: ffffffff ffffffff ffffffff ffffffff 00040000 00018003 00000000 fc000000
        0002: 00000000 00000000 00000000 00000000 00000000 00000000 3f0002c0 00000000
        0003: 0000020b 00000008 00000000 40000000 ffffd7f0 fffffffb 00007fff 00000000
        0004: ffffdffe ffffffff dffeffff 00000000 00030000 00000000 00000000 00000000
        001e: 00000000 00000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff
        0020: 7fb80000 560d0047 00000010 80000000 00000000 00001898 00000000 00000000
        0021: 00480020 00004044 78000000 00000000 00000000 00000000 00000000 00000000
        0022: 46268044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
        0025: 00000000 00000000 00000000 00000000 00000000 00000c02 00008400 00000040
        00f0: 00001ff6 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
        lang: aa|af|av|ay|be|bg|bi|bin|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|
      fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|
      mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sk|sl|sma|smj|smn|
      so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|
      fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
        fontversion: 65536(i)(s)
        fontformat: "TrueType"(w)
        embeddedbitmap: True(s)
        decorative: False(s)
        lcdfilter: 1(i)(w)
        namelang: "en"(s)
        prgname: "fc-match"(s)
        hash: "sha256:96ed14949ca4b7392cff235b9c41d55c125382abbe0c0d3c2b9dd66897cae0cb"(w)
        postscriptname: "Verdana"(w)
        color: False(w)
        symbol: False(w)


Code:
[ubuntu]

$ fc-match -v verdana
Pattern has 36 elts (size 48)
   family: "Verdana"(s)
   familylang: "en"(s)
   style: "Regular"(s) "Normal"(s) "obyčejné"(s) "Standard"(s) "Κανονικά"(s) "Normaali"(s) "Normál"(s) "Normale"(s) "Standaard"(s) "Normalny"(s) "Обычный"(s) "Normálne"(s) "Navadno"(s) "Arrunta"(s)
   stylelang: "en"(s) "ca"(s) "cs"(s) "de"(s) "el"(s) "fi"(s) "hu"(s) "it"(s) "nl"(s) "pl"(s) "ru"(s) "sk"(s) "sl"(s) "eu"(s)
   fullname: "Verdana"(s)
   fullnamelang: "en"(s)
   slant: 0(i)(s)
   weight: 80(i)(s)
   width: 100(i)(s)
   size: 12(f)(s)
   pixelsize: 12.5(f)(s)
   foundry: "MS  "(w)
   antialias: False(w)
   hintstyle: 1(i)(w)
   hinting: True(w)
   verticallayout: False(s)
   autohint: False(s)
   globaladvance: True(s)
   file: "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf"(w)
   index: 0(i)(w)
   outline: True(w)
   scalable: True(w)
   dpi: 75(f)(s)
   scale: 1(f)(s)
   charset:
   0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
   0001: ffffffff ffffffff ffffffff ffffffff 00040000 00018003 00000000 fc000000
   0002: 00000000 00000000 00000000 00000000 00000000 00000000 3f0002c0 00000000
   0003: 0000020b 00000008 00000000 40000000 ffffd7f0 fffffffb 00007fff 00000000
   0004: ffffdffe ffffffff dffeffff 00000000 00030000 00000000 00000000 00000000
   001e: 00000000 00000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff
   0020: 7fb80000 560d0047 00000010 80000000 00000000 00001898 00000000 00000000
   0021: 00480020 00004044 78000000 00000000 00000000 00000000 00000000 00000000
   0022: 46268044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
   0025: 00000000 00000000 00000000 00000000 00000000 00000c02 00008400 00000040
   00f0: 00001ff6 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
   lang: aa|af|av|ay|be|bg|bi|bin|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|
   fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|ki|kl|kum|la|lb|
   lez|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|
   sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|
   wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|
   pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
   fontversion: 65536(i)(s)
   fontformat: "TrueType"(w)
   embeddedbitmap: True(s)
   decorative: False(s)
   lcdfilter: 1(i)(w)
   namelang: "en"(s)
   prgname: "fc-match"(s)
   postscriptname: "Verdana"(w)
   color: False(w)
   symbol: False(s)


I do see slight differences between the two (not sure what "(s)" and "(w)" mean), but I'm not sure that's enough to make the difference. Just for the heck of it, I copied Ubuntu's "verdana.ttf" file, but the result was same.
__
sol

[Moderator edit: broke long whitespace-free lines in code tags to fix thread layout. -Hu]
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 623
Location: San Diego, CA

PostPosted: Fri Sep 08, 2017 7:24 pm    Post subject: Reply with quote

Finally figured out.
Code:
[/etc/portage/package.use]

media-libs/freetype X -cleartype_hinting    <--


Turning off "cleartype_hinting" USE flag was the magic ingredient. While I was at it, I left out everything except "antialias".

Code:
[~/.config/fontconfig/fonts.conf]

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="font">
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>
</fontconfig>


Here is the final result.
https://ibin.co/3ZiCviScCRaP.png

Thanks again everyone for taking time to share your suggestions.
__
sol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum