Bug 202728

Summary: x11/xorg: Global X11 fonts rendering problem CJK/Webfont etc.
Product: Ports & Packages Reporter: sasamotikomi
Component: Individual Port(s)Assignee: freebsd-x11 (Nobody) <x11>
Status: Closed Feedback Timeout    
Severity: Affects Many People CC: office, w.schwarzenfeld, zeising
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description sasamotikomi 2015-08-28 19:15:23 UTC
Many fonts are rendering wrong or very bad especially CJK and webfont(MS)
For example rendering of Japanese:
VNDB page of port narcissu (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195800) :
https://vndb.org/v10
Katakana rendered only half, part of characters is "transparent/invisible"
Howto fix it:
bring your local.conf to this kind of
$ vi(or ee) /usr/local/etc/fonts/local.conf

<?xml version="1.0"?>
      <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 <fontconfig>
        <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="pattern">
           <test qual="any" name="size" compare="less_eq">
              <int>12</int>
          </test>
           <edit name="antialias" mode="assign">
                <bool>false</bool>
           </edit>
        </match>
</fontconfig>


Not forget add this if you use lcd:
  <match target="font">
    <edit mode="assign" name="lcddefault">
      <const>lcddefault</const>
    </edit>
  </match>
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
  </match>
Rebuild the font caches and restart Firefox or better xorg-server
$ fc-cache -f
Now fonts is readable but turned into "rainbow" to fix it:
bring your fonts.conf to same kind of local.conf
$vi(or ee) /home/youruser/.config/fontconfig/fonts.conf
$ fc-cache -f
If it still happen replace webfont with analog from ChromeOS:
https://freshports.org/x11-fonts/croscorefonts-fonts-ttf/
https://freshports.org/x11-fonts/crosextrafonts-carlito-ttf/
https://freshports.org/x11-fonts/crosextrafonts-caladea-ttf/

add to your local.conf:
  <alias>
    <family>serif</family>
    <prefer><family>Tinos</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Arimo</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Arimo</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Cousine</family></prefer>
  </alias>
  
  <match>
    <test name="family"><string>Arial</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Helvetica</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Verdana</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Tahoma</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times New Roman</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
    <match>
    <test name="family"><string>Consolas</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Courier New</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Calibri</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Carlito</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Cambria</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Caladea</string>
    </edit>
  </match>
$ fc-cache -f
For programs who not support it:
/home/yourname/.Xresources

Xft.autohint: 0
Xft.lcdfilter:  lcddefault #optional LCD
Xft.hintstyle:  hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb #optional LCD
Xft.dpi: 170 #optional use your real dpi


Problem with Chinese is Hanzi rendering only halfsize and many application such Firefox not make any differences between Chine and Japanese. I don't know how fix it.
Cyrillic have troubles with gaps size between characters.
Fonts rendering are differences between application.
Comment 1 Walter Schwarzenfeld freebsd_triage 2018-01-12 22:09:30 UTC
Is this still relevant?
No feedback from Maintainer till now!
Comment 2 Niclas Zeising freebsd_committer freebsd_triage 2018-05-20 15:23:14 UTC
Feedback timeout