# HOWTO: Nice fonts



## mart (Feb 5, 2009)

I run a light desktop, currently openbox, and prefer to set things up through config files rather than relying on settings managers.

In the case of fonts, this allows _much_ more refined control, consistent across all apps, system wide.  It's possible to control settings per font family, per weighting, per point size, to remap fonts, to supply preferences/fallbacks for unavailable fonts etc.

'Nice fonts' is of course subjective, and can depend on monitor type, geometry, dpi, antialiasing/hinting preferences etc, but here's my ~/.fonts.conf to use as a starting point.  Copy it to your home directory, rebuild freetype2 if you need to, install the relevant fonts, run fc-cache, reboot/restart X and tweak from there...


```
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

    <!--
        install ==> print/freetype2 [WITH_LCD_FILTERING=yes and assumes BCI not disabled]
        install ==> x11-fonts/dejavu
        install ==> x11-fonts/webfonts
        install ==> x11-fonts/terminus-font
    -->

    <!-- reject all bitmap fonts, with the exception of 'terminus' -->
    <selectfont>
        <acceptfont>
            <pattern>
                <patelt name="family"> <string>Terminus</string> </patelt>
            </pattern>
        </acceptfont>
        <rejectfont>
            <pattern>
                <patelt name="scalable"> <bool>false</bool> </patelt>
            </pattern>
        </rejectfont>
    </selectfont>

    <!-- preferred aliases -->
    <alias> <family>serif</family>
        <prefer>
            <family>DejaVu Serif</family>
        </prefer>
    </alias>

    <!-- preferred aliases -->
    <alias> <family>sans-serif</family>
        <prefer>
            <family>DejaVu Sans</family>
        </prefer>
    </alias>

    <!-- preferred aliases -->
    <alias> <family>monospace</family>
        <prefer>
            <family>DejaVu Sans Mono</family>
            <family>Terminus</family>
        </prefer>
    </alias>

    <!-- default quality settings -->
    <match target="font">
        <edit mode="assign" name="rgba">      <const>none</const>     </edit>
        <edit mode="assign" name="antialias"> <bool>true</bool>       </edit>
        <edit mode="assign" name="autohint">  <bool>true</bool>       </edit>
        <edit mode="assign" name="hinting">   <bool>true</bool>       </edit>
        <edit mode="assign" name="hintstyle"> <const>hintfull</const> </edit>
    </match>

    <!-- reduce ringing ==> requires freetype2 'WITH_LCD_FILTERING=yes' -->
    <match target="font">
        <edit mode="assign" name="lcdfilter"> <const>lcdlight</const> </edit>
    </match>

    <!-- disable autohinting for bold fonts -->
    <match target="font">
        <test compare="more" name="weight">   <const>medium</const> </test>
        <edit mode="assign"  name="autohint"> <bool>false</bool>    </edit>
    </match>

    <!-- disable autohinting for fonts that don't need it -->
    <match target="pattern" name="family">
        <test qual="any" name="family">
          <string>Andale Mono</string>
          <string>Arial</string>
          <string>Arial Black</string>
          <string>Comic Sans MS</string>
          <string>Courier New</string>
          <string>Georgia</string>
          <string>Impact</string>
          <string>Trebuchet MS</string>
          <string>Tahoma</string>
          <string>Times New Roman</string>
          <string>Verdana</string>
          <string>Webdings</string>
       </test>
       <edit mode="assign" name="hinting">  <bool>true</bool>  </edit>
       <edit mode="assign" name="autohint"> <bool>false</bool> </edit>
    </match>

</fontconfig>
```

Make sure your '.gtkrc-2.0' is including your personal '.gtkrc.mine'...

```
include "/home/mart/.gtkrc.mine"
```

And that your '.gtkrc.mine' contains font settings...

```
style "user-font"
{
    font_name = "Sans 9"
}
widget_class "*" style "user-font"

gtk-font-name = "Sans 9"
```

