Add a binding to `CGFontGetUnitsPerEm()`
Pathfinder 2 is using this. It saves a little bit of time and memory by avoiding creation of `CTFont` objects just to do this simple query.
r? @jdm
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/103)
<!-- Reviewable:end -->
Fix memory safety problem in `CGDataProvider::from_buffer()`.
The wrapper for that function made no attempt to ensure that the buffer
would stay alive, and as a result use-after-free could easily occur. The
fix is to require that the buffer be stuffed in an `Arc` box and to
teach Core Graphics how to release the `Arc` when it's done with it.
Related: #77. (This is basically a more minimal version of that PR. I had seen #77 but didn't realize that it was a memory safety problem! If you'd like to merge that PR instead, feel free.)
r? @jdm
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/101)
<!-- Reviewable:end -->
Add bindings to `CGContextSetFont(Size)` and `CGContextShowGlyphsAtPositions`.
These functions allow for a minor time savings by avoiding Core Text
font creation in the Pathfinder native rasterization functionality.
r? @jdm
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/102)
<!-- Reviewable:end -->
`CGContextShowGlyphsAtPositions`.
These functions allow for a minor time savings by avoiding Core Text
font creation in the Pathfinder native rasterization functionality.
The wrapper for that function made no attempt to ensure that the buffer
would stay alive, and as a result use-after-free could easily occur. The
fix is to require that the buffer be stuffed in an `Arc` box and to
teach Core Graphics how to release the `Arc` when it's done with it.
Add support for iOS targets
Only include `CGEvent` and `CGDisplay` on macOS, and link against `CoreGraphics` specifically, not the macOS umbrella framework.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/99)
<!-- Reviewable:end -->
Remove warnings for zero-sized structs
This change removes a bunch of warnings from the crate.
The only remaining warnings are due to the bitflags macro usage.
This will help fixservo/core-text-rs#62 when it upgrades to `core-graphics = 0.9`.
@jdm
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/90)
<!-- Reviewable:end -->
Adds an additional display function + bumps core-foundation dependency version
This is a small pull request, basically it adds the following things:
1. Adds a missing `CGDisplayCreateImage()` function, so that now the user has all required functions to capture static images (it was already implemented for window capturing and now the display capturing is also possible).
2. Adds a couple functions to `CGRect`.
3. Updates the version for `core-foundation` from `0.3` to `0.4`. I'm not sure if using `0.3` makes sense if we can use `0.4`. For me personally it was required to change it as my project depends on several crates, including the latest `core-foundation` version, so when I have both `core-graphics` and `core-foundation` in my dependencies, `core-foundation` has been compiled twice (once for `0.4` which is the new version and once for the old `0.3` which has been downloaded and compiled as one of the `core-graphics` dependencies). So basically the people who use the both `core-graphics` and `core-foundation` (the last versions) would encounter the same problems (`core-foundation` is compiled twice and it may cause compile time errors like it was in my case). What are your thoughts on these?
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/87)
<!-- Reviewable:end -->