You are not logged in.

#1 2012-09-11 07:35:14

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

[Solved] Weird font colors - subpixel problem

I'm having a problem that's similar to a problem expressed on the fedora forums; note that I only skimmed through the fedora post.  Here's a zoomed in sample of the problem that I am having with my fonts.  They have all of these weird colors in 'em, and I'm not sure how to get rid of them. 

index.php?mode=image&id=227980

I tried installing sharpfonts from the archfonts repo, but that only made all of my fonts look completely different, and only solved the problem for most and not all of my fonts.

Last edited by lspci (2013-01-03 02:10:28)


Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#2 2012-09-11 07:38:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] Weird font colors - subpixel problem


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2012-09-13 16:10:53

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: [Solved] Weird font colors - subpixel problem

Okay, I did the subpixel rendering thing, but it didn't help.  I think I know why, though.  I keep on getting this error, and since the changes that I made affected the local.conf file, it must not be loading properly, or else my changes would have worked. 

Fontconfig error: "local.conf", line 11: junk after document element

Okay, so part of the problem was probably that my dpi wasn't set right, I went to the dpi calculator and found out that I need the following DPI

DPI: 100.45
Dot Pitch: 0.2529mm
Size: 13.6" × 7.65" (34.54cm × 19.42cm)
Aspect Ratio: 683 × 384 (1.78:1)
Pixel Count: 1,049,088 
Megapixels: 1.05MP

So I went ahead and added xrandr --dpi 100.45 & to my .xinitrc, but the font thing is still a problem.... not sure what led me to do the DPI test... oh, yeah it was so that I could take that LCDfilter test thing accurately. 

# 
# ~/.xinitrc 
# 

xrandr --dpi 100.45 &

Okay, so I fixed the fontconfig error, but the weird colors are still present.  The problem with fontconfig stopped after I installed the following packages.

freetype2-cleartype libxft-cleartype cairo-cleartype

Here's my local.conf

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

  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>

  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </edit>

</match>
<match target="pattern">

  <edit mode="assign" name="dpi">
   <double>100.45</double>
  </edit>

</match>

</fontconfig>

But the color problems are still present, though they have greatly improved--and Courier new still doesn't look anything like Courier New should look.

New courier looks much better now, after changing the lcdfilter back to lcddefault but I'm still not sure if everything look just right or not.

--------------------------

Grepping 'dpi' from xrdb still doesn't work, though. 

xdpyinfo | grep "dots"
  resolution:    101x101 dots per inch

I still get the following when I got to the sub-pixel test thing and click on the native resolution link. 
index.php?mode=image&id=228326

Last edited by lspci (2012-09-13 19:01:00)


Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#4 2012-09-13 22:04:32

johni
Member
Registered: 2012-02-03
Posts: 102

Re: [Solved] Weird font colors - subpixel problem

Maybe the subpixel color order is wrong.   I think most monitor's are RGB, but perhaps yours needs BGR.   Try looking in /etc/fonts/conf.avail/10-subpixel-bgr.conf,  10-subpixel-rgb.conf, 10-sub-pixel-vbgr.conf, and 10-sub-pixel-vrgb.conf to see the various ways of setting it.   I know I get a similar effect if I have this setting wrong.

Offline

#5 2012-09-14 19:05:10

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: [Solved] Weird font colors - subpixel problem

johni wrote:

Maybe the subpixel color order is wrong.   I think most monitor's are RGB, but perhaps yours needs BGR.   Try looking in /etc/fonts/conf.avail/10-subpixel-bgr.conf,  10-subpixel-rgb.conf, 10-sub-pixel-vbgr.conf, and 10-sub-pixel-vrgb.conf to see the various ways of setting it.   I know I get a similar effect if I have this setting wrong.


I checked those files
here they are:

$ cat 10-sub-pixel-bgr.conf 
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--  Enable sub-pixel rendering --> 
  <match target="font">
    <!--
      This configuration is available on the major desktop environments.
      We shouldn't overwrite it with "assign" unconditionally.
      Most clients may picks up the first value only. so using "append"
      may simply works to avoid it.
    -->
    <edit name="rgba" mode="append"><const>bgr</const></edit>
  </match>
</fontconfig>
$ cat 10-sub-pixel-rgb.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--  Enable sub-pixel rendering --> 
  <match target="font">
    <!--
      This configuration is available on the major desktop environments.
      We shouldn't overwrite it with "assign" unconditionally.
      Most clients may picks up the first value only. so using "append"
      may simply works to avoid it.
    -->
    <edit name="rgba" mode="append"><const>rgb</const></edit>
  </match>
