gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
283 stars 113 forks source link

Creating fonts from backends #54

Open withoutboats opened 9 years ago

withoutboats commented 9 years ago

I'm not sure if I'm just looking in the wrong place, but I can't find support for using font backends other than the "toy" backend that comes with cairo. The documentation says:

Font faces are created using font-backend-specific constructors, typically of the form Context::backend_font_face_create()

and

For "real" font selection, see the font-backend-specific font_face_create functions for the font backend you are using. (For example, if you are using the freetype-based cairo-ft font backend, see Font::create_for_ft_face() or Font::create_for_pattern().) The resulting font face could then be used with Context::scaled_font_create() and Context::set_scaled_font().

But I can't find any of these functions. Are there other crates that I'm just missing, perhaps? The C functions for creating font faces from any of the backends also aren't in cairo::ffi or cairo-sys.

Documentation for the C API is here.

GuillaumeGomez commented 9 years ago

It's certainly because it hasn't been bound yet. However, it reminds me something... I'm gonna take a look !

gkoz commented 9 years ago

cairo does not use GObject introspection so the generator can't help here :frowning:

Backends support would require conditional compilation and one or both of detecting of available backends in the build script and using features again.

gkoz commented 9 years ago

cairo does not use GObject introspection so the generator can't help here :frowning:

Well actually we could try generating a gir and running the generator anyway. There's a chance it will be good enough for sys crates.