HOWTO: Improve Debian Font Rendering/Like Ubuntu

Post your tutorials and howtos here.
User avatar
vtpoet
Posts: 250
Joined: 26 Nov 2013 14:32

HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby vtpoet » 20 Feb 2014 16:01

I personally find Debian's Font rendering, in Libre, Browsers, Applications, (all of it) to be problematic and hard to read. If you're coming from Ubuntu and don't notice a difference, skip this. If you do, then the following should help. In both cases, in my opinion, the key to improving font rendering is LCD Hinting.

SOLYDX

So, if you're using SolydX, you can try the following method which comes from here:

http://docs.xfce.org/xfce/xfce4-settings/appearance

The relevant portion is the following:
Rendering

Enable anti-aliasing

Select this option to anti-alias fonts, so that characters have smooth edges.

Hinting

Hinting is a font-rendering technique that improves the quality of fonts at small sizes and an at low screen resolutions. Select one of the options to specify how to apply hinting your fonts.

Sub-pixel order

Select one of the options to specify the subpixel color order for your fonts. Use this option for LCD or flat-screen displays.

LCD Hinting

On some systems LCD hinting results in better fonts. But because this is not working on all system, this setting is not configurable through the interface. You can set it with a simple query.

Code: Select all

xfconf-query -c xsettings -p /Xft/Lcdfilter -n -t string -s lcddefault
Other possible values are lcdnone, lcddefault, lcdlight and lcdlegacy. You can check if the property is set property, run xrdb -query in a terminal. To fully apply the LCD hinting, it is advised to logout and in again (for restarting the X server).
What has always worked for me is to issue the following command:

Code: Select all

xfconf-query -c xsettings -p /Xft/Lcdfilter -n -t string -s lcddefault

On my own HP Pavilion Laptop, I use the following settings:

Enable anti-aliasing
Hinting: Slight
Sub-pixel order: RGB
DPI 112

This beautifully reproduces Ubuntu's font rendering.

SOLYDK

Note: The following may also work in SolydX but I haven't tested. I think it's simpler to use the method above for SolydX.

It's not as easy to adjust LCD Hinting in KDE (which is an oversight in my opinion) but the following should obtain the same results (as they also adjust LCD Hinting). The following comes from here:

http://ubuntuforums.org/showthread.php?t=2145211&page=2

The important part is this (quote from the linked post):
In the previous posts I said to install the ubuntu packages in debian to get the same rendering, but it's incorrect. From Wheezy, the font rendering packages are the same as Ubuntu, no more custom patches except that Ubuntu changes the fontconfig configuration to enable certain option by default (where Debian instead use the upstream bare configuration).
1.)

To enable the same Ubuntu font aspect, first install the Ubuntu font with the official package.

http://archive.ubuntu.com/ubuntu/pool/m ... u6_all.deb

Note: The font is available in SolydXK's repositories and may be installed with the following:

Code: Select all

sudo apt-get install ttf-ubuntu-font-family
2.)

Then create the system default configuration with:

Code: Select all

sudo nano /etc/fonts/local.conf
3.)

Then paste the following into the configuration file:

Code: Select all

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">

<!-- Font rasterization converts vector font data to bitmap data so that it
     can be displayed. The result can appear jagged due to aliasing.
     Anti-aliasing increases the apparent resolution of font edges. -->
        <edit mode="append" name="antialias">
            <bool>true</bool>
        </edit>

<!-- Using normal hinting, TrueType hinting instructions in the font are
     interpreted by freetype's Byte-Code Interpreter. This works best for
     fonts with good hinting instructions. -->
        <edit mode="append" name="hinting">
            <bool>true</bool>
        </edit>

<!-- Auto-discovery for hinting. This looks worse than normal hinting for
     fonts with good instructions, but better for those with poor or no
     instructions. The autohinter and subpixel rendering are not designed
     to work together and should not be used in combination. -->
        <edit mode="append" name="autohint">
            <bool>false</bool>
        </edit>

