1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Update core-* dependencies

The core-* dependencies have been updated and every breaking
change has been resolved.

These are the main changes which required adaption:
- font_path() returns a PathBuf now
- get_descriptors() returns an Option<CFArray>
- get_advances_for_glyphs and get_glyphs_for_characters are now unsafe.

All packages which did not have breaking updates have also been updated.
This commit is contained in:
Jeff Muizelaar 2018-09-19 17:55:35 -04:00 committed by Christian Duerr
parent bd6e5a99be
commit 26c4043aaf
3 changed files with 447 additions and 348 deletions

748
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ servo-fontconfig = { git = "https://github.com/jwilm/rust-fontconfig", branch =
freetype-rs = "0.13"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.5"
core-text = "9.1"
core-graphics = "0.13"
core-foundation-sys = "0.5"
core-foundation = "0.6"
core-text = "13"
core-graphics = "0.17"
core-foundation-sys = "0.6"

View file

@ -18,6 +18,7 @@
#![allow(improper_ctypes)]
use std::collections::HashMap;
use std::ptr;
use std::path::PathBuf;
use ::{Slant, Weight, Style};
@ -56,7 +57,7 @@ pub struct Descriptor {
font_name: String,
style_name: String,
display_name: String,
font_path: String,
font_path: PathBuf,
ct_descriptor: CTFontDescriptor
}
@ -68,7 +69,7 @@ impl Descriptor {
font_name: desc.font_name(),
style_name: desc.style_name(),
display_name: desc.display_name(),
font_path: desc.font_path().unwrap_or_else(String::new),
font_path: desc.font_path().unwrap_or_else(PathBuf::new),
ct_descriptor: desc,
}
}
@ -334,9 +335,11 @@ pub fn descriptors_for_family(family: &str) -> Vec<Descriptor> {
// CFArray of CTFontDescriptorRef (i think)
let descriptors = ct_collection.get_descriptors();
if let Some(descriptors) = descriptors {
for descriptor in descriptors.iter() {
out.push(Descriptor::new(descriptor.clone()));
}
}
out
}
@ -358,7 +361,7 @@ impl Descriptor {
// TODO fixme, hardcoded en for english
let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()])
.into_iter()
.filter(|desc| desc.font_path != "")
.filter(|desc| !desc.font_path.as_os_str().is_empty())
.map(|desc| desc.to_font(size, false))
.collect::<Vec<_>>();
@ -442,6 +445,7 @@ impl Font {
let indices = [index as CGGlyph];
unsafe {
self.ct_font.get_advances_for_glyphs(
FontOrientation::Default as _,
&indices[0],
@ -449,6 +453,7 @@ impl Font {
1
)
}
}
pub fn get_glyph(&self, character: char, _size: f64, use_thin_strokes: bool) -> Result<RasterizedGlyph, Error> {
// Render custom symbols for underline and beam cursor
@ -577,11 +582,13 @@ impl Font {
// always being a 0.
let mut glyphs:[CGGlyph; 2] = [0; 2];
let res = self.ct_font.get_glyphs_for_characters(
let res = unsafe {
self.ct_font.get_glyphs_for_characters(
encoded.as_ptr(),
glyphs.as_mut_ptr(),
encoded.len() as CFIndex
);
)
};
if res {
Some(u32::from(glyphs[0]))