diff options
author | Martin Algesten <martin@algesten.se> | 2017-05-31 19:22:49 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-06-01 09:47:58 -0700 |
commit | 1fb2c843be3a63eef15c276be0400f8fe5f2b648 (patch) | |
tree | d60952e9d18523eca41944d41763de5ab92c8e55 /font | |
parent | d5ab4183c69e37e8d309acf7b38c2071106bceb7 (diff) | |
download | alacritty-1fb2c843be3a63eef15c276be0400f8fe5f2b648.tar.gz alacritty-1fb2c843be3a63eef15c276be0400f8fe5f2b648.zip |
final core-graphics extensions moved upstream
Diffstat (limited to 'font')
-rw-r--r-- | font/Cargo.toml | 7 | ||||
-rw-r--r-- | font/src/darwin/mod.rs | 27 |
2 files changed, 4 insertions, 30 deletions
diff --git a/font/Cargo.toml b/font/Cargo.toml index f1cb4492..17ba78ed 100644 --- a/font/Cargo.toml +++ b/font/Cargo.toml @@ -17,9 +17,6 @@ freetype-rs = "0.13.0" [target.'cfg(target_os = "macos")'.dependencies] core-foundation = "0.3.0" -core-graphics = "0.7.0" +core-text = "5.0.0" +core-graphics = "0.8.1" core-foundation-sys = "0.3.1" - -[target.'cfg(target_os = "macos")'.dependencies.core-text] -git = "https://github.com/servo/core-text-rs" -rev = "7a267bc8f6c098f5370583333a5fd00a0d12fb83" diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs index 2d354152..84fc4ff9 100644 --- a/font/src/darwin/mod.rs +++ b/font/src/darwin/mod.rs @@ -27,7 +27,7 @@ use core_foundation::array::CFIndex; use core_foundation_sys::string::UniChar; use core_graphics::base::kCGImageAlphaPremultipliedFirst; use core_graphics::color_space::CGColorSpace; -use core_graphics::context::{CGContext, CGContextRef}; +use core_graphics::context::{CGContext}; use core_graphics::font::{CGFont, CGGlyph}; use core_graphics::geometry::{CGPoint, CGRect, CGSize}; use core_text::font::{CTFont, new_from_descriptor as ct_new_from_descriptor}; @@ -39,8 +39,6 @@ use core_text::font_descriptor::kCTFontVerticalOrientation; use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; use core_text::font_descriptor::SymbolicTraitAccessors; -use libc::{c_int}; - use euclid::point::Point2D; use euclid::rect::Rect; use euclid::size::Size2D; @@ -380,6 +378,7 @@ impl Font { } let mut cg_context = CGContext::create_bitmap_context( + None, rasterized_width as usize, rasterized_height as usize, 8, // bits per component @@ -456,28 +455,6 @@ impl Font { } } -/// Additional methods needed to render fonts for Alacritty -/// -/// TODO CGContextSetFontSmoothingStyle has been upstreamed in -/// core-graphics 0.8.0, but core-text must be bumped before we -/// can use it. -pub trait CGContextExt { - fn set_font_smoothing_style(&self, style: i32); -} - -impl CGContextExt for CGContext { - fn set_font_smoothing_style(&self, style: i32) { - unsafe { - CGContextSetFontSmoothingStyle(self.as_concrete_TypeRef(), style as _); - } - } -} - -#[link(name = "ApplicationServices", kind = "framework")] -extern { - fn CGContextSetFontSmoothingStyle(c: CGContextRef, style: c_int); -} - #[cfg(test)] mod tests { #[test] |