Fonts in Firefox

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:

Screenshot_2018-12-07 Solved - Can't get the GNOME 3 desktop.png

If I inspect source, I see this:
CSS:
.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.
 
Last edited:
Start xfce4-appearance-settings, select Fonts tab, enable anti-aliasing and whatever hinting setting you like best.
 
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
Code:
<?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>
 
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.
 
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:

Code:
# 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.

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

You may also want to disable bitmap fonts scaling.
Code:
# pwd
/usr/local/etc/fonts/conf.d
# rm 10-scale-bitmap-fonts.conf
 
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.
 
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.
 
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:

Add the following line to the "Files" section of your x.org configuration file:

FontPath "/usr/local/share/fonts/LinLibertineG/"
Message from liberation-fonts-ttf-2.00.1,2:

You can start using the fonts by following these instructions:

Add the following line to the "Files" section of your x.org configuration file:

FontPath "/usr/local/share/fonts/Liberation/"
Message from GentiumBasic-1102:

To use these fonts, add the following line to the "Files" section of
xorg.conf:

FontPath "/usr/local/share/fonts/GentiumBasic/"

Users of older versions of X may additionally have to make sure that
the freetype module is loaded. Check /var/log/Xorg.0.log for error
messages. If freetype is required, add the following line to the
"Modules" section of xorg.conf:

Load "freetype"
Message from crosextrafonts-carlito-20130920_2:

You can start using the fonts by following these instructions:

Add the following line to the "Files" section of your x.org configuration file:

FontPath "/usr/local/share/fonts/Carlito/"
Message from crosextrafonts-caladea-20130214_1:

You can start using the fonts by following these instructions:

Add the following line to the "Files" section of your x.org configuration file:

FontPath "/usr/local/share/fonts/Caladea/"
...
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:
Code:
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
Code:
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.)
 
Last edited:
Back
Top