• [i3] How to setup dpi and font hinting?


    I have an Antergos/Xfce installation, from which I installed i3 and that I launch through lightdm.

    Everything is going fine with setting up i3 on Antergos, except that I am not happy with the dpi and font hinting settings. How can I change these on i3? I wish to preserve my dual-DE setup.

  • i have this inside my ~/.config/fontconfig/fonts.conf

    <?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>
     </fontconfig>
    

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • I thought it could be a syntax error on my part, but from your file it seems mine is correct too:

    $ cat .config/fontconfig/fonts.conf
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
        <match target="font">
            <edit name="antialias" mode="assign">
                <bool>true</bool>
            </edit>
            <edit name="hinting" mode="assign">
                <bool>true</bool>
            </edit>
            <edit name="hintstyle" mode="assign">
                <const>hintslight</const>
            </edit>
            <edit name="rgba" mode="assign">
                <const>rgb</const>
            </edit>
            <edit name="autohint" mode="assign">
                <bool>false</bool>
            </edit>
            <edit name="lcdfilter" mode="assign">
                <const>lcddefault</const>
            </edit>
            <edit name="dpi" mode="assign">
                <double>96</double>
            </edit>
        </match>
    </fontconfig>
    

    I’ve set DPI to high values, like 120, to test, but my changes simply don;t take effect. Its like fonts.conf is being ignored. Could it be lightdm?

  • Ok, found what the problem was. Lightdm was not starting with 96 dpi. Also the settings in fonts.conf are simply ignored.

    To solve this, had to create the ~/.xinitrc and ~/Xresources files:

    #~/.xinitrc 
    [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
    
    #~/.Xresources 
    Xft.dpi: 96
    Xft.antialias: 1
    Xft.hinting: 1
    Xft.autohint: 0
    Xft.rgba: rgb
    Xft.hintstyle: hintslight
    Xft.lcdfilter: lcddefault
    

    With this, and after restarting the lightdm service, i3 was finally set to 96 dpi and font antialias and hinting is now working as expected.

    I am not sure how lightdm manages these resources, since it works fine for DEs like Xfce. I know nothing of how display managers work. But I won’t be learning this time either. My plan is to remove it (along with Xfce) once i3 is fully set on my machine and I am comfortable enough to leave behind 2 decades of point-and-click DEs.

    Anyways, all good now. Cheers and thanks.

  • as i am using gnome-DE with i3-wm it is reading font config from gnome ;)

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • https://www.reddit.com/r/i3wm/comments/41mvug/how_to_improve_font_rendering_in_i3/

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

font17 [i3]1 dpi4 hinting1 Posts 6Views 163
Log in to reply