Comment # 45 on bug 904015 from
Let's try step by step on 42.2 leap system. I do not have access to Tahoma
font, I will try Arial which is downloaded by fetchmsttfonts instead.

(1) Let us first look at the font, if it meet the requirments as displayed with
freetype2:

$ ftview 10 /usr/share/fonts/truetype/arial.ttf

then hit 'a' to turn off antialiasing and Up/Down to change size. Does the font
fulfill your expectation for small sizes as rendered by freetype2?


(2) Then, we need to ensure fontconfig gives correct rendering algorithm
parameters.

Before I do any configuration, I get:

$ fc-match -v 'Arial:size=10' | grep 'alias\|hint'
    antialias: True(w)
    hintstyle: 3(i)(w)
    hinting: True(w)
    autohint: False(w)
    force_hintstyle: "none"(w)
    force_autohint: False(w)
    search_metric_aliases: True(w)
$

Three last can be ignored, they just imply real rendering options. For size=10
we get full hinting (hintstyle=3, which is, iirc the only option anyway for
BCI), rendering with BCI when the freetype library decides it has usable
rendering instructions (autohint=false, it actually means 'do not force
autohint') and antialias on.

$ fc-match -v 'Arial:size=5' | grep 'alias\|hint\|size'
Pattern has 44 elts (size 48)
    size: 5(f)(s)
    pixelsize: 5.20833(f)(s)
    antialias: True(w)
    hintstyle: 3(i)(w)
    hinting: True(w)
    autohint: False(w)
[..]
$

Lovering the size, fontconfig does not change rendering options, as expected.
Now edit ~/.config/fontconfig/fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Arial</family>
    </prefer>
  </alias>
  <match target="font">
    <test name="font_type">
      <string>TT Instructed Font</string>
    </test>
    <test name="pixelsize" compare="less_eq">
      <double>8.0</double>
    </test>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
    <!-- force autohint should be disabled already -->
    <edit name="autohint">
       <bool>false</bool>
    </edit>
  </match>
</fontconfig>

<alias> is there to make sure Arial is preferred for given user.  font_type='TT
Instructed Font' is set for all fonts listed in
/etc/fonts/conf.d/10-group-tt-hinted-fonts.conf, including Tahoma and Arial.

Now:

$ fc-match -v Arial:size=10 | grep 'hint\|alias\|size'
Pattern has 44 elts (size 48)
    size: 10(f)(s)
    pixelsize: 10.4167(f)(s)
    antialias: True(w)
    hintstyle: 3(i)(w)
    hinting: True(w)
    autohint: False(w)
[..]
$

$ fc-match -v Arial:size=5 | grep 'hint\|alias\|size'
Pattern has 44 elts (size 48)
    size: 5(f)(s)
    pixelsize: 5.20833(f)(s)
    antialias: False(w)
    hintstyle: 3(i)(w)
    hinting: True(w)
    autohint: False(w)
[..]
$

Antialias is off for the Arial:size=5. hinting need to be true in both cases.
autohint is False to allow freetype2 to use font's instructions if there are
any; again in both cases.

NOTE: you see above the pixelsize is slightly above the requested size. If you
want to request size=8, rather use 9.0 inside the fontconfig rule above.

Webpage similar to following one should confirm it works:

<html>
  <body>
     <span style="font-family: Arial; font-size: 5px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 6px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 7px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 8px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 9px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 10px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 11px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 12px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 13px">Pack my box with five
dozen liquor jugs.</span><br/>
     <span style="font-family: Arial; font-size: 14px">Pack my box with five
dozen liquor jugs.</span><br/>
  </body>
</html>

The jump between non-antialiased and antialiased font is evident or can be
proved by xmag utility.

Now the system should use this settings. Well. It depends how given application
honor fontconfig recommendation how to render a font, of course.

You should try another applications, kde, non-kde, etc. If that does not work
only for kde applications, for example, then it might be there is some clash
between kde and base system fontconfig settings or its interpretion. 

I needed to increase pixelsize to 14.0 in the fontconfig rule though as 8.0 is
simply too low. Arial and even Liberation families are rendered black&white for
me on fx. firefox, icewm and pidgin as expected.


You are receiving this mail because: