aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'components/gfx')
-rw-r--r--components/gfx/lib.rs59
-rw-r--r--components/gfx/platform/windows/font_context.rs2
-rw-r--r--components/gfx/tests/font_context.rs8
-rw-r--r--components/gfx/tests/font_template.rs7
-rw-r--r--components/gfx/tests/text_util.rs2
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs54
-rw-r--r--components/gfx/text/shaping/mod.rs2
7 files changed, 32 insertions, 102 deletions
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index 442a9c8ae3a..24dbcde26cb 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -4,75 +4,16 @@
#![deny(unsafe_code)]
-extern crate app_units;
#[macro_use]
extern crate bitflags;
-
-// Mac OS-specific library dependencies
-#[cfg(target_os = "macos")]
-extern crate byteorder;
-#[cfg(target_os = "macos")]
-extern crate core_foundation;
-#[cfg(target_os = "macos")]
-extern crate core_graphics;
-#[cfg(target_os = "macos")]
-extern crate core_text;
-
-// Windows-specific library dependencies
-#[cfg(target_os = "windows")]
-extern crate dwrote;
-
-extern crate euclid;
-extern crate fnv;
-
-#[cfg(target_os = "linux")]
-extern crate fontconfig;
-extern crate fontsan;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-extern crate freetype;
-extern crate gfx_traits;
-
-// Eventually we would like the shaper to be pluggable, as many operating systems have their own
-// shapers. For now, however, this is a hard dependency.
-extern crate harfbuzz_sys as harfbuzz;
-
-extern crate ipc_channel;
#[macro_use]
extern crate lazy_static;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-extern crate libc;
#[macro_use]
extern crate log;
-#[cfg_attr(target_os = "windows", macro_use)]
-extern crate malloc_size_of;
-extern crate net_traits;
-extern crate ordered_float;
-#[cfg(all(
- feature = "unstable",
- any(target_feature = "sse2", target_feature = "neon")
-))]
-extern crate packed_simd;
-extern crate range;
#[macro_use]
extern crate serde;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-extern crate servo_allocator;
-extern crate servo_arc;
#[macro_use]
extern crate servo_atoms;
-extern crate servo_url;
-extern crate smallvec;
-extern crate style;
-extern crate time;
-#[cfg(target_os = "windows")]
-extern crate truetype;
-extern crate ucd;
-extern crate unicode_bidi;
-extern crate unicode_script;
-extern crate webrender_api;
-extern crate xi_unicode;
-#[cfg(target_os = "android")]
-extern crate xml5ever;
// Fonts
#[macro_use]
diff --git a/components/gfx/platform/windows/font_context.rs b/components/gfx/platform/windows/font_context.rs
index 7d304ed138d..400988d032f 100644
--- a/components/gfx/platform/windows/font_context.rs
+++ b/components/gfx/platform/windows/font_context.rs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use malloc_size_of::malloc_size_of_is_0;
+
#[derive(Clone, Debug)]
pub struct FontContextHandle;
diff --git a/components/gfx/tests/font_context.rs b/components/gfx/tests/font_context.rs
index d4dea69597d..6be4cbe263b 100644
--- a/components/gfx/tests/font_context.rs
+++ b/components/gfx/tests/font_context.rs
@@ -2,13 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-extern crate app_units;
-extern crate gfx;
-extern crate servo_arc;
-extern crate servo_atoms;
-extern crate style;
-extern crate webrender_api;
-
use app_units::Au;
use gfx::font::{
fallback_font_families, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope,
@@ -31,6 +24,7 @@ use style::values::computed::font::{
};
use style::values::computed::font::{FontStretch, FontWeight, SingleFontFamily};
use style::values::generics::font::FontStyle;
+use webrender_api;
struct TestFontSource {
handle: FontContextHandle,
diff --git a/components/gfx/tests/font_template.rs b/components/gfx/tests/font_template.rs
index 8d1935f738d..132e067cf1a 100644
--- a/components/gfx/tests/font_template.rs
+++ b/components/gfx/tests/font_template.rs
@@ -2,13 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#[cfg(not(target_os = "macos"))]
-extern crate gfx;
-#[cfg(not(target_os = "macos"))]
-extern crate servo_atoms;
-#[cfg(not(target_os = "macos"))]
-extern crate style;
-
// Test doesn't yet run on Mac, see https://github.com/servo/servo/pull/19928 for explanation.
#[cfg(not(target_os = "macos"))]
#[test]
diff --git a/components/gfx/tests/text_util.rs b/components/gfx/tests/text_util.rs
index c35a06a2e2f..297823041d8 100644
--- a/components/gfx/tests/text_util.rs
+++ b/components/gfx/tests/text_util.rs
@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-extern crate gfx;
-
use gfx::text::util::{transform_text, CompressionMode};
#[test]
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index 675c57b4615..ecd575d9b91 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -6,37 +6,39 @@
use app_units::Au;
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
-use crate::harfbuzz::hb_blob_t;
-use crate::harfbuzz::hb_bool_t;
-use crate::harfbuzz::hb_buffer_add_utf8;
-use crate::harfbuzz::hb_buffer_destroy;
-use crate::harfbuzz::hb_buffer_get_glyph_positions;
-use crate::harfbuzz::hb_buffer_get_length;
-use crate::harfbuzz::hb_face_destroy;
-use crate::harfbuzz::hb_feature_t;
-use crate::harfbuzz::hb_font_create;
-use crate::harfbuzz::hb_font_funcs_create;
-use crate::harfbuzz::hb_font_funcs_set_glyph_h_advance_func;
-use crate::harfbuzz::hb_font_funcs_set_glyph_h_kerning_func;
-use crate::harfbuzz::hb_font_funcs_set_nominal_glyph_func;
-use crate::harfbuzz::hb_font_set_funcs;
-use crate::harfbuzz::hb_font_set_ppem;
-use crate::harfbuzz::hb_font_set_scale;
-use crate::harfbuzz::hb_glyph_info_t;
-use crate::harfbuzz::hb_glyph_position_t;
-use crate::harfbuzz::{hb_blob_create, hb_face_create_for_tables};
-use crate::harfbuzz::{hb_buffer_create, hb_font_destroy};
-use crate::harfbuzz::{hb_buffer_get_glyph_infos, hb_shape};
-use crate::harfbuzz::{hb_buffer_set_direction, hb_buffer_set_script};
-use crate::harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t};
-use crate::harfbuzz::{hb_face_t, hb_font_t};
-use crate::harfbuzz::{hb_position_t, hb_tag_t};
-use crate::harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
use crate::platform::font::FontTable;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods;
use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
use euclid::Point2D;
+// Eventually we would like the shaper to be pluggable, as many operating systems have their own
+// shapers. For now, however, HarfBuzz is a hard dependency.
+use harfbuzz_sys::hb_blob_t;
+use harfbuzz_sys::hb_bool_t;
+use harfbuzz_sys::hb_buffer_add_utf8;
+use harfbuzz_sys::hb_buffer_destroy;
+use harfbuzz_sys::hb_buffer_get_glyph_positions;
+use harfbuzz_sys::hb_buffer_get_length;
+use harfbuzz_sys::hb_face_destroy;
+use harfbuzz_sys::hb_feature_t;
+use harfbuzz_sys::hb_font_create;
+use harfbuzz_sys::hb_font_funcs_create;
+use harfbuzz_sys::hb_font_funcs_set_glyph_h_advance_func;
+use harfbuzz_sys::hb_font_funcs_set_glyph_h_kerning_func;
+use harfbuzz_sys::hb_font_funcs_set_nominal_glyph_func;
+use harfbuzz_sys::hb_font_set_funcs;
+use harfbuzz_sys::hb_font_set_ppem;
+use harfbuzz_sys::hb_font_set_scale;
+use harfbuzz_sys::hb_glyph_info_t;
+use harfbuzz_sys::hb_glyph_position_t;
+use harfbuzz_sys::{hb_blob_create, hb_face_create_for_tables};
+use harfbuzz_sys::{hb_buffer_create, hb_font_destroy};
+use harfbuzz_sys::{hb_buffer_get_glyph_infos, hb_shape};
+use harfbuzz_sys::{hb_buffer_set_direction, hb_buffer_set_script};
+use harfbuzz_sys::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t};
+use harfbuzz_sys::{hb_face_t, hb_font_t};
+use harfbuzz_sys::{hb_position_t, hb_tag_t};
+use harfbuzz_sys::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
use std::os::raw::{c_char, c_int, c_uint, c_void};
use std::{char, cmp, ptr};
diff --git a/components/gfx/text/shaping/mod.rs b/components/gfx/text/shaping/mod.rs
index 8c59c13427a..9f78c0d75ac 100644
--- a/components/gfx/text/shaping/mod.rs
+++ b/components/gfx/text/shaping/mod.rs
@@ -10,7 +10,7 @@
use crate::font::ShapingOptions;
use crate::text::glyph::GlyphStore;
-pub use crate::text::shaping::harfbuzz::Shaper;
+pub use self::harfbuzz::Shaper;
pub mod harfbuzz;