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

Crate #128

Merged
merged 43 commits into from May 6, 2017

Conversation

Projects
None yet
5 participants
@GuillaumeGomez
Member

GuillaumeGomez commented May 6, 2017

No description provided.

Yamakaky and others added some commits Mar 9, 2017

Merge pull request #111 from EPashkin/master
Use crates in master, update versions
Merge pull request #113 from EPashkin/revert-111-master
Revert "Use crates in master, update versions"
Fix FFI prototypes for cairo_scaled_font functions
These functions had parameters incorrectly marked as ptr-to-mutable
while the C declarations have these parameters as ptr-to-immutable.

cairo_scaled_font_text_extents takes a *const c_char not a *mut c_char.
cairo_scaled_font_glyph_extents takes a *const Glyph not a *mut Glyph.
cairo_scaled_font_text_to_glyphs takes *const c_char not *mut c_char.

See https://cairographics.org/manual/cairo-cairo-scaled-font-t.html
Implement missing ScaledFont functions
This adds the following new functions:

ScaledFont::extents
ScaledFont::text_extents
ScaledFont::glyph_extents
ScaledFont::text_to_glyphs

This function has a large unsafe block due to
cairo_scaled_font_text_to_glyphs returning two pointers that are
allocated using opaque methods, i.e. not under our control, and so must
be copied into Vec<>'s.

The other option would have been to return a special container type for
[Glyph] and [TextCluster] that called the relevant
cairo_{glyph,text_cluster}_free function upon drop. Less copying but
greater complexity and poor ergonomics.

ScaledFont::get_font_face
ScaledFont::get_font_options

I opted for an explicit allocation and return of a FontOptions structure
(wrapped opaque pointer) instead of allowing a caller to pass in an &mut
FontOptions as I felt that wasn't idiomatic Rust code.

ScaledFont::get_font_matrix
ScaledFont::get_ctm
ScaledFont::get_scale_matrix
Merge pull request #120 from johncf/glib-ptr
impl *GlibPtr* for font types, make raw pointer fields private
Move major font types to its own modules
Because `glib_wrapper!` can only be applied once per module.
Merge pull request #122 from johncf/glib-proper
Proper glib bindings for font types

GuillaumeGomez and others added some commits Apr 23, 2017

Merge pull request #123 from EPashkin/write_to_png
Fix parameters for ImageSurface::create_from_png and write_to_png
Merge pull request #125 from johncf/enums
cairo-sys: fix enum types
Rob Tsuk
Make glib dependency optional
The cairo bindings used the glib::translate traits to handle internal
reference counting discipline. However, these are not actually
required, and should be possible to use cairo without a dependency on
glib. This patch makes the dependency optional, and changes the
implementation to not use the glib traits internally.
Rob Tsuk
Rob Tsuk
Rob Tsuk
Rob Tsuk
Rob Tsuk
Merge pull request #127 from rtsuk/master
Make glib dependency optional
@EPashkin

This comment has been minimized.

Show comment
Hide comment
@EPashkin

EPashkin May 6, 2017

Member

👍

Member

EPashkin commented May 6, 2017

👍

@GuillaumeGomez GuillaumeGomez merged commit 4e52e51 into gtk-rs:crate May 6, 2017

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:crate branch May 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment