1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
diff --git a/src/lib.rs b/src/lib.rs
index c3fe58d..98dff02 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,6 +12,9 @@
//! services such as finding fonts on the system, performing nearest-font matching, and rasterizing
//! glyphs.
//!
+#![cfg_attr(
+ feature = "source",
+ doc = r##"
//! ## Synopsis
//!
//! # extern crate font_kit;
@@ -39,6 +42,8 @@
//! HintingOptions::None,
//! RasterizationOptions::GrayscaleAa)
//! .unwrap();
+"##
+)]
//!
//! ## Backends
//!
diff --git a/tests/tests.rs b/tests/tests.rs
index 2de6966..17f32da 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -180,97 +180,6 @@
);
}
-// Right now, only FreeType can do hinting.
-#[cfg(all(
- not(any(target_os = "macos", target_os = "ios", target_family = "windows")),
- feature = "loader-freetype-default",
- feature = "source"
-))]
-#[test]
-pub fn get_vertically_hinted_glyph_outline() {
- let font = SystemSource::new()
- .select_best_match(&[FamilyName::SansSerif], &Properties::new())
- .unwrap()
- .load()
- .unwrap();
- let glyph = font.glyph_for_char('i').expect("No glyph for char!");
- let mut outline_builder = OutlineBuilder::new();
- font.outline(glyph, HintingOptions::Vertical(16.0), &mut outline_builder)
- .unwrap();
-
- let outline = outline_builder.into_outline();
- assert_eq!(
- outline,
- Outline {
- contours: vec![
- Contour {
- positions: vec![
- Vector2F::new(136.0, 1316.0),
- Vector2F::new(136.0, 1536.0),
- Vector2F::new(316.0, 1536.0),
- Vector2F::new(316.0, 1316.0),
- ],
- flags: vec![PointFlags::empty(); 4],
- },
- Contour {
- positions: vec![
- Vector2F::new(136.0, 0.0),
- Vector2F::new(136.0, 1152.0),
- Vector2F::new(316.0, 1152.0),
- Vector2F::new(316.0, 0.0),
- ],
- flags: vec![PointFlags::empty(); 4],
- },
- ],
- }
- );
-}
-
-#[cfg(all(
- feature = "source",
- not(feature = "loader-freetype-default"),
- not(any(target_os = "macos", target_os = "ios", target_family = "windows"))
-))]
-#[test]
-pub fn get_vertically_hinted_glyph_outline() {
- let font = SystemSource::new()
- .select_best_match(&[FamilyName::SansSerif], &Properties::new())
- .unwrap()
- .load()
- .unwrap();
- let glyph = font.glyph_for_char('i').expect("No glyph for char!");
- let mut outline_builder = OutlineBuilder::new();
- font.outline(glyph, HintingOptions::Vertical(16.0), &mut outline_builder)
- .unwrap();
-
- let outline = outline_builder.into_outline();
- assert_eq!(
- outline,
- Outline {
- contours: vec![
- Contour {
- positions: vec![
- Vector2F::new(256.0, 1152.0),
- Vector2F::new(384.0, 1152.0),
- Vector2F::new(384.0, 0.0),
- Vector2F::new(256.0, 0.0),
- ],
- flags: vec![PointFlags::empty(); 4],
- },
- Contour {
- positions: vec![
- Vector2F::new(256.0, 1536.0),
- Vector2F::new(384.0, 1536.0),
- Vector2F::new(384.0, 1280.0),
- Vector2F::new(256.0, 1280.0),
- ],
- flags: vec![PointFlags::empty(); 4],
- },
- ],
- }
- );
-}
-
#[cfg(all(
feature = "source",
any(target_family = "windows", target_os = "macos", target_os = "ios")
|