Skip to content

Load fonts through the native library fontconfig on other (non redox) operating systems

Jeremy Soller requested to merge jsalzbergedu:master into master

Created by: jsalzbergedu

Orbfont::find() did not find anything on my system, so I tacked on rust-font-loader, a rust front-end for fontconfig, which is a C library that is installed on most Linux computers.

Pros:

  • orbfont::find() now works on my computer: Running fine

  • Wikipedia tells me fontconfig can be installed on Mac OS and Windows, which rust-font-loader claims to support

  • Compiles for redox and linux on my computer

Cons:

  • rust-font-loader isn't 1:1 in representation of fonts with the typeface, family, style thing: instead, the only typeface that can be specified is monospace, so specifying sans or serif won't change anything

  • EDIT: It seems to work if I just append "serif" or "sans" to the end of the name of the family that rust-font-loader is looking for, so I changed it to that. Now both the non-redox and redox orbfont appear to be able to use functions like orbfont::(Some("Serif"), Some("Liberation"), Some("Regular")), even though the regular argument will just be ignored on non-redox

  • It wraps a c library (which is probably unsafe), and adds an extra dependency. If you don't want to merge it because adding another dependency pollutes such a small and pristine library, I understand

  • It's kinda messy. If you can think of a way to clean up this code, please tell me before merging it

Merge request reports