Code

OCaml and C source code set in a monospaced family.

Headings: Lodusa. Text: Bocefia Serif. Code: Lodusa Mono.

Source code

In the monospaced families every character has the same width, and 0 O 1 l I have distinct shapes.

catalogue.ml
(* Group the faces of a family by weight. *)
let by_weight faces =
  List.fold_left
    (fun acc face ->
      let seen = Option.value ~default:[] (List.assoc_opt face.weight acc) in
      (face.weight, face :: seen) :: List.remove_assoc face.weight acc)
    [] faces

let () =
  by_weight catalogue
  |> List.iter (fun (w, fs) -> Printf.printf "%d -> %d\n" w (List.length fs))
layout.c
/* Sum the advance widths of a run of glyphs. */
static int run_width(const glyph_t *g, size_t n)
{
    int w = 0;
    for (size_t i = 0; i < n; i++) {
        if (g[i].id != 0 && g[i].flags & GLYPH_VISIBLE)
            w += g[i].advance - (i > 0 ? kern(g[i - 1].id, g[i].id) : 0);
    }
    return w >= 0 ? w : -1;   /* 0O 1lI {} [] <= != -> */
}