Using Fonts You Want to Use
  • Order of the Butterfly
    Order of the Butterfly
    Korni
    Posts: 472 from 2006/2/23
    From: the Planet of ...
    Browsers come with font settings. However, these settings are often neglected. Web developer has at least three options for selecting a font which would be displayed by default on your browser screen.
    It can be a generic font, "hand picked" local font-family, or on-the-fly downloaded web font. Nevertheless the user still has the choice which font he or she actually wants to use. Reasons: privacy, security, speed, aesthetic.

    Preparing the fonts:

    MorphOS is bundled with True Type, PostScript and Amiga Bitmap fonts.
    OWB uses fontconfig for font handling. Fonts are cached whenever a change in font directories is detected.
    If you want to use your fonts exclusively - fonts.conf should only use the path where you store the fonts (for example SYS:Fonts/_ttf).

    Fontconfig is a library providing font configuration, customization and application access. It uses freetype library which supports plenty of font formats (excluding Amiga Bitmap fonts).
    Presets are stored in the MOSSYS:Fontconfig/conf.avail directory.

    FONTS:Fontconfig/fonts.conf (default font dirs)
    Code:
    <!-- Font directory list -->

    <dir>SYS:Fonts/_pcf</dir>
    <dir>SYS:Fonts/_pfb</dir>
    <dir>SYS:Fonts/_ttf</dir>
    <dir>MOSSYS:Fonts/_pcf</dir>
    <dir>MOSSYS:Fonts/_pfb</dir>
    <dir>MOSSYS:Fonts/_ttf</dir>


    Example settings:

    FONTS:fontconfig/conf.d/51-local.conf
    Code:
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
    <!-- Load local system customization file -->
    <include ignore_missing="yes">local.conf</include>
    </fontconfig>


    FONTS:fontconfig/local.conf (turns off antialias for font sizes smaller than 16 and disables autohint)
    Code:
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <!-- /etc/fonts/local.conf file for local customizations -->
    <fontconfig>

    <match target="font">
    <edit name="antialias" mode="assign">
    <bool>false</bool>
    </edit>
    </match>

    <match target="font" >
    <test name="size" qual="any" compare="more">
    <double>16</double>
    </test>
    <edit name="antialias" mode="assign">
    <bool>true</bool>
    </edit>
    </match>

    <match target="font" >
    <test name="pixelsize" qual="any" compare="more">
    <double>16</double>
    </test>
    <edit name="antialias" mode="assign">
    <bool>true</bool>
    </edit>
    </match>

    <match target="font">
    <edit name="autohint" mode="assign">
    <bool>false</bool>
    </edit>
    </match>

    </fontconfig>


    In OWB, go to Settings/Fonts and choose default fonts and sizes.

    Blocking remote fonts:

    OWB comes with an integrated blocker. Make sure it's enabled (Settings/Content). To disable remote web fonts this line needs to be added to its filter (SYS:Applications/OWB/Conf/blocked.prefs):
    *Quote:

    /\.ttf|\.otf|\.woff|\.woff2\?/


    A specific font can be whitelisted too:
    Code:
    @@/*actually-nice-font.ttf


    Other platforms:

    In theory, the methods above will work on other systems.
    Firefox has the option to disallow any other font than set in its preferences.
    Chrome and Opera have --disable-remote-fonts option.
    Other browsers might need a blocker. uBlock comes with an option to block remote fonts.
    Custom filters (like the one above) should work as well.

    *This isn't ideal. OWB will try block anything_not_whitelisted.ttf, even if you look for a nicefont.ttf in Google Search.

    [ Edited by Korni 30.04.2018 - 22:28 ]
    http://korni.ppa.pl/modkowypaczek/ | My Rifle, My Bunny, and Me
  • »28.04.18 - 10:21
    Profile Visit Website
  • ASiegel
    Posts: 1376 from 2003/2/15
    From: Central Europe
    I think this would make a great article for the MorphOS Library. The information is too useful to get lost in the forum, don't you think?
  • »29.04.18 - 02:12
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Korni
    Posts: 472 from 2006/2/23
    From: the Planet of ...
    I did think about it. Article needs some improvements for sure.
    http://korni.ppa.pl/modkowypaczek/ | My Rifle, My Bunny, and Me
  • »29.04.18 - 14:02
    Profile Visit Website
  • ASiegel
    Posts: 1376 from 2003/2/15
    From: Central Europe
    If it is good enough to post here, it is good enough for the library. The beauty of wikis is that every member can contribute and help improve articles.
  • »30.04.18 - 10:25
    Profile