summaryrefslogtreecommitdiffstats
path: root/font
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2018-09-30 16:44:14 -0400
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-09-30 20:44:14 +0000
commitf785f88a58daa3919255a268fa1da62aa07f13a7 (patch)
treea5989c6ccc924739f5c48330d8bd26b64bc7a47b /font
parente01317d88593af7874da13c2043aa53336fb2d73 (diff)
Bump fontconfig dependencies
The patch uses the Cargo.toml patch section to force a single downstream choice of freetype-sys instead of relying on forks of other crates. It also bumps the fontconfig/freetype dependencies in the process.
Diffstat (limited to 'font')
-rw-r--r--font/Cargo.toml4
-rw-r--r--font/src/ft/mod.rs29
2 files changed, 14 insertions, 19 deletions
diff --git a/font/Cargo.toml b/font/Cargo.toml
index df495b61..a0c524b8 100644
--- a/font/Cargo.toml
+++ b/font/Cargo.toml
@@ -12,8 +12,8 @@ foreign-types = "0.3"
log = "0.4"
[target.'cfg(not(target_os = "macos"))'.dependencies]
-servo-fontconfig = { git = "https://github.com/jwilm/rust-fontconfig", branch = "updated-2017-10-8" }
-freetype-rs = "0.13"
+servo-fontconfig = "0.4.0"
+freetype-rs = "0.19"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.6"
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 9ace5b0c..51c304f2 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -31,7 +31,7 @@ struct FixedSize {
}
struct Face {
- ft_face: freetype::Face<'static>,
+ ft_face: freetype::Face,
key: FontKey,
load_flags: freetype::face::LoadFlag,
render_mode: freetype::RenderMode,
@@ -365,12 +365,11 @@ impl FreeTypeRasterizer {
let hinting = pat.hintstyle().next().unwrap_or(fc::HintStyle::Slight);
let rgba = pat.rgba().next().unwrap_or(fc::Rgba::Unknown);
- use freetype::face::*;
-
+ use freetype::face::LoadFlag;
match (antialias, hinting, rgba) {
- (false, fc::HintStyle::None, _) => NO_HINTING | MONOCHROME,
- (false, _, _) => TARGET_MONO | MONOCHROME,
- (true, fc::HintStyle::None, _) => NO_HINTING | TARGET_NORMAL,
+ (false, fc::HintStyle::None, _) => LoadFlag::NO_HINTING | LoadFlag::MONOCHROME,
+ (false, _, _) => LoadFlag::TARGET_MONO | LoadFlag::MONOCHROME,
+ (true, fc::HintStyle::None, _) => LoadFlag::NO_HINTING | LoadFlag::TARGET_NORMAL,
// hintslight does *not* use LCD hinting even when a subpixel mode
// is selected.
//
@@ -385,19 +384,17 @@ impl FreeTypeRasterizer {
// subpixel render modes like `FT_RENDER_MODE_LCD`. Libraries like
// cairo take the same approach and consider `hintslight` to always
// prefer `FT_LOAD_TARGET_LIGHT`
- (true, fc::HintStyle::Slight, _) => TARGET_LIGHT,
+ (true, fc::HintStyle::Slight, _) => LoadFlag::TARGET_LIGHT,
// If LCD hinting is to be used, must select hintmedium or hintfull,
// have AA enabled, and select a subpixel mode.
- (true, _, fc::Rgba::Rgb) |
- (true, _, fc::Rgba::Bgr) => TARGET_LCD,
- (true, _, fc::Rgba::Vrgb) |
- (true, _, fc::Rgba::Vbgr) => TARGET_LCD_V,
+ (true, _, fc::Rgba::Rgb) | (true, _, fc::Rgba::Bgr) => LoadFlag::TARGET_LCD,
+ (true, _, fc::Rgba::Vrgb) | (true, _, fc::Rgba::Vbgr) => LoadFlag::TARGET_LCD_V,
// For non-rgba modes with either Medium or Full hinting, just use
// the default hinting algorithm.
//
// TODO should Medium/Full control whether to use the auto hinter?
- (true, _, fc::Rgba::Unknown) => TARGET_NORMAL,
- (true, _, fc::Rgba::None) => TARGET_NORMAL,
+ (true, _, fc::Rgba::Unknown) => LoadFlag::TARGET_NORMAL,
+ (true, _, fc::Rgba::None) => LoadFlag::TARGET_NORMAL,
}
}
@@ -407,10 +404,8 @@ impl FreeTypeRasterizer {
match (antialias, rgba) {
(false, _) => freetype::RenderMode::Mono,
- (_, fc::Rgba::Rgb) |
- (_, fc::Rgba::Bgr) => freetype::RenderMode::Lcd,
- (_, fc::Rgba::Vrgb) |
- (_, fc::Rgba::Vbgr) => freetype::RenderMode::LcdV,
+ (_, fc::Rgba::Rgb) | (_, fc::Rgba::Bgr) => freetype::RenderMode::Lcd,
+ (_, fc::Rgba::Vrgb) | (_, fc::Rgba::Vbgr) => freetype::RenderMode::LcdV,
(true, _) => freetype::RenderMode::Normal,
}
}