<!-- Hint style is the amount of influence the hinting mode has. Hinting
     can be set to: "hintfull", "hintmedium", "hintslight" and "hintnone".
     With BCI hinting, "hintfull" should work best for most fonts.
     With the autohinter, "hintslight" is recommended. -->
        <edit mode="append" name="hintstyle">
            <const>hintslight</const>
        </edit>

<!-- Subpixel rendering effectively triples the horizontal (or vertical)
     resolution for fonts by making use of subpixels. The autohinter and
     subpixel rendering are not designed to work together and should not
     be used in combination. Most monitors manufactured today use the
     Red, Green, Blue (RGB) specification. Fontconfig will need to know
     your monitor type to be able to display your fonts correctly.
     Values are "rgb" (most common), "bgr", "vrgb" (vertical), "vbgr",
     "unknown" or "none". -->
        <edit mode="append" name="rgba">
            <const>rgb</const>
        </edit>

<!-- When using subpixel rendering, you should enable the LCD filter,
     which is designed to reduce colour fringing. The "lcddefault" filter
     will work for most users. Other filters are available that can be
     used in special situations: "lcdlight"; a lighter filter ideal for
     fonts that look too bold or fuzzy; "lcdlegacy", the original Cairo
     filter; "lcdnone" to disable it entirely. -->
        <edit mode="append" name="lcdfilter">
            <const>lcddefault</const>
        </edit>

<!-- Fontconfig should be able to detect DPI parameters as discovered
     by the Xorg server. You can check Xorg's automatically discovered
     DPI with the command 'xdpyinfo | grep resolution'
     Uncomment the following to activate customized DPI -->
<!--
        <edit mode="append" name="dpi">
            <double>96</double>
        </edit>
-->

<!-- Some scalable fonts have embedded bitmap versions which are rendered
     instead, mainly at smaller sizes. Force using scalable fonts at all
     sizes by disabling embedded bitmap. -->
        <edit mode="append" name="embeddedbitmap">
            <bool>false</bool>
        </edit>

    </match>

<!-- Use font substitution to set your preferred fonts the default
     serif, sans-serif and monospace fonts. You can also substitute
     a specific font not installed on the system (e.g. Arial) with
     an installed one (e.g. FreeSans) by adding other aliases like
     these. This only works if the original font is not on the system. -->
    <alias>
        <family>serif</family>
        <prefer><family>DejaVu Serif</family></prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer><family>Ubuntu</family></prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer><family>Ubuntu Mono</family></prefer>
    </alias>
<!--
    <alias>
        <family>Arial</family>
        <prefer><family>FreeSans</family></prefer>
    </alias>
-->

<!-- Reject bitmap fonts in favour of Truetype, Postscript, etc. -->
    <selectfont><rejectfont><pattern>
        <patelt name="scalable"><bool>false</bool></patelt>
    </pattern></rejectfont></selectfont>

<!-- Patch to fix Ubuntu font family behavior. 'Medium'
     variant is used instead of 'Regular' on Qt apps. -->
    <match target="scan">
    <test name="family" compare="eq" ignore-blanks="true">
        <string>Ubuntu</string>
    </test>
    <test name="style">
        <string>Medium</string>
    </test>
    <edit name="weight">
        <const>demibold</const>
    </edit>
    </match>
    <match target="scan">
    <test name="family" compare="eq" ignore-blanks="true">
        <string>Ubuntu</string>
    </test>
    <test name="style">
        <string>Medium Italic</string>
    </test>
    <edit name="weight">
        <const>demibold</const>
    </edit>
    </match>

</fontconfig>
4.)

Exit, saving the file, and reboot (or logout/login). The comments in the config file could help you changing settings. Maybe you should also change the font appearance options of you desktop environment (Xfce, KDE, etc.) to match the config file settings.
Linux Reap what you tweak.

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby zerozero » 21 Feb 2014 00:20

interesting :)
just a FWIW:
the ubuntu fonts are available in the SolydXK repos

Code: Select all

zerozero@home ~ $ apt policy ttf-ubuntu-font-family
ttf-ubuntu-font-family:
  Installed: 0.80-0ubuntu5
  Candidate: 0.80-0ubuntu5
  Version table:
 *** 0.80-0ubuntu5 0
        500 http://packages.solydxk.com/testing/ solydxk/import amd64 Packages
        100 /var/lib/dpkg/status