Finally, make sure firefox font preferences are set to defaults (ie. serif/sans-serif/monospace - no named fonts as fonts.conf takes care of all that properly).

Remember I'm not using a settings manager.  If you are (check with ps aux) then make sure your manual settings aren't being overridden.

With these settings I have a _very_ clean looking desktop, with crisp fonts that look good in all apps, and on all websites I visit, and gives me my beloved terminus for terminals 

I'd be interested in seeing what others have in addition to these settings...


----------



## kamikaze (Feb 5, 2009)

You know that all that xml-mangling is no longer necessary?

You just have to go to /usr/local/etc/fonts/conf.d and link to all the features you want in /usr/local/etc/fonts/conf.avail.


----------



## mart (Feb 5, 2009)

kamikaze said:
			
		

> You know that all that xml-mangling is no longer necessary?
> 
> You just have to go to /usr/local/etc/fonts/conf.d and link to all the features you want in /usr/local/etc/fonts/conf.avail.



Yup, and I've done that in the past, but I ended up going back to this way.  I distro swapped quite a lot in the past (work/home-desktop/home-development/laptop), and was always annoyed by config differences between them, particularly when one suddenly decides to change their 'default' *cough* fedora *cough*.  Doing things this way means I can quickly sync / move over my full environment, even across OSs (I still run Arch on my laptop and core dev machine).

Still, each to their own   If you're happy with the default granularity provided, and don't think you'll ever need to transport an environment, then linking files is certainly easier (as is using a gui / settings manager).


----------



## zeiz (Feb 6, 2009)

mart said:
			
		

