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:
parent
bd6e5a99be
commit
26c4043aaf
3 changed files with 447 additions and 348 deletions
748
Cargo.lock
generated
748
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@ servo-fontconfig = { git = "https://github.com/jwilm/rust-fontconfig", branch =
|
||||||
freetype-rs = "0.13"
|
freetype-rs = "0.13"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
core-foundation = "0.5"
|
core-foundation = "0.6"
|
||||||
core-text = "9.1"
|
core-text = "13"
|
||||||
core-graphics = "0.13"
|
core-graphics = "0.17"
|
||||||
core-foundation-sys = "0.5"
|
core-foundation-sys = "0.6"
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#![allow(improper_ctypes)]
|
#![allow(improper_ctypes)]
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use ::{Slant, Weight, Style};
|
use ::{Slant, Weight, Style};
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ pub struct Descriptor {
|
||||||
font_name: String,
|
font_name: String,
|
||||||
style_name: String,
|
style_name: String,
|
||||||
display_name: String,
|
display_name: String,
|
||||||
font_path: String,
|
font_path: PathBuf,
|
||||||
|
|
||||||
ct_descriptor: CTFontDescriptor
|
ct_descriptor: CTFontDescriptor
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ impl Descriptor {
|
||||||
font_name: desc.font_name(),
|
font_name: desc.font_name(),
|
||||||
style_name: desc.style_name(),
|
style_name: desc.style_name(),
|
||||||
display_name: desc.display_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,
|
ct_descriptor: desc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,8 +335,10 @@ pub fn descriptors_for_family(family: &str) -> Vec<Descriptor> {
|
||||||
|
|
||||||
// CFArray of CTFontDescriptorRef (i think)
|
// CFArray of CTFontDescriptorRef (i think)
|
||||||
let descriptors = ct_collection.get_descriptors();
|
let descriptors = ct_collection.get_descriptors();
|
||||||
for descriptor in descriptors.iter() {
|
if let Some(descriptors) = descriptors {
|
||||||
out.push(Descriptor::new(descriptor.clone()));
|
for descriptor in descriptors.iter() {
|
||||||
|
out.push(Descriptor::new(descriptor.clone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out
|
out
|
||||||
|
@ -358,7 +361,7 @@ impl Descriptor {
|
||||||
// TODO fixme, hardcoded en for english
|
// TODO fixme, hardcoded en for english
|
||||||
let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()])
|
let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()])
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|desc| desc.font_path != "")
|
.filter(|desc| !desc.font_path.as_os_str().is_empty())
|
||||||
.map(|desc| desc.to_font(size, false))
|
.map(|desc| desc.to_font(size, false))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -442,12 +445,14 @@ impl Font {
|
||||||
|
|
||||||
let indices = [index as CGGlyph];
|
let indices = [index as CGGlyph];
|
||||||
|
|
||||||
self.ct_font.get_advances_for_glyphs(
|
unsafe {
|
||||||
FontOrientation::Default as _,
|
self.ct_font.get_advances_for_glyphs(
|
||||||
&indices[0],
|
FontOrientation::Default as _,
|
||||||
ptr::null_mut(),
|
&indices[0],
|
||||||
1
|
ptr::null_mut(),
|
||||||
)
|
1
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_glyph(&self, character: char, _size: f64, use_thin_strokes: bool) -> Result<RasterizedGlyph, Error> {
|
pub fn get_glyph(&self, character: char, _size: f64, use_thin_strokes: bool) -> Result<RasterizedGlyph, Error> {
|
||||||
|
@ -577,11 +582,13 @@ impl Font {
|
||||||
// always being a 0.
|
// always being a 0.
|
||||||
let mut glyphs:[CGGlyph; 2] = [0; 2];
|
let mut glyphs:[CGGlyph; 2] = [0; 2];
|
||||||
|
|
||||||
let res = self.ct_font.get_glyphs_for_characters(
|
let res = unsafe {
|
||||||
encoded.as_ptr(),
|
self.ct_font.get_glyphs_for_characters(
|
||||||
glyphs.as_mut_ptr(),
|
encoded.as_ptr(),
|
||||||
encoded.len() as CFIndex
|
glyphs.as_mut_ptr(),
|
||||||
);
|
encoded.len() as CFIndex
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
if res {
|
if res {
|
||||||
Some(u32::from(glyphs[0]))
|
Some(u32::from(glyphs[0]))
|
||||||
|
|
Loading…
Reference in a new issue