# Fonts in Firefox



## cbrace (Dec 7, 2018)

Hi all,

As I mentioned in another thread, I'm very new to FreeBSD on the desktop, learning as I go along here.

In Firefox, some pages are displayed with ugly bitmapped fonts. In fact I'm seeing this on this forum:





If I inspect source, I see this:

```
.message-body {
    font-family: 'Segoe UI','Helvetica Neue',Helvetica,Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans',sans-serif;
}
```
It looks like the forum CSS is trying to load some custom font styles. My question(s) would be: why are these font-styles not being loaded? And, failing that, why is the browser defaulting to an ugly bitmapped sans-serif? In the Firefox preferences, I have Liberation Sans and so on defined as the default fonts.

Yes, I'm aware that there is a chapter on fonts in the Handbook which I need to study, and vermaden has a blog post on this as well. But right now I am trying to understand how the base install works before I start editing xorg.conf and font config files and that kind of thing.

I'm seeing this both under Mate as well as Xcfe.


----------



## shkhln (Dec 7, 2018)

Start `xfce4-appearance-settings`, select Fonts tab, enable anti-aliasing and whatever hinting setting you like best.


----------



## shkhln (Dec 7, 2018)

Although, now that you mention it, this site looks a little bit more pixelated than it should...


----------



## twllnbrck (Dec 7, 2018)

You could make system wide font settings via /usr/local/etc/fonts/local.conf.
(Don't use /usr/local/etc/fonts/fonts.conf - it'll replaced with the next x11-fonts/fontconfig update).

Mine looks like this

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

    <!-- ANTIALIAS ALL FONTS -->
    <match target="font">
            <edit name="antialias"  mode="assign"><bool>true</bool></edit>
            <edit name="autohint"   mode="assign"><bool>true</bool></edit>
            <edit name="hinting"    mode="assign"><bool>false</bool></edit>
            <edit name="hintstyle"  mode="assign"><int>0</int></edit>
            <edit name="dpi"    mode="assign"><double>75</double></edit>
            <edit name="rgba"       mode="assign"><const>none</const></edit>
        </match>

    <!-- SET LIBERATION AS SYSTEM FONT -->
        <alias> <family>serif</family>
        <prefer><family>Liberation Serif</family></prefer>
        </alias>
            <alias><family>sans-serif</family>
            <prefer><family>Liberation Sans</family></prefer>
            </alias>
            <alias><family>monospace</family>
            <prefer><family>Liberation Mono</family></prefer>
            </alias>

    <!-- REPLACE THESE WITH A BETTER LOOKING FONT (MONO) -->
    <match target="pattern">
        <test name="family"    qual="any"><string>Courier [Adobe]</string></test>
        <edit name="family"  mode="assign"><string>Courier 10 Pitch</string></edit>
    </match>

    <match target="pattern">
                <test name="family"     qual="any"><string>fixed</string></test>
                <edit name="family"  mode="assign"><string>Courier 10 Pitch</string></edit>
        </match>

    <match target="pattern">
                <test name="family"     qual="any"><string>courier</string></test>
                <edit name="family"  mode="assign"><string>Courier 10 Pitch</string></edit>
        </match>

    <!-- REPLACE THESE WITH BETTER LOOKING FONTS (SANS) -->
    <match target="pattern">
            <test name="family"     qual="any"><string>Helvetica</string></test>
            <edit name="family"> mode="assign"><string>Arial</string></edit>
        </match>

    <match target="pattern">
                <test name="family"     qual="any"><string>Times</string></test>
                <edit name="family"> mode="assign"><string>Times New Roman</string></edit>
    </match>

    <match target="pattern">
                <test name="family"     qual="any"><string>Lucida</string></test>
                <edit name="family"> mode="assign"><string>Trebuchet MS</string></edit>
        </match>

    <!-- DISABLE EMBEDDED BITMAPS -->
    <match target="font">
        <edit name="embeddedbitmap"mode="assign"><bool>false</bool></edit>
    </match>

