Library providing OCaml binding of FontForge Python API
Copyright (C) 2017-2022, P. Baudin (https://github.com/pbaudin/fontforge-of-ocaml)
OCaml binding to FontForge
Example of use
Look at the included test file tests/test_FontForgeLib.ml.
The binding is incomplete, but don't forget that the library is able to load
.fea (OpenType Feature) files to design complex fonts.
$ opam pin https://github.com/pbaudin/fontforge-of-ocaml
On Ubuntu, the library relies on
python3-fontforge package that contains the
python3 binding to
$ sudo apt-get install -y python3-fontforge
Since the library meets my needs, I won't complete the binding from myself. Nevertheless, if you want to contribute you are welcome. Don't hesitate to open an issue for that and why not propose a pull request.
This library was developed in 2017 and used for the design of several Advanced Cross-Stitch Fonts. Five years later, it time to publish the
fontforge-of-ocaml library even if the binding is incomplete.
FontForge API imposes type constraints between the arguments of the functions managing the contextual font tables. In order to offer an
OCaml API as close as the
FontForge API, the use of Generalized Algebraic Data Type of
OCaml was seen as an opportunity. That has not been so much used due to some bugs in the
Lymp library raised by the hudge number of calls from
Python. A work around has been found in generating an intermediate file (specifying the
OpenType Feature Data to use in a
.fea file) to build the final fonts from
FontForge Python API and the
OCaml binding. That explains why the development of the
FontForge binding was stopped earlier that expected.
In the meantime,
Fontforge API migrated to
Python 3 and the
Lymp library was no more able to perform the binding with newer versions of
OCaml compiler and various libraries. Nevertheless, with few effort the
Lymp library was easily replaced by the