This issue will describe the high-level concepts and ideas for fontJAM.
Comments are welcome!
The goal of fontJAM
The fontJAM project aims to simplify and standardize the deployment of web fonts to a point where self-hosting becomes trivial.
It wants to achieve this by defining a file format incorporating information about where to get and how to build webfonts that can be used to generate static font hosting sites as small as a
fonts/ directory on your own webspace or, with the accompanying GUI, as big as Google Fonts (provided you have enough resources 😉).
To ensure that that information about fonts needs not be re-collected by each and every person who wants to self-host fonts, fontJAM lastly also aims to build a free and open database of Font Definition Files.
Components / Sub-Projects
fontJAM Font Definition File format
It is intended to extend the syntactic specification of an existing file format, such as YAML or TOML, with semantics that apply to fonts metadata and deployment.
Possible data points would include for example:
- Technical and Display name of the Font
- Copyright information, especially the copyright notice and SPDX code of the license used
- Versioning and Sourcing information
- Version number and indication if font uses semantic versioning
- Where to retrieve which version of the font, and hashsums to verify integrity
- Which font files in which formats are contained where in the font’s distribution
- Scripts that modify a font prior to deployment
Font hosting site generator
The font hosting site generator is a command-line application that takes a set of Font Definition Files (defined in a configuration file similar to
cargo.toml) and generates a directory structure with font distributions and JSON metadata, ready to be deployed to static web hosting.
The generator’s main job is to collect, aggregate, process and enrich information about the fonts as well as to ensure a consistent, cacheable output. Besides that, the generator has to do caching and verification of downloaded “raw” font distributions and provide assistance to the user for managing the font hosting site (e.g. a CLI for adding / removing fonts).
It is intended to be written in Rust, profiting from the language’s rich type system, safety, correctness, high performance, growing ecosystem of modern libraries and overall great developer experience.
The default GUI for fontJAM is planned to be a themeable, filter- and searchable font index for a given font hosting site, with font previews and embedding instructions.
In addition, the GUI could provide means to customize the fonts (if possible) as well as the possibility to download the corresponding Font Definition File for self-hosting, without using the font hosting site that the GUI belongs to.
While the rest of the system is relatively calculable at this point, the GUI will be a space for experimentation and much will depend on how the final system will actually turn out, so the GUI will be looked at in a second step (see roadmap below).
Technical realization of this could be in the form of a single-page-app (SPA), as a generated site or as a hybrid (i.e. based on Nuxt.js), possibly even configurable by the user.
Font Definition Database
The Font Definition Database in its simplest form could be a Codeberg repository containing a well-sorted collection of Font Definition Files, with users being encouraged to contribute new definitions.
Key to success for the database is to ensure a high level of quality for the collected font definition files. That especially includes that licensing issues are researched beforehand and the integrity and quality of font distributions is verified (and perpetuated, i.e. using a hash sum).
Walkthrough through a few exemplary use cases
Self-hosting fonts on Static Hosting
Imagine you have a personal web site, hosted i.e. on Codeberg Pages, and you want to include web fonts there.
Right now you basically have the choice of either using a commercial service like Google Fonts, to download the font and self-host it, by downloading it and putting the files that you need in or next to your source tree or to use a dependency manager like npm.
The first option is very convenient, but in most, if not all cases has privacy implications and contributes to the centralization of the web.
The second option is rather tedious and clunky, because not only do you have to visit each font author’s web site and download the font, extract what you need, check README and LICENSE, and possibly have it clutter your source repository but each time the font is updated you also have to manually change out files.
The third option is the best of the three, but currently the quality of many font packages tends to be questionable, especially in the legal department (e.g. compliance with the OFL with respect to Reserved Font Names). Also, it would be nice to not only have the ability to define dependencies to fonts, but to also have structure and metadata to be able to re-use these fonts with your other websites, if the need arises, or to auto-generate additional content or code from the fonts without too much of a hassle.
With fontJAM, managing self-hosted fonts (here for example with the randomly picked fonts Inter, Tajawal and Fantasque) could be as easy as:
$ fontjam init ... interactively initializes your font hosting site, needs to be done only once ... $ fontjam add inter tajawal fantasque ... searches the Font Definition Database, adds the fonts to your dependencies, locks down their versions ... $ fontjam build ... builds a ready-to-use font hosting site to /fonts, with deterministic file names for what you need to include in your site ...
What if a font is not contained in the Font Definition Database or if you want to customize it? Then you could just write a Font Definition File yourself or derive it from an existing file (and preferably write a Pull Request to the Font Definition Database when you’re done 😉).
Building a non-profit font hosting site
If you don’t want to self-host fonts (only) for yourself, but for others as well, consider adding a GUI to your font hosting site by simply themeing and deploying the fontJAM GUI, pointing it to wherever your font hosting site is deployed. That way, users could conveniently search and filter fonts, find instructions on how to use them and no longer be dependent on commercial services like Google Fonts.
From here on, the next steps will be
- Collect requirements for Font Definition File format -> #7
- Collect requirements for the font hosting site generator -> #7
- Decide in what form to write the specification for the Font Definition File format -> #2
Based upon the above:
- Decide on licensing for the Font Definition File format specification -> #2
- Split up requirements into reasonable milestones
- Brain-storm ideas for the GUI, maybe draw some mockups
Then the first milestone (minus GUI) can be developed, upon which then the first interation of the GUI can be based.
So, that’s the general plan for fontJAM - I’m very curious about your thoughts on this! :)
I will try to regularly add to this repository over the next few weeks. Now that vacation has ended, I will have to return my main focus on finishing college, so please don’t worry if I don’t answer as swiftly as you’re used to 😉