> Make sure your '.gtkrc-2.0' is including your personal '.gtkrc.mine'...
> 
> ```
> include "/home/mart/.gtkrc.mine"
> ...


I'd like to try but where is gtkrc-2.0?


----------



## kamikaze (Feb 7, 2009)

If it's not there you have to create it in your home directory. And it is .gtkrc-2.0. Do not forget about the *.*.


----------



## oliver@ (Feb 24, 2009)

Hi,

I had to remove the "quality settings" part otherwise the fonts are getting kinda bold here and much more grainy.

I also lost the ability to continue using bitmap fonts like Lucida Typewriter (ok this is how it is now configured in .fonts.conf). But I definitively want my Lucida Typewriter font back 
I saw, that there are Lucida TTF fonts shipped togther with jdk 1.6 so I tried using them by adding 

FontPath   "/usr/local/jdk1.6.0/jre/lib/fonts/"

to my xorg.conf without success
I also tried fc-cache -v -f /usr/local/lib/X11/fonts /usr/local/jdk1.6.0/jre/lib/fonts which prints out:

[...]
/usr/local/jdk1.6.0/jre/lib/fonts: caching, new cache contents: 8 fonts, 0 dirs
[...]

I also tried to generate a fonts.scale using ttmkfdir but all that gave me no Lucida Typewriter font back... Any idea how I get this font back?


----------



## mart (Feb 25, 2009)

oliver@ said:
			
		

> I had to remove the "quality settings" part otherwise the fonts are getting kinda bold here and much more grainy.



Sounds like you prefer sharper (ms-style) fonts, without much antialiasing.  Nothing wrong with that.  However, once things are working a bit better for you, you might want to play around with the quality settings rather than disabling them completely.  Some combinations work better for certain dpi, monitor types etc.

[ BTW:  if you prefer sharp (ms-style) fonts, then you might find this interesting.  I tend to have my settings somewhere in-between as I swap machines/monitors quite a lot ]



			
				oliver@ said:
			
		

> I also lost the ability to continue using bitmap fonts like Lucida Typewriter (ok this is how it is now configured in .fonts.conf). But I definitively want my Lucida Typewriter font back



Easy enough.  The accept/reject section works like a whitelist/blacklist.  I blacklisted all bitmap fonts except Terminus, and you'd want to do the same for Lucidia (i.e. add Lucidia to the accept section, under Terminus).


----------



## oliver@ (Feb 25, 2009)

mart said:
			
		

> Sounds like you prefer sharper (ms-style) fonts, without much antialiasing.  Nothing wrong with that.  However, once things are working a bit better for you, you might want to play around with the quality settings rather than disabling them completely.  Some combinations work better for certain dpi, monitor types etc.
> 
> [ BTW:  if you prefer sharp (ms-style) fonts, then you might find this interesting.  I tend to have my settings somewhere in-between as I swap machines/monitors quite a lot ]



The fonts at sharpfonts.com should be the fonts installed by webfonts already... right?

One Question regarding the font "DejaVu Sans" - The font looks extremely ugly. I normaly have a black font. Choosing this font it gets "coloured" (probably because of anti aliasing) . I mean I see green and read portions in the font and the font is extremely thin too... Is this intended?


----------



## Djn (Feb 25, 2009)

They're the webfonts, yes - I guess the interesting part is that they also bundle some fontconfig settings files.


----------



## oliver@ (Feb 25, 2009)

Is there a way to allow Lucida* fonts? When entering "Lucida" as acceptfont I don't get the other fonts from the family. Are (and if: what) wildcards are supported?


----------



## mart (Feb 26, 2009)

oliver@ said:
			
		

> The fonts at sharpfonts.com should be the fonts installed by webfonts already... right?



Yes, webfonts has everything you need except the config(s).  I mentioned the site as it highlights the two extremes, and provides example configs to go 'sharp' if that's what you prefer.



			
				oliver@ said:
			
		

> One Question regarding the font "DejaVu Sans" - The font looks extremely ugly. I normaly have a black font. Choosing this font it gets "coloured" (probably because of anti aliasing) . I mean I see green and read portions in the font and the font is extremely thin too... Is this intended?



DejaVu is (to me) an excellent font for general use.  So much so that I use it as the exclusive preferred font for Sans and Serif (see config).  It seems others find it pleasant too (see http://www.codestyle.org/css/font-family/sampler-UnixResults.shtml).

It shouldn't be 'extremely thin'.  If it is, you probably want to use, and understand, the quality preferences a bit better (poor combination of hinting/antialias settings, among others, could lead to incorrect spacing etc).

Sadly, the css site above does not have an *image* for DejaVu, but there's one for Bitstream Vera which is very similar (see http://www.codestyle.org/servlets/FontSampler?image=unix-BitstreamVeraSansMono&class=BitstreamVeraSansMono&font=Bitstream+Vera+Sans+Mono - the Normal/Bold/Italic section is an *image* and your text should look similar, or even better).

It shouldn't be 'coloured'.  If it is, then I suspect incorrect 'rgba' settings for your monitor, and/or not having freetype2 compiled with 'WITH_LCD_FILTERING=yes' (see 'ringing' comments in original post).  Having suitable/complementary hinting settings will also help.



			
				oliver@ said:
			
		

> Is there a way to allow Lucida* fonts? When entering "Lucida" as acceptfont I don't get the other fonts from the family. Are (and if: what) wildcards are supported?



If your pattern says 'family' then it should accept 'family' (see http://fontconfig.org/fontconfig-user.html).  What other fonts from the family are missing?  What are you doing to test that they are missing?

It might help to provide info about your setup (_reported_ monitor geometry/_reported_ dpi etc), and what it is you don't like about the _default_ font settings.


----------



## artificer (Mar 1, 2009)

I find the Red Hat's "Liberation" font suite to be one of the best out there, as they've been extremely well hinted recently.

For me, they are much better than the DejaVu Fonts, give it a try if you are looking for nice fonts. Be sure to try the latest version from here:

http://fedorahosted.org/liberation-fonts


----------



## kamikaze (Mar 1, 2009)

Doesn't Freetype implement an autohinting algorithm?


----------



## calande (Apr 13, 2009)

I personally don't consider Dejavu or Bitstream font families attractive fonts. Personally, I prefer either the Liberation type face or Microsoft's. The Sharpfonts package includes Tahoma, which webcore doesn't.


----------



## dybnu (Aug 10, 2009)

I tried to use 'WITH_LCD_FILTERING=yes'to build freetype2,but still it seems the "lcdfilter" doesn't work any more


----------



## jrick (Aug 18, 2009)

hintfull? yuck. 

I'm currently using hintslight with the LCD patches. I can honestly say that these are the nicest looking fonts I have ever seen.



			
				dybnu said:
			
		

> I tried to use 'WITH_LCD_FILTERING=yes'to build freetype2,but still it seems the "lcdfilter" doesn't work any more



Yes. This is because this only enables the LCD patches in freetype, while other libraries which should use it are not also patched. Here's how I installed it (warning, very hackish):

Compile print/freetype2 with WITH_LCD_FILTERING:


```
cd /usr/ports/print/freetype2
make -DWITH_LCD_FILTERING deinstall reinstall clean
```

Now you should add the setting to fontconfig. The easiest way to do this is to download a copy of 10-lcd-filter.conf (I got mine from here) and save it to /usr/local/etc/fonts/conf.avail/10-lcd-filter.conf. Then, if you want these settings to be system-wide, symlink it to conf.d/10-lcd-filter.conf.

Now cairo needs to be patched to use the freetype LCD patches.  First, download lcd-filter.patch from here. Then you need to cd /usr/ports/graphics/cairo/ && make deinstall if it's already installed.

I didn't edit the actual port when I was doing this, so here are the instructions to manually patch it:


```
cd /usr/ports/graphics/cairo/
make extract
cd work/cairo-1.8.8/
patch -p1 </where/you/saved/lcd-filter.patch
```

Now, there's still one thing that needs to still be changed before cairo can be rebuilt.  cd to src and edit cairo-ft-font.c by changing the line


```
if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
```
to

```
// if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
```

Now you finish up cairo by running


```
cd /usr/ports/graphics/cairo
make build install clean
```

You should be able to specify lcdfilter in your ~/.fonts.conf now. I am currently using these hinting settings:


```
<!-- Font Display Settings -->
<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>
```

Here's a screenshot of Helvetica from a Google search: http://imagebin.ca/img/K4vqp5s.png

I'm also using a screen with 129 DPI, so my fonts may look a bit large on some lower DPI screens.  Don't worry, these patches still look good on lower DPIs as well. I use these same patches on my desktop with 96 DPI.


----------



## anamnesis (Dec 1, 2009)

Hi,

I'd really like to try your lcd fonts technique by following the instructions you wrote on the `Nice Fonts post'. I am however, a bit confused. I'm somewhat new to tweaking fonts with xml files. I've done something like this before on one of my machines running Gentoo Linux, and had gotten some pretty good results with fonts. I've never been able to achieve those kind of results with FreeBSD, even though I've been using FreeBSD for several years. 