</fontconfig>
```


----------



## shkhln (Dec 7, 2018)

Lanakus said:


> You could make system wide font settings via /usr/local/etc/fonts/local.conf.



I just found I had this file installed by pcbsd-utils (with some dubious font substitutions obviously). Meh, I should have known better than to deal with anything related to pcbsd.


----------



## vermaden (Dec 7, 2018)

For a quick fix check */usr/local/etc/fonts/conf.d* directory.

You have these options in the */usr/local/etc/fonts/conf.avail* dir to choose:


```
# ls /usr/local/etc/fonts/conf.avail | grep bitmap
10-scale-bitmap-fonts.conf
70-no-bitmaps.conf
70-yes-bitmaps.conf
```

To disable bitmap fonts entirely use this symlink in the */usr/local/etc/fonts/conf.d* directory.


```
# pwd
/usr/local/etc/fonts/conf.d
# ln -s ../conf.avail/70-no-bitmaps.conf
```

You may also want to disable bitmap fonts scaling.

```
# pwd
/usr/local/etc/fonts/conf.d
# rm 10-scale-bitmap-fonts.conf
```


----------



## Sevendogsbsd (Dec 7, 2018)

Vermaden's suggestions are spot on for me - it's the bitmap fonts that always cause issues on my system.


----------



## Minbari (Dec 7, 2018)

You can uncheck "Allow page to use their fonts..." so that Ff can use your fonts.


----------



## yuripv (Dec 7, 2018)

Sorry for hijacking the thread.. Minbari, what's that wm and status bar at the top?


----------



## Minbari (Dec 7, 2018)

yuripv said:


> Sorry for hijacking the thread.. Minbari, what's that wm and status bar at the top?


The WM is i3 and the status bar it's i3blocks.


----------



## cbrace (Dec 8, 2018)

shkhln said:


> Start `xfce4-appearance-settings`, select Fonts tab, enable anti-aliasing and whatever hinting setting you like best.


I fiddled a bit with those settings, but they have no effect on Firefox page rendering, as far as I can tell.


----------



## cbrace (Dec 8, 2018)

Minbari said:


> You can uncheck "Allow page to use their fonts..." so that Ff can use your fonts.


Well, in theory I'm not against pages with their own font styles, in fact I think it is great if done well. Just to take one example, whoever designed the CSS for this forum uses some intereresting fonts -- the effect is very elegant in Firefox running on my Linux Mint (Cinnamon) desktops. Just wondering why by default FF under FreeBSD/Xfce uses the ugly bit-mapped ones.


----------



## drhowarddrfine (Dec 8, 2018)

cbrace Browsers intentionally run the default or user-specified fonts on the user's system.


----------



## cbrace (Dec 8, 2018)

Many thanks vermaden your fix worked for me. Pages in Firefox are looking much better now, no more ugly fonts


----------



## vermaden (Dec 8, 2018)

Welcome.


----------



## vermaden (Dec 8, 2018)

Minbari said:


> The WM is i3 and the status bar it's i3blocks.


It looks really nice, would you mind sharing your configs both for i3blocks and i3?


----------



## rigoletto@ (Dec 9, 2018)

See Thread 61501


----------



## Vull (Dec 9, 2018)

Also see https://forums.freebsd.org/threads/recommended-xorg-font-configuration-method.59744/

The following instructions are from the package installation output for `pkg install libreoffice`:


> ...
> Message from linuxlibertine-g-20120116_1:
> 
> You can start using the fonts by following these instructions:
> ...


Combining this with the instructions I read some time back from the old kde4 package installation, I have these two files configured accordingly as part of my usual FreeBSD x11 desktop installation kit:
/usr/local/etc/X11/xorg.conf.d/files.conf:

```
Section "Files"
    FontPath "/usr/local/share/fonts/dejavu/"
    FontPath "/usr/local/share/fonts/LinLibertineG/"
    FontPath "/usr/local/share/fonts/Liberation/"
    FontPath "/usr/local/share/fonts/GentiumBasic/"
    FontPath "/usr/local/share/fonts/Carlito/"
    FontPath "/usr/local/share/fonts/Caladea/"
EndSection
```
/usr/local/etc/X11/xorg.conf.d/freetype-module.conf

```
Section "Module"
    Load "freetype"
EndSection
```
Because of changes in the way xorg handles things, I'm not sure if the 2nd file is still necessary, but it doesn't seem to hurt anything. Since my monitor and graphics are still pretty primitive, I'm also unsure about how much attention Firefox pays to these things. For my applications it isn't really that important; my main concern at the time was just to display the Arial/Helvetica font-family fonts correctly in Firefox, and this seemed to do the trick for me. I could also see a big difference on this site when I followed vermaden's instructions above to defeat the display of ugly bitmap fonts.

(EDITED to add:  These files no longer seem to be necessary, insofar as I just added libreoffice to a plasma5-plasma system, and then, upon checking Font Configuration in the Plasma5 System Settings, I discovered that the fonts had already been found, without any of the above xorg.conf configuration being done.)


----------

