Skip to content

libfontconfig compatibility? #24

@alshain

Description

@alshain

Would it be feasible to add some compatbility layer that allows programs compiled against the real libfontconfig to work with rust-fontconfig instead?
I'm guessing this isn't so straight-forward because rust-fontconfig wasn't created with the goal of being compatible and usable through a shim, so struct-layouts would be different, correct?

I stumbled over this project looking to reduce our dependencies when building Java-based images. Having had the same thoughts as you listed in the readme, I searched for a Rust-implementation of fontconfig and ended up here and saw that there's even some C-APIs.


The JVM uses a relatively small subset of libfontconfig functions and most types seem to be used as opaque types. :

FcPatternBuild
FcObjectSetBuild
FcFontList
FcStrDirname
FcNameParse
FcConfigSubstitute
FcDefaultSubstitute
FcFontMatch
FcGetVersion
FcFontSort
FcCharSetUnion

FcPatternAddString/FcPatternGetString/FcPatternGetBool/FcPatternGetInteger

FcPatternDestroy
FcObjectSetDestroy
FcFontSetDestroy
FcCharSetDestroy

Here is an example how they use it:

https://github.com/openjdk/jdk/blob/d3158e71c6a0b5a78a04fc9a7e2d33174cb7fe49/src/java.desktop/unix/native/common/awt/fontpath.c#L584-L590

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions