mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
wezterm-font: remove font-kit dep
This wasn't used by anything and the version was getting pretty stale. Upgrading is awkward because newer versions pull in an incompatible freetype library version.
This commit is contained in:
parent
284a4ebfbb
commit
ea0d8d6f11
84
Cargo.lock
generated
84
Cargo.lock
generated
@ -133,15 +133,6 @@ version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
|
||||
dependencies = [
|
||||
"nodrop",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.1"
|
||||
@ -440,7 +431,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec 0.5.1",
|
||||
"arrayvec",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
@ -1126,12 +1117,6 @@ dependencies = [
|
||||
"miniz_oxide 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float-ord"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e"
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.9.1"
|
||||
@ -1150,30 +1135,6 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "font-kit"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09b6e2b877097ffd0abac6597fea26fccb5ed7eb9da0a4094f11ccc8aba64efb"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"core-foundation 0.7.0",
|
||||
"core-graphics 0.19.2",
|
||||
"core-text 15.0.0",
|
||||
"dirs 2.0.2",
|
||||
"dwrote",
|
||||
"euclid 0.20.14",
|
||||
"float-ord",
|
||||
"freetype 0.4.1",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"lyon_path",
|
||||
"servo-fontconfig",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "font-loader"
|
||||
version = "0.8.0"
|
||||
@ -1217,16 +1178,6 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "freetype"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11926b2b410b469d0e9399eca4cbbe237a9ef02176c485803b29216307e8e028"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"servo-freetype-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent"
|
||||
version = "0.4.0"
|
||||
@ -1480,7 +1431,7 @@ name = "harfbuzz"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"freetype 0.1.0",
|
||||
"freetype",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1731,7 +1682,7 @@ version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.1",
|
||||
"arrayvec",
|
||||
"bitflags 1.2.1",
|
||||
"cfg-if",
|
||||
"ryu",
|
||||
@ -1865,26 +1816,6 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_geom"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca04310c9807612a311506106000b6eccb2e27bca9bfb594ce80fb8a31231f9d"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.12",
|
||||
"euclid 0.20.14",
|
||||
"num-traits 0.2.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_path"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bcb57ac24a5428539e2c7c0592766d5933c937d703f430990c669c00de96862"
|
||||
dependencies = [
|
||||
"lyon_geom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzw"
|
||||
version = "0.10.0"
|
||||
@ -2134,12 +2065,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "5.1.2"
|
||||
@ -4142,10 +4067,9 @@ dependencies = [
|
||||
"core-text 15.0.0",
|
||||
"dwrote",
|
||||
"euclid 0.20.14",
|
||||
"font-kit",
|
||||
"font-loader",
|
||||
"fontconfig",
|
||||
"freetype 0.1.0",
|
||||
"freetype",
|
||||
"harfbuzz",
|
||||
"lazy_static",
|
||||
"log",
|
||||
|
@ -228,9 +228,6 @@ pub enum FontLocatorSelection {
|
||||
/// Use the fontloader crate to use a system specific method of
|
||||
/// resolving fonts
|
||||
FontLoader,
|
||||
/// Use the fontkit crate to use a different system specific
|
||||
/// method of resolving fonts
|
||||
FontKit,
|
||||
/// Use only the font_dirs configuration to locate fonts
|
||||
ConfigDirsOnly,
|
||||
}
|
||||
@ -261,7 +258,7 @@ impl FontLocatorSelection {
|
||||
}
|
||||
|
||||
pub fn variants() -> Vec<&'static str> {
|
||||
vec!["FontConfig", "FontLoader", "FontKit", "ConfigDirsOnly"]
|
||||
vec!["FontConfig", "FontLoader", "ConfigDirsOnly"]
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,7 +268,6 @@ impl std::str::FromStr for FontLocatorSelection {
|
||||
match s.to_lowercase().as_ref() {
|
||||
"fontconfig" => Ok(Self::FontConfig),
|
||||
"fontloader" => Ok(Self::FontLoader),
|
||||
"fontkit" => Ok(Self::FontKit),
|
||||
"configdirsonly" => Ok(Self::ConfigDirsOnly),
|
||||
_ => Err(anyhow!(
|
||||
"{} is not a valid FontLocatorSelection variant, possible values are {:?}",
|
||||
@ -285,7 +281,6 @@ impl std::str::FromStr for FontLocatorSelection {
|
||||
#[derive(Debug, Deserialize, Clone, Copy)]
|
||||
pub enum FontRasterizerSelection {
|
||||
FreeType,
|
||||
FontKit,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@ -310,7 +305,7 @@ impl FontRasterizerSelection {
|
||||
}
|
||||
|
||||
pub fn variants() -> Vec<&'static str> {
|
||||
vec!["FreeType", "FontKit"]
|
||||
vec!["FreeType"]
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +314,6 @@ impl std::str::FromStr for FontRasterizerSelection {
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_lowercase().as_ref() {
|
||||
"freetype" => Ok(Self::FreeType),
|
||||
"fontkit" => Ok(Self::FontKit),
|
||||
_ => Err(anyhow!(
|
||||
"{} is not a valid FontRasterizerSelection variant, possible values are {:?}",
|
||||
s,
|
||||
|
@ -32,7 +32,6 @@ fontconfig = { path = "../deps/fontconfig" }
|
||||
# our newer font related deps, so we avoid it on linux
|
||||
[target.'cfg(any(windows, target_os = "macos"))'.dependencies]
|
||||
font-loader = { version = "0.8" }
|
||||
font-kit = "0.5"
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
dwrote = "0.9"
|
||||
|
@ -159,16 +159,6 @@ impl Font {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn new_from_fontkit(font: &font_kit::font::Font) -> Font {
|
||||
Self::new_directwrite(&font.native_font().dwrite_font_face)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn new_from_fontkit(font: &font_kit::font::Font) -> Font {
|
||||
Self::new_coretext(&font.native_font())
|
||||
}
|
||||
|
||||
/// Create a font from raw data
|
||||
/// Harfbuzz doesn't know how to interpret this without registering
|
||||
/// some callbacks
|
||||
|
@ -1,48 +0,0 @@
|
||||
use crate::locator::{FontDataHandle, FontLocator};
|
||||
use ::font_kit::family_name::FamilyName;
|
||||
use ::font_kit::handle::Handle;
|
||||
use ::font_kit::properties::Properties;
|
||||
use ::font_kit::source::Source;
|
||||
use config::FontAttributes;
|
||||
use std::collections::HashSet;
|
||||
|
||||
/// A FontLocator implemented using the font loading
|
||||
/// functions provided by Source's from font-kit crate.
|
||||
impl<S> FontLocator for S
|
||||
where
|
||||
S: Source,
|
||||
{
|
||||
fn load_fonts(
|
||||
&self,
|
||||
fonts_selection: &[FontAttributes],
|
||||
loaded: &mut HashSet<FontAttributes>,
|
||||
) -> anyhow::Result<Vec<FontDataHandle>> {
|
||||
let mut handles = vec![];
|
||||
|
||||
for font in fonts_selection {
|
||||
let mut props = Properties::new();
|
||||
if font.bold {
|
||||
props.weight(font_kit::properties::Weight::BOLD);
|
||||
}
|
||||
if font.italic {
|
||||
props.style(font_kit::properties::Style::Italic);
|
||||
}
|
||||
let family = FamilyName::Title(font.family.clone());
|
||||
match self.select_best_match(&[family.clone()], &props) {
|
||||
Ok(Handle::Path { path, font_index }) => handles.push(FontDataHandle::OnDisk {
|
||||
path,
|
||||
index: font_index,
|
||||
}),
|
||||
Ok(Handle::Memory { bytes, font_index }) => handles.push(FontDataHandle::Memory {
|
||||
data: bytes.to_vec(),
|
||||
index: font_index,
|
||||
name: font.family.clone(),
|
||||
}),
|
||||
Err(_) => continue,
|
||||
}
|
||||
loaded.insert(font.clone());
|
||||
}
|
||||
|
||||
Ok(handles)
|
||||
}
|
||||
}
|
@ -5,8 +5,6 @@ use std::path::PathBuf;
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
pub mod font_config;
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
pub mod font_kit;
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
pub mod font_loader;
|
||||
|
||||
/// Represents the data behind a font.
|
||||
@ -71,12 +69,6 @@ pub fn new_locator(locator: FontLocatorSelection) -> Box<dyn FontLocator> {
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
panic!("fontloader not compiled in");
|
||||
}
|
||||
FontLocatorSelection::FontKit => {
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
return Box::new(::font_kit::source::SystemSource::new());
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
panic!("fontkit not compiled in");
|
||||
}
|
||||
FontLocatorSelection::ConfigDirsOnly => Box::new(NopSystemSource {}),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::locator::FontDataHandle;
|
||||
use crate::units::*;
|
||||
use anyhow::bail;
|
||||
|
||||
pub mod freetype;
|
||||
|
||||
@ -36,6 +35,5 @@ pub fn new_rasterizer(
|
||||
FontRasterizerSelection::FreeType => Ok(Box::new(
|
||||
freetype::FreeTypeRasterizer::from_locator(handle)?,
|
||||
)),
|
||||
FontRasterizerSelection::FontKit => bail!("FontKit rasterizer not implemented yet"),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user