Make FreeType no longer a dependency of `path-utils`

This commit is contained in:
Patrick Walton 2017-10-04 19:03:38 -07:00
parent 8de1970682
commit b6a60ef987
5 changed files with 7 additions and 27 deletions

View File

@ -6,13 +6,9 @@ authors = ["Patrick Walton <pcwalton@mimiga.net>"]
[dependencies] [dependencies]
app_units = "0.5" app_units = "0.5"
euclid = "0.15" euclid = "0.15"
freetype-sys = "0.6"
log = "0.3" log = "0.3"
[dependencies.freetype-sys]
git = "https://github.com/pcwalton/freetype-sys.git"
branch = "stroker"
rev = "11c67b2a215ec5d1aefd465a9b0560b9784ca672"
[dependencies.pathfinder_path_utils] [dependencies.pathfinder_path_utils]
path = "../path-utils" path = "../path-utils"

View File

@ -19,7 +19,6 @@ use freetype_sys::{FT_GlyphSlot, FT_Init_FreeType, FT_Int32, FT_LOAD_NO_HINTING,
use freetype_sys::{FT_Load_Glyph, FT_Long, FT_New_Memory_Face, FT_Outline_Get_CBox}; use freetype_sys::{FT_Load_Glyph, FT_Long, FT_New_Memory_Face, FT_Outline_Get_CBox};
use freetype_sys::{FT_Set_Char_Size, FT_UInt}; use freetype_sys::{FT_Set_Char_Size, FT_UInt};
use pathfinder_path_utils::PathCommand; use pathfinder_path_utils::PathCommand;
use pathfinder_path_utils::freetype::OutlineStream;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::collections::btree_map::Entry; use std::collections::btree_map::Entry;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -27,6 +26,10 @@ use std::mem;
use std::ptr; use std::ptr;
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
use outline::OutlineStream;
mod outline;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

View File

@ -1,4 +1,4 @@
// pathfinder/path-utils/src/freetype.rs // pathfinder/font-renderer/src/outline.rs
// //
// Copyright © 2017 The Pathfinder Project Developers. // Copyright © 2017 The Pathfinder Project Developers.
// //
@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use euclid::Point2D; use euclid::Point2D;
use freetype_sys::{FT_Fixed, FT_Outline, FT_Pos, FT_Vector}; use freetype_sys::{FT_Outline, FT_Vector};
use PathCommand; use PathCommand;
@ -111,16 +111,3 @@ impl<'a> Iterator for OutlineStream<'a> {
fn ft_vector_to_f32(ft_vector: FT_Vector) -> Point2D<f32> { fn ft_vector_to_f32(ft_vector: FT_Vector) -> Point2D<f32> {
Point2D::new(ft_vector.x as f32 / 64.0, ft_vector.y as f32 / 64.0) Point2D::new(ft_vector.x as f32 / 64.0, ft_vector.y as f32 / 64.0)
} }
#[inline]
pub fn f32_to_ft_vector(point: &Point2D<f32>) -> FT_Vector {
FT_Vector {
x: (point.x * 64.0).round() as FT_Pos,
y: (point.y * 64.0).round() as FT_Pos,
}
}
#[inline]
pub fn f32_to_26_6_ft_fixed(length: f32) -> FT_Fixed {
(length * 64.0).round() as FT_Fixed
}

View File

@ -8,7 +8,3 @@ arrayvec = "0.4"
euclid = "0.15" euclid = "0.15"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
[dependencies.freetype-sys]
git = "https://github.com/pcwalton/freetype-sys.git"
branch = "stroker"

View File

@ -10,7 +10,6 @@
extern crate arrayvec; extern crate arrayvec;
extern crate euclid; extern crate euclid;
extern crate freetype_sys;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
@ -21,7 +20,6 @@ use std::u32;
pub mod cubic; pub mod cubic;
pub mod curve; pub mod curve;
pub mod freetype;
pub mod intersection; pub mod intersection;
pub mod line; pub mod line;
pub mod monotonic; pub mod monotonic;