If I followed your instructions from that post, do I just put your section of that xml file into ~/.fonts.conf, or do I have to build and add other fonts to /etc/X11/xorg.conf as well? The build procedure and font directories were just different in Gentoo, and I think that's part of what's got me baffled. At this point, the fonts on web pages in Firefox look absolutely horrible.

I understand most of your instructions from that post like patching and rebuilding cairo, etc... but I haven't tried it yet because I want to make sure that I've got proper xml data in ~/.fonts.conf

Could you send me or post what your ~/.fonts.conf looks like so I can gauge this whole issue better, and finally get some decent fonts in FreeBSD?

ThanX


----------



## jrick (Dec 1, 2009)

anamnesis said:
			
		

> Hi,
> 
> I'd really like to try your lcd fonts technique by following the instructions you wrote on the `Nice Fonts post'. I am however, a bit confused. I'm somewhat new to tweaking fonts with xml files. I've done something like this before on one of my machines running Gentoo Linux, and had gotten some pretty good results with fonts. I've never been able to achieve those kind of results with FreeBSD, even though I've been using FreeBSD for several years.
> 
> ...



The part I pasted was just the hinting settings for your ~/.fonts.conf. Here's a complete fonts.conf with just the hinting settings:


```
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <!-- Font Display Settings -->
    <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>
```