</fontconfig>
$ cat 10-sub-pixel-vbgr.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--  Enable sub-pixel rendering --> 
  <match target="font">
    <!--
      This configuration is available on the major desktop environments.
      We shouldn't overwrite it with "assign" unconditionally.
      Most clients may picks up the first value only. so using "append"
      may simply works to avoid it.
    -->
    <edit name="rgba" mode="append"><const>vbgr</const></edit>
  </match>
</fontconfig>
$ cat 10-sub-pixel-vrgb.conf     
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--  Enable sub-pixel rendering --> 
  <match target="font">
    <!--
      This configuration is available on the major desktop environments.
      We shouldn't overwrite it with "assign" unconditionally.
      Most clients may picks up the first value only. so using "append"
      may simply works to avoid it.
    -->
    <edit name="rgba" mode="append"><const>vrgb</const></edit>
  </match>
</fontconfig>

What should I be looking for?  I noticed that these config files use

mode="append"

instead of

mode="assign"

Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#6 2012-09-14 20:06:21

johni
Member
Registered: 2012-02-03
Posts: 102

Re: [Solved] Weird font colors - subpixel problem

I think what you can try is to symlink one of those files into /etc/fonts/conf.d, and see if your fonts look better afterward.


To set to try BGR,

ln -s /etc/fonts/conf.avail/10-sub-pixel-bgr.conf /etc/fonts/conf.d


Also, it may be your desktop environment will let you set this instead of symlinking.  I know KDE lets you select subpixel order, as well as xfce4.   Probably gnome as well, but I havn't run gnome in a long time.

Offline

#7 2012-09-15 02:10:50

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Weird font colors - subpixel problem

DPI is 2 values, not 1. And I've never heard of fractions being used in this setting.

Offline

#8 2012-09-15 09:22:55

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: [Solved] Weird font colors - subpixel problem

brebs wrote:

DPI is 2 values, not 1. And I've never heard of fractions being used in this setting.

I know, but 100.45 is what the website spat back at me, so go figure.

If you have another DPI test thingy that I could go to and take, then by oh means, please tell me what it is.

So what are you saying exactly?  (I visited the link and read the posts.)

Last edited by lspci (2012-09-15 09:27:00)


Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#9 2012-09-15 09:45:38

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Weird font colors - subpixel problem

Read the thread linked in my sig.

Offline

#10 2012-09-21 18:31:53

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: [Solved] Weird font colors - subpixel problem

brebs wrote:

Read the thread linked in my sig.

Uh... okay, but I can barely make heads or tails of it.  Like, what does it actually change/do?  Or where could I read about what it does? 

<!-- Greyscale for small fonts -->
   <match target="font">
      <test name="pixelsize" compare="less_eq"><double>7</double></test>
      <edit name="rgba"><const>none</const></edit>
   </match>

I visited another site recently that's supposed to be able to calculate DPI and here's what it spat out. 

Display size: 13.6" × 7.65" (34.54cm × 19.42cm) = 100.45 PPI, 0.2529mm dot pitch, 10091 PPI²

Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#11 2012-09-21 18:47:17

Foxandxss
Member
Registered: 2008-11-23
Posts: 16

Re: [Solved] Weird font colors - subpixel problem

I had that problem, I fixed it and created a fonts.conf (for my user), I recommend you to try my all file and if it works, change what you want.

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

You have to put it on ~/.config/fontconfig/fonts.conf (with the last fontconfig package).

Hope it works for you.

Offline

#12 2012-09-21 19:09:49

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Weird font colors - subpixel problem

lspci wrote:

Like, what does it actually change/do?  Or where could I read about what it does? 

<!-- Greyscale for small fonts -->
   <match target="font">
      <test name="pixelsize" compare="less_eq"><double>7</double></test>
      <edit name="rgba"><const>none</const></edit>
   </match>

For very small font sizes, it turns the sub-pixel rendering ("red green blue") off. Because there's so few pixels to work with, that sub-pixel rendering at that sort of scale looks *worse*.

lspci wrote:

I visited another site recently that's supposed to be able to calculate DPI and here's what it spat out.

It's a simple calculation:

1366/13.6 = 100.4 roughly
768/7.65 = 100.4 roughly

So your horizontal and vertical DPI are the same - convenient, I suppose.

Offline

#13 2013-01-03 02:14:06

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: [Solved] Weird font colors - subpixel problem

The following file fixed the problem, but since I can't remember whether this problem originated on my old laptop or this one... this may or may not actually be a true fix, but it does solve the problem on my new one. 

Just create your /etc/fonts/local.conf and add the below to it! 


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

  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>

  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </edit>

</match>
<match target="pattern">

  <edit mode="assign" name="dpi">
   <double>100.45</double>
  </edit>

</match>

</fontconfig>

Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

Board footer

Powered by FluxBB