bliss of ignorance

User avatar
patzy
Posts: 410
Joined: 15 Dec 2013 08:32
Location: Australia

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby patzy » 21 Feb 2014 01:35

Thanks for this vypoet and zerozero.

I've found the default debian fonts hard to read and want to try the ubuntu ones...So, have I got this right?

I install ttf-ubuntu-font-family from the SolydK repos.

Then I do steps 2, 3 and 4 from vtpoet's post. Reboot and have the ubuntu fonts up and running as default.

User avatar
vtpoet
Posts: 250
Joined: 26 Nov 2013 14:32

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby vtpoet » 21 Feb 2014 01:46

Yes. You can install them from the SolydXK repos. After you've followed the other steps, just remember that tweaking the size of the fonts - in KDE System Settings --> Application Appearance --> Fonts may also be helpful. Also experiment with anti-aliasing settings and DPI (toward the bottom of the window). On my current laptop, 96 dpi works well. On my other laptop, 1080p, I set the dpi to 106 (my eyes are aging). On both systems, I use RGB and a "Hinting Style" of Slight.
Linux Reap what you tweak.

User avatar
patzy
Posts: 410
Joined: 15 Dec 2013 08:32
Location: Australia

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby patzy » 21 Feb 2014 01:59

Thanks, vtpoet, for the config tips.

I'll be setting the fonts up later today.

Later: All done and working well! :D

User avatar
dbVU
Posts: 51
Joined: 05 Mar 2013 12:37
Location: Massachusetts

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby dbVU » 21 Feb 2014 12:11

Hi,
If you like using a GUI ,try "Settings" "Appearence" then the Fonts tab, you will be able to select and tweak your font from that panel. Very nice suggestions!

db

User avatar
vtpoet
Posts: 250
Joined: 26 Nov 2013 14:32

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby vtpoet » 21 Feb 2014 13:31

dbVU wrote:Hi,
If you like using a GUI ,try "Settings" "Appearence" then the Fonts tab, you will be able to select and tweak your font from that panel. Very nice suggestions!

db
The problem, as the XFCE FAQ says above, is that there isn't (deliberately on the part of XFCE devs) a GUI to adjust LCD Hinting and, as far as I know, the same is true of KDE.
Linux Reap what you tweak.

onceupon
Posts: 8
Joined: 02 Mar 2014 01:34

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby onceupon » 02 Mar 2014 03:16

THANK YOU vtpoet !!!!!!!

I have installed/reinstalled SolydX & SolydK many more than one time because I want it to work for me, only to unistall it due to font rendering on my low resolution display (all that I have) on my laptop (15.6" with only 1368x768).

I was SO HAPPY that I came back just one more time and installed KDE version!!!!!!!

This modification WORKS!!!!!!! :D

t0psy
Posts: 39
Joined: 21 Mar 2014 16:01

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby t0psy » 09 Jul 2014 13:51

Thanks vtpoet, Chromium fonts now superb.

Monti
Posts: 25
Joined: 28 Feb 2015 02:02

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby Monti » 07 Mar 2015 12:09

To undo I deleted the local.conf.save file and the content of local.conf. After log off/in things worked just fine.

User avatar
wisemagic
Posts: 303
Joined: 13 May 2013 03:05
Location: New Iberia, Louisiana USA

Re: HOWTO: Improve Debian Font Rendering/Like Ubuntu

Postby wisemagic » 14 Mar 2015 14:18

I have found running these 2 commands to be helpful

sudo dpkg-reconfigure fontconfig-config

sudo dpkg-reconfigure fontconfig
E5-2690 Xeon - 16GB PC12800 DDR3 1600 Quad Channel -
Chinese HUANAN MB - GeForce GTX 960 4GB PCI Express 16X HDMI
Dual 480.0 GB SSD Corsair - Corsair H60 Liquid CPU Cooler - Blu-ray / DVD LightScribe Recorder
Debian Sid - Kernel 4.17.2-zen


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 3 guests