As for your /etc/X11/xorg.conf, you should have the FontPaths set for the fonts you have installed (most of the times, the ports will display a message saying what and how to edit it to add them).  Which font packages do you have installed? Can you run `% pkg_info -IX font` to see what you have installed (this assumes that 'font' is in the package name)?


----------



## anamnesis (Dec 1, 2009)

*Thanks dude !!!*

Success!!!

I got it going and I can't believe my eyes. You're right. These fonts are the best I've every seen! They even blow away Vista and 7's ClearType. The rendering is way better than what I've ever had in various distros of Linux. To me, they're about as equivalent as the vector rasterizer engine of Quartz 2D on my Mac.

Also, I went ahead and left the cairo source intact in the work folder. When I was searching in vi to find that one line to comment out, it got me interested in delving into font development.

See, I'm mainly into kernel and filesystem development and maintenance. I know a little bit conceptually about glyphs and bitmaps, but that's about it. Now, I'm a bit more curiouser and curiouser on the subject.

I'm running FreeBSD 8.0 now, so I've been doing some experimentation with the `Z' fs. Pooled storage. It tanks man!  

Anyway, thanks alot for your help on the 'now resolved' font issue.


----------



## fat64 (Feb 9, 2010)

The difference is amazing!  The LCD filter with the cairo patch and rejecting bitmap fonts did wonders for my display.

I found a second LCD filtering patch for libXft-2.1.14 here, but I'm not sure if it is necessary.  Can anyone explain exactly what it does?  I checked the line numbers, applied the patch, and rebuilt and installed x11-fonts/libXft.  Everything still works, bit there is no visible difference in the applications I have tried so far.  Still looks great.


----------



## Business_Woman (Feb 28, 2010)

How would you list all installed fonts?


----------



## aragon (Feb 28, 2010)

Business_Woman said:
			
		

> How would you list all installed fonts?


I like x11-fonts/fontmatrix


----------



## fat64 (Nov 10, 2010)

There is a nice clean version of the lcd-filter patch attached to PR PR ports/142875.  It still works with cairo-1.8.10_1,1.  Unfortunately, PR ports/142875 was rejected.


----------



## luna (Nov 10, 2010)

Rather than touch ~/.fonts.conf why not just use ubuntu patches (orig, port)? They even have a patch (orig, port) for lcd filtering on libXft. To use it, e.g. on xterm, add to ~/.Xdefaults

```
Xft.rgba: rgb
```


----------



## ahavatar (Nov 12, 2010)

I've been playing with fonts settings recently. I have FreeBSD 8.1-STABLE with port tree updated quite often (at least once a week). 

Following this HOWTO, I just made my personal ~/.fonts.conf like:

```
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
    <!-- reject all bitmap fonts, with the exception of 'terminus' -->
    <selectfont>
        <acceptfont>
            <pattern>
                <patelt name="family"> <string>Terminus</string> </patelt>
            </pattern>
        </acceptfont>
        <rejectfont>
            <pattern>
                <patelt name="scalable"> <bool>false</bool> </patelt>
            </pattern>
        </rejectfont>
    </selectfont>

    <!-- preferred aliases -->
    <alias> <family>serif</family>
        <prefer>
            <family>DejaVu Serif</family>
            <family>NanumMyeongjo</family>
        </prefer>
    </alias>

    <!-- preferred aliases -->
    <alias> <family>sans-serif</family>
        <prefer>
            <family>DejaVu Sans</family>
            <family>NanumGothic</family>
        </prefer>
    </alias>

    <!-- preferred aliases -->
    <alias> <family>monospace</family>
        <prefer>
            <family>DejaVu Sans Mono</family>
            <family>Terminus</family>
            <family>NanumGothicCoding</family>
        </prefer>
    </alias>

    <!-- default quality settings -->
    <match target="font">
        <edit mode="assign" name="rgba">      <const>rgb</const>     </edit>
        <edit mode="assign" name="antialias"> <bool>true</bool>       </edit>
        <edit mode="assign" name="autohint">  <bool>false</bool>       </edit>
        <edit mode="assign" name="hinting">   <bool>true</bool>       </edit>
        <edit mode="assign" name="hintstyle"> <const>hintfull</const> </edit>
        <edit mode="assign" name="lcdfilter"> <const>lcdlight</const> </edit>
    </match>

