Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Optionally) work with fontconfig-sys instead of servo-fontconfig-sys #11

Closed
ashkitten opened this issue Aug 10, 2017 · 13 comments
Closed

Comments

@ashkitten
Copy link

I'm trying to use font-loader with glium_text, which uses fontconfig-sys. If I try to use them both at once, it gives me error: native library `freetype` is being linked to by more than one package, and can only be linked to by one package. Would it be feasible to make it at least optionally work with fontconfig-sys?

@matprec
Copy link
Owner

matprec commented Aug 11, 2017

Yeah, i don't like the current solution either.

Ideally, font-loader shouldn't use servo-fontconfig-sys, since it compiles and links fontconfig. I don't now whether or not there are people depending on it, so i propose a two step migration:

  1. Introduce fontconfig-sys behind a feature flag instead of servo-fontconfig-sys. Conditional compilation makes it possible to avoid linkage. Introduce a dead code block in servo-fontconfig-sys block, which says somethin along the lines of "dependency will change, use new flag now, see issue #blah". This way, people will be warned.
  2. Somewhere in the future, drop servo-fontconfig-sys completely

If you need help, let me know!

@ashkitten
Copy link
Author

Any progress on this? If you need a PR let me know

@matprec
Copy link
Owner

matprec commented Sep 19, 2017

Sorry for the delay!

If you could provide the PR, that'd be perfect. I don't have that much time on hand, so if you could provide a PR, that'd be perfect! If you have problems/no time on your own, let me know. We will find a way to solve this :)

@ashkitten
Copy link
Author

Looks like until rust-lang/cargo#1197 is resolved, we won't be able to introduce a platform-specific dependency behind a feature flag.

@ashkitten
Copy link
Author

er, looks like it works fine by putting it in the regular [features] section. never mind :)

@matprec
Copy link
Owner

matprec commented Sep 20, 2017

Wouldn't it still pull servo fontconfig and therefore fail at linktime? Another relevant bug: rust-lang/cargo#2524

@ashkitten
Copy link
Author

hmm, it also looks like fontconfig-sys is too old... doesn't work with rust 1.0 it seems? i'm not sure what our options are here

@matprec
Copy link
Owner

matprec commented Sep 20, 2017

I see two options:

  1. Explain your issue to the servo-fontconfig(-sys) project and make the build of fontconfig optional, via feature flag.
  2. Approach the glium_text project and explain your issue, point on fontconfig being outdated, propose switching to servo-fontconfig and ideally provide a patch witch does it.
    (3. Use bindgen and publish your own fontconfig crate)

@ashkitten
Copy link
Author

I've already decided to move to freetype-rs from glium_text, but I might be able to do something about it. @jwilm solves this in https://github.com/jwilm/alacritty/tree/master/font by using a custom version of rust-fontconfig that uses piston's bindings instead, so that might be an option as well.

@matprec
Copy link
Owner

matprec commented Sep 20, 2017

You could also try to override font-loaders servo-fontconfig dependency, given that the replacement has the same structure (use statements would become invalid)

@jwilm
Copy link

jwilm commented Sep 20, 2017

It would be nice if the community could rally around a single fontconfig-sys and freetype-sys crate which allow fontconfig to optionally link with freetype. This is actually blocking me from publishing some high-level fontconfig bindings used in Alacritty. Would need buy-in from both Servo and Piston. No idea if the problem is technical or political, or just nobody bothered to talk in the first place.

I believe if that happened, all of these issues could go away, and Rust + Linux font stack would be much better off.

@ashkitten FWIW, I've had basically zero problems with the approach in Alacritty.

@ashkitten
Copy link
Author

I decided to go with that approach in my application. I only had to fork servo-fontconfig-sys, since I can just use the [replace] section in my Cargo.toml

@ashkitten
Copy link
Author

It seems to me like this issue doesn't really accomplish anything, so I'll close it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants