package fontforge-of-ocaml

  1. Overview
  2. Docs
OCaml binding of FontForge

Install

Dune Dependency

Authors

Maintainers

Sources

fontforge-of-ocaml-1.1.0.tbz
sha256=af7c59bea65ac5844c04ea7ae5347c4ab2016a217d54a3c1d806020dffad064f
sha512=2e48257b58151c453cb6fb2fd56899ccde52e94fd74ed7b031381a45a8756668096e3d2bf2e716f57067c2c5f8896ae5cecb498d7124d0f83c212b2732c6cd15

README.md.html

README.md

Copyright (C) 2017-2022, P. Baudin (https://github.com/pbaudin/fontforge-of-ocaml)



OCaml binding to FontForge

Library usage

The fontforge-of-ocaml library is published under the LGPL v2.1 license and its API is documented in the file src/FontForge.mli.

Example of use

Look at the included test file tests/test_FontForgeLib.ml.

Notice

The binding is incomplete, but don't forget that the library is able to load .fea (OpenType Feature) files to design complex fonts.

Installation

The library can easily be installed from source-based package manager Opam from a pin to this GitHub repository:

$ opam pin https://github.com/pbaudin/fontforge-of-ocaml

On Ubuntu, the library relies on python3-fontforge package that contains the python3 binding to FontForge:

$ sudo apt-get install -y python3-fontforge

Contributing

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.

The story

Preamble

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.

Development

The first version of that library was written in OCaml and used the Lymp library allowing you to use Python functions and objects of FontForge API from OCaml world.

The 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 OCaml to 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 PyMl library.