</fontconfig>
```
I use DejaVu fonts for sans, serif and monospace and Nanum fonts for Korean. And I deinstalled, recompiled with "make WITH_LCD_FILTERING" and installed freetype2. I didn't do anything with .gtkrc-2.0 because I don't have it and I don't understand its purpose for my settings.

The result is amazing. I can't be more satisfied than this. The freetype2 renders Truetype fonts beautifully. If I remember correctly, freetype2 starts to support the byte interpreter by default from version 2.4. If you haven't tried it yet, upgrade to it. You'll be amazed.


----------



## Beastie (Nov 12, 2010)

ahavatar said:
			
		

> I didn't do anything with .gtkrc-2.0 because I don't have it and I don't understand its purpose for my settings.


Like virtually everything in your home directory, it does not exist by default and you have to create it yourself. It is used to set options (including typeface, font size, etc.) uniformly for all GTK+-based applications.


----------



## bbzz (Oct 3, 2011)

I'm still finding fonts much better looking on Windows 7. I recompiled freetype2 fonts with MAKE_WITH_LCD_FILTERING, even tried changing that line in cairo as someone suggested.

This is ~/.fonts.conf file:


```
<!-- default quality settings -->
    <match target="font">
        <edit mode="assign" name="rgba">      <const>rgb</const>     </edit>
        <edit mode="assign" name="antialias"> <bool>true</bool>       </edit>
        <edit mode="assign" name="hinting">   <bool>true</bool>       </edit>
        <edit mode="assign" name="hintstyle"> <const>hintslight</const> </edit>
#	 <edit mode="assign" name="hintstyle"> <const>hintfull</const> </edit>
        <edit mode="assign" name="lcdfilter"> <const>lcdlight</const> </edit>
    </match>
```

Also tried changing "lcd_filter" and "hintstyle" options, as well as "rgba" to bgr, vrgb, vbgr.

The issue I have is that letters have red/blue/green shades, it's just not that good.

It's not nearly as crispy and smooth as on my windows laptop, unfortunately. Is there anything else one could try?

Cheers


----------



## jrm@ (Aug 8, 2013)

mart said:
			
		

> ```
> <?xml version="1.0"?>
> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
> <fontconfig>
> ...



This part gave me errors, so I used the following instead.


```
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

...

    <!-- disable autohinting for fonts that don't need it -->
    <match target="pattern">
      <test qual="any" name="family">
        <string>Andale Mono</string>
      </test>
      <test qual="any" name="family">
        <string>Arial</string>
      </test>
      <test qual="any" name="family">
        <string>Arial Black</string>
      </test>
      <test qual="any" name="family">
        <string>Comic Sans MS</string>
      </test>
      <test qual="any" name="family">
        <string>Courier New</string>
      </test>
      <test qual="any" name="family">
        <string>Georgia</string>
      </test>
      <test qual="any" name="family">
        <string>Impact</string>
      </test>
      <test qual="any" name="family">
        <string>Trebuchet MS</string>
      </test>
      <test qual="any" name="family">
        <string>Tahoma</string>
      </test>
      <test qual="any" name="family">
        <string>Times New Roman</string>
      </test>
      <test qual="any" name="family">
        <string>Verdana</string>
      </test>
      <test qual="any" name="family">
        <string>Webdings</string>
      </test>
      <edit mode="assign" name="hinting">  <bool>true</bool>  </edit>
      <edit mode="assign" name="autohint"> <bool>false</bool> </edit>
    </match>

</fontconfig>
```


----------



## Deleted member 48958 (Jul 25, 2016)

Fira Sans x11-fonts/fira or... Cantarell x11-fonts/cantarell-fonts for UI are best IMO.


----------



## debguy (Jun 26, 2018)

/etc/fonts.conf allows HACKS to font substitution

it can break applications or even cause lock-ups.  it can fix broken applictions: aha ... but which are you breaking or helping wen you hack it?

Linux From Scratch GNU/Linux x-lfs-2010

do NOT bother downloading.  but the above supports Mathematica 4.0.  the trick was INSTALLING FONTS CORRECTLY.  some hackers had put bogus font substutitions in the X11 font alias files.  those removed: order was critical.  after all was fixed the math was right: no missing symbols, no wrong symbols, and for math you preettty much want PERFECT.

xorg your not going to get perfect.  it's a sloppy system of substitution and never having the right font unless:

#1  its a gnu app that relies on fonts "just being there" and they are when, but (when someone hacks that font or changes the default in the default distro: your f'ed)

#2  the app is an "xorg" app and expects sloppy font choice, calculates and understands "guess choices", and somehow always shows you the right font: HIGHLY UNLIKELY.  perhaps supports unicode %100.  HIGHLY UNLIKELY.

#3  the app  was shipped with all fonts (ie, installed Adobe font pack)

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

Here's the issue.  check this "A" here.  it's a spline curve.  but there are many rules just for that simple glyph (download a GPL font maker, you'll see it's complicated). the spline curve has to be coded and there are many formats

in the end: an app MUST ask for "A" in a table and it can crash if that "A" does not fit exactly in a box (or it will look _bad__fonts_ if it don't crash)

guess what: if that get's substituted how does the app know the substitution isn't bogus?

IT DOESN'T.  THAT'S THE PROBLEM.

you have hacks tampering with very sensitive spline files, mixing the order in whcih they are found, then also IMPROPERLY simply substituting a WRONGLY sized shape glyph which might actually be THE WRONG MATH if the OS doesn't have the font asked for (ie, it's free fonts but app asked for a font using Adobe names)

solution: there isn't any really.

in the above URL only "correct" X11 fonts were installed, the FONTPATH was set to be well ordered, and the app fonts configured to be correctly found, and the app never missed a glyph.  THE WEB BROWSER was (is) set to only use Courier fonts (which actually made Firefox run a ton faster btw)

here's another for example: you install gnoome but not all gnome fonts.  you run gedit(1).  crashes when you change fontsize.  why?  due to  the substitution being the wrong size, gedit allocates the wrong memory, it don't fit and when the lines all come in: memory error, gedit "crashes", due to the bad substitution.  why did gedit do that?  #1 gedit is unsophisticated.  #2 on the developer machine they have fonts installed by ubuntu (w/ubuntu font config, which ... ugh).  they don't care if you don't.  #3 the developers never have the problem and don't care if on other systems it breaks: your problem


----------



## debguy (Jun 26, 2018)

GOOD PROGRAMS LIKE FIREFOX

they'll check the memory requirements and box sizes.  but try different fonts for best look: some fonts are not "pixelated" by nature, some aren't.  pixelated ones look best only if they are at the right desktop resolution and size (and on modern systems, probably not)

if font choices still "look like crap" after choosing a truetype, and if you've "done everything recommneded install", check your DPI setting for your monitor and make sure your desktop is set at the "native resolution".  your monitor will ONLY look good when it's DPI resolution (this is true at any desktop size) is at (one of) the native DPI.  often if you just choose the "native resolution" that will be ok.  (though DPI is still an xorg setting keep in mind).  so for a 1080p LED monitor: try 1080p.

run fccache if you change the /etc/font.conf file like manpage says, too


----------



## debguy (Jun 26, 2018)

so you got free fonts, questionable substitutions not all apps can handle OFTEN IN XORG LEADING TO INCORRECT SYMBOLS (even if they look good: missing or incorrect symbos are still happening using ubuntu xorg stuff)

**** GUESS WHAT THAT'S NOT ALL ****

i said font files are splines.  there are spline source files and spline binary files you didn't know that?  rare apps (or perhaps x11 / xorg) can read both.

but to RENDER the fonts in memory (which your video card have builtin, which most don't ... actually likely do but don't admit this to freeware)

to RENDER the fonts.  well because of japanese the spline files came to REQUIRE running code patches (math functions) in the font files

**** that's right, font files can be a SECURITY RISK  ... you don't want binary font files without source from an unknown maker , because , you just don't know , it's a blob *****

because not all (if any) font compiling "cached font" readers support "emulating font code to avoid font viruses".  i'm %100 sure earlier versions of X11 did NOT use a boch's emulator to run code in the fonts.  that means the fonts can intently (over-run memory regions or what else can be done)


----------



## debguy (Jun 26, 2018)

now ...

the old way to PREVENT FONT SUBSTITUTION was to have font client / servers running loaded with fonts so that no subsitution occurred because the right font was (eventually) found

but nearly no one does that anymore.  if your using Adobe Reader on a "well configured system" it might go fetch some adobe font without your knowing it and show you a perfect page.  but ... that's not linux


----------



## debguy (Jun 26, 2018)

if all GPL software was keyed to a free font set that was always avaialbe in the same subtitution order, things would work

they don't want it to work, per say.  the edit fonts in xorg, add remove things, distros like ubuntu change font order and add font packs specifig to (ie, gnome) and gnome OFTEN has "depreciated one font for another"

leading to what you have now: you have no idea if your app is using substitutions or using a font it was designed for, no idea if the symbols you see are correct or incorrect substitutions

yes, ABCDEFG seems to always work: but the bigger picture is there's allot broken

the people doing it: knew it.  trust me.


----------



## debguy (Jun 26, 2018)

i just GOTTA add this.  new firefox (and safari - they share some code base) uses 100 Megabytes per web page open.

the only possible excuse for that is they colluded to QUICKLY CONSUME memory on consumer computers so that 4-8 Gigabytes "ran out quickly"

their responses i've seen: "umm, it needs to pre-allocate or mmap that much so it's rendering engine doesn't run out of memory.  it's cached memory so it doesn't consume real memory it just deducts from total free memory not real memory used"

BULL.  LIES.


----------



## Deleted member 48958 (Jun 26, 2018)

Now I use Liberation Sans x11-fonts/liberation-fonts-ttf for UI and I like it much.
Liberation fonts, BTW, is the only project from Red Hat, that I really like 

I already posted it somewhere on FreeBSD forums, but if you use minimal DE-s,
using such WM-s like x11-wm/fvwm2 or x11-wm/openbox,
it is good idea to add 
	
	



```
Xft.dpi:                                96
Xft.autohint:                           0
Xft.antialias:                          1
Xft.hinting:                            1
Xft.rgba:                               rgb
Xft.hintstyle:                          hintslight
Xft.lcdfilter:                          lcddefault
```
to ~/.Xresources, it emulates functionality of such tools like gnome-settings-daemon or mate-settings-daemon, it should resize all fonts to 96dpi in all applications, including Qt and GTK applications. You also need to add `xrdb -merge ~/.Xresources` to your WM autostart script.

As a monospaced font I'm using "DejaVu Sans Mono" -- x11-fonts/dejavu and I like it much,
BTW, monospaced "Menlo" font from macOS is almost fully mimicating "DejaVu Sans Mono",
and "DejaVu Sans Mono" is based on "Bitstream Vera Sans Mono".
I use "9" font size.


----------

