diff options
Diffstat (limited to 'components/gfx')
-rw-r--r-- | components/gfx/Cargo.toml | 2 | ||||
-rw-r--r-- | components/gfx/font.rs | 22 | ||||
-rw-r--r-- | components/gfx/font_cache_thread.rs | 18 | ||||
-rw-r--r-- | components/gfx/font_context.rs | 10 | ||||
-rw-r--r-- | components/gfx/font_template.rs | 8 | ||||
-rw-r--r-- | components/gfx/platform/freetype/android/font_list.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/freetype/font.rs | 12 | ||||
-rw-r--r-- | components/gfx/platform/freetype/font_list.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/macos/font.rs | 10 | ||||
-rw-r--r-- | components/gfx/platform/macos/font_list.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/mod.rs | 8 | ||||
-rw-r--r-- | components/gfx/platform/windows/font.rs | 12 | ||||
-rw-r--r-- | components/gfx/platform/windows/font_list.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/windows/font_template.rs | 2 | ||||
-rw-r--r-- | components/gfx/text/mod.rs | 4 | ||||
-rw-r--r-- | components/gfx/text/shaping/harfbuzz.rs | 62 | ||||
-rw-r--r-- | components/gfx/text/shaping/mod.rs | 6 | ||||
-rw-r--r-- | components/gfx/text/text_run.rs | 8 |
18 files changed, 96 insertions, 96 deletions
diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index a657d802ea0..a58a9880715 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -37,7 +37,7 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_url = {path = "../url"} smallvec = { version = "0.6", features = ["std", "union"] } -style = {path = "../style"} +style = {path = "../style", features = ["servo"]} time = "0.1.12" unicode-bidi = {version = "0.3", features = ["with_serde"]} unicode-script = {version = "0.2", features = ["harfbuzz"]} diff --git a/components/gfx/font.rs b/components/gfx/font.rs index a3591e3b41a..18188bc9f2d 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -4,13 +4,13 @@ use app_units::Au; use euclid::{Point2D, Rect, Size2D}; -use font_context::{FontContext, FontSource}; -use font_template::FontTemplateDescriptor; +use crate::font_context::{FontContext, FontSource}; +use crate::font_template::FontTemplateDescriptor; use ordered_float::NotNan; -use platform::font::{FontHandle, FontTable}; -use platform::font_context::FontContextHandle; -pub use platform::font_list::fallback_font_families; -use platform::font_template::FontTemplateData; +use crate::platform::font::{FontHandle, FontTable}; +use crate::platform::font_context::FontContextHandle; +pub use crate::platform::font_list::fallback_font_families; +use crate::platform::font_template::FontTemplateData; use servo_atoms::Atom; use smallvec::SmallVec; use std::borrow::ToOwned; @@ -24,9 +24,9 @@ use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight}; use style::properties::style_structs::Font as FontStyleStruct; use style::values::computed::font::SingleFontFamily; -use text::Shaper; -use text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; -use text::shaping::ShaperMethods; +use crate::text::Shaper; +use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; +use crate::text::shaping::ShaperMethods; use time; use unicode_script::Script; use webrender_api; @@ -64,13 +64,13 @@ pub trait FontHandleMethods: Sized { fn stretchiness(&self) -> font_stretch::T; fn glyph_index(&self, codepoint: char) -> Option<GlyphId>; - fn glyph_h_advance(&self, GlyphId) -> Option<FractionalPixel>; + fn glyph_h_advance(&self, _: GlyphId) -> Option<FractionalPixel>; fn glyph_h_kerning(&self, glyph0: GlyphId, glyph1: GlyphId) -> FractionalPixel; /// Can this font do basic horizontal LTR shaping without Harfbuzz? fn can_do_fast_shaping(&self) -> bool; fn metrics(&self) -> FontMetrics; - fn table_for_tag(&self, FontTableTag) -> Option<FontTable>; + fn table_for_tag(&self, _: FontTableTag) -> Option<FontTable>; /// A unique identifier for the font, allowing comparison. fn identifier(&self) -> Atom; diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index 4bfa3e6dfc2..0e4c7727997 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -3,19 +3,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; -use font_context::FontSource; -use font_template::{FontTemplate, FontTemplateDescriptor}; +use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; +use crate::font_context::FontSource; +use crate::font_template::{FontTemplate, FontTemplateDescriptor}; use fontsan; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use net_traits::{CoreResourceThread, FetchResponseMsg, fetch_async}; use net_traits::request::{Destination, RequestInit}; -use platform::font_context::FontContextHandle; -use platform::font_list::SANS_SERIF_FONT_FAMILY; -use platform::font_list::for_each_available_family; -use platform::font_list::for_each_variation; -use platform::font_list::system_default_family; -use platform::font_template::FontTemplateData; +use crate::platform::font_context::FontContextHandle; +use crate::platform::font_list::SANS_SERIF_FONT_FAMILY; +use crate::platform::font_list::for_each_available_family; +use crate::platform::font_list::for_each_variation; +use crate::platform::font_list::system_default_family; +use crate::platform::font_template::FontTemplateData; use servo_atoms::Atom; use servo_url::ServoUrl; use std::{fmt, f32, mem, thread}; diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 6cb4d8e7ed6..7356edaa4a6 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -4,12 +4,12 @@ use app_units::Au; use fnv::FnvHasher; -use font::{Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef}; -use font_cache_thread::FontTemplateInfo; -use font_template::FontTemplateDescriptor; +use crate::font::{Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef}; +use crate::font_cache_thread::FontTemplateInfo; +use crate::font_template::FontTemplateDescriptor; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -use platform::font::FontHandle; -pub use platform::font_context::FontContextHandle; +use crate::platform::font::FontHandle; +pub use crate::platform::font_context::FontContextHandle; use servo_arc::Arc; use std::cell::RefCell; use std::collections::HashMap; diff --git a/components/gfx/font_template.rs b/components/gfx/font_template.rs index 80527dfae38..0285cfc9dde 100644 --- a/components/gfx/font_template.rs +++ b/components/gfx/font_template.rs @@ -2,10 +2,10 @@ * 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 font::FontHandleMethods; -use platform::font::FontHandle; -use platform::font_context::FontContextHandle; -use platform::font_template::FontTemplateData; +use crate::font::FontHandleMethods; +use crate::platform::font::FontHandle; +use crate::platform::font_context::FontContextHandle; +use crate::platform::font_template::FontTemplateData; use servo_atoms::Atom; use std::fmt::{Debug, Error, Formatter}; use std::io::Error as IoError; diff --git a/components/gfx/platform/freetype/android/font_list.rs b/components/gfx/platform/freetype/android/font_list.rs index 9cf9c512e09..940283c55c5 100644 --- a/components/gfx/platform/freetype/android/font_list.rs +++ b/components/gfx/platform/freetype/android/font_list.rs @@ -6,7 +6,7 @@ use std::cell::RefCell; use std::fs::File; use std::io::{self, Read}; use std::path::Path; -use text::util::is_cjk; +use crate::text::util::is_cjk; use ucd::{Codepoint, UnicodeBlock}; use xml5ever::Attribute; use xml5ever::driver::parse_document; diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index c774728fef0..b3762b26fe7 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use font::{FontHandleMethods, FontMetrics, FontTableMethods}; -use font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN}; +use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; +use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN}; use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face}; use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec}; use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name}; @@ -16,8 +16,8 @@ use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector}; use freetype::freetype::FT_Sfnt_Tag; use freetype::succeeded; use freetype::tt_os2::TT_OS2; -use platform::font_context::FontContextHandle; -use platform::font_template::FontTemplateData; +use crate::platform::font_context::FontContextHandle; +use crate::platform::font_template::FontTemplateData; use servo_atoms::Atom; use std::{mem, ptr}; use std::ffi::CString; @@ -27,8 +27,8 @@ use style::computed_values::font_stretch::T as FontStretch; use style::computed_values::font_weight::T as FontWeight; use style::values::computed::font::FontStyle; use super::c_str_to_string; -use text::glyph::GlyphId; -use text::util::fixed_to_float; +use crate::text::glyph::GlyphId; +use crate::text::util::fixed_to_float; // This constant is not present in the freetype // bindings due to bindgen not handling the way diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index e1ef486fa43..378f2f1944c 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -13,7 +13,7 @@ use libc::{c_char, c_int}; use std::ffi::CString; use std::ptr; use super::c_str_to_string; -use text::util::is_cjk; +use crate::text::util::is_cjk; static FC_FAMILY: &'static [u8] = b"family\0"; static FC_FILE: &'static [u8] = b"file\0"; diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index dca2175c5ab..6e0bb05c1ef 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -13,16 +13,16 @@ use core_graphics::geometry::CGRect; use core_text::font::CTFont; use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors}; use core_text::font_descriptor::kCTFontDefaultOrientation; -use font::{FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel}; -use font::{GPOS, GSUB, KERN}; -use platform::font_template::FontTemplateData; -use platform::macos::font_context::FontContextHandle; +use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel}; +use crate::font::{GPOS, GSUB, KERN}; +use crate::platform::font_template::FontTemplateData; +use crate::platform::macos::font_context::FontContextHandle; use servo_atoms::Atom; use std::{fmt, ptr}; use std::ops::Range; use std::sync::Arc; use style::values::computed::font::{FontStretch, FontStyle, FontWeight}; -use text::glyph::GlyphId; +use crate::text::glyph::GlyphId; const KERN_PAIR_LEN: usize = 6; diff --git a/components/gfx/platform/macos/font_list.rs b/components/gfx/platform/macos/font_list.rs index 44412771bee..624d9b9a4a9 100644 --- a/components/gfx/platform/macos/font_list.rs +++ b/components/gfx/platform/macos/font_list.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use core_text; -use text::util::unicode_plane; +use crate::text::util::unicode_plane; use ucd::{Codepoint, UnicodeBlock}; pub fn for_each_available_family<F>(mut callback: F) diff --git a/components/gfx/platform/mod.rs b/components/gfx/platform/mod.rs index 106b232e308..a14abaafe47 100644 --- a/components/gfx/platform/mod.rs +++ b/components/gfx/platform/mod.rs @@ -3,16 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #[cfg(any(target_os = "linux", target_os = "android"))] -pub use platform::freetype::{font, font_context}; +pub use crate::platform::freetype::{font, font_context}; #[cfg(any(target_os = "linux", target_os = "android"))] -pub use platform::freetype::{font_list, font_template}; +pub use crate::platform::freetype::{font_list, font_template}; #[cfg(target_os = "windows")] -pub use platform::windows::{font, font_context, font_list, font_template}; +pub use crate::platform::windows::{font, font_context, font_list, font_template}; #[cfg(target_os = "macos")] -pub use platform::macos::{font, font_context, font_list, font_template}; +pub use crate::platform::macos::{font, font_context, font_list, font_template}; #[cfg(any(target_os = "linux", target_os = "android"))] mod freetype { diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs index 26490d9c52c..d9f80de1103 100644 --- a/components/gfx/platform/windows/font.rs +++ b/components/gfx/platform/windows/font.rs @@ -10,11 +10,11 @@ use app_units::Au; use dwrote; use dwrote::{Font, FontFace, FontFile}; use dwrote::{FontStretch, FontStyle}; -use font::{FontHandleMethods, FontMetrics, FontTableMethods}; -use font::{FontTableTag, FractionalPixel}; -use platform::font_template::FontTemplateData; -use platform::windows::font_context::FontContextHandle; -use platform::windows::font_list::font_from_atom; +use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; +use crate::font::{FontTableTag, FractionalPixel}; +use crate::platform::font_template::FontTemplateData; +use crate::platform::windows::font_context::FontContextHandle; +use crate::platform::windows::font_list::font_from_atom; use servo_atoms::Atom; use std::fmt; use std::ops::Deref; @@ -25,7 +25,7 @@ use style::values::computed::font::FontStyle as StyleFontStyle; use style::values::generics::NonNegative; use style::values::generics::font::FontStyle as GenericFontStyle; use style::values::specified::font::FontStretchKeyword; -use text::glyph::GlyphId; +use crate::text::glyph::GlyphId; use truetype; // 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs index b2d73b3db5c..44a3f3704d7 100644 --- a/components/gfx/platform/windows/font_list.rs +++ b/components/gfx/platform/windows/font_list.rs @@ -7,7 +7,7 @@ use servo_atoms::Atom; use std::collections::HashMap; use std::sync::Mutex; use std::sync::atomic::{Ordering, AtomicUsize}; -use text::util::unicode_plane; +use crate::text::util::unicode_plane; use ucd::{Codepoint, UnicodeBlock}; lazy_static! { diff --git a/components/gfx/platform/windows/font_template.rs b/components/gfx/platform/windows/font_template.rs index 53eae0347fd..49deeee736f 100644 --- a/components/gfx/platform/windows/font_template.rs +++ b/components/gfx/platform/windows/font_template.rs @@ -2,7 +2,7 @@ * 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 platform::windows::font_list::{descriptor_from_atom, font_from_atom}; +use crate::platform::windows::font_list::{descriptor_from_atom, font_from_atom}; use servo_atoms::Atom; use std::fmt; use std::io; diff --git a/components/gfx/text/mod.rs b/components/gfx/text/mod.rs index 24c434e2e69..c65359ae1dd 100644 --- a/components/gfx/text/mod.rs +++ b/components/gfx/text/mod.rs @@ -2,8 +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/. */ -pub use text::shaping::Shaper; -pub use text::text_run::TextRun; +pub use crate::text::shaping::Shaper; +pub use crate::text::text_run::TextRun; pub mod glyph; pub mod shaping; diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index eb6b7b8cd4a..dc25783cb11 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -6,39 +6,39 @@ use app_units::Au; use euclid::Point2D; -use font::{ShapingFlags, Font, FontTableMethods, FontTableTag, ShapingOptions, KERN}; -use harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; -use harfbuzz::{hb_blob_create, hb_face_create_for_tables}; -use harfbuzz::{hb_buffer_create, hb_font_destroy}; -use harfbuzz::{hb_buffer_get_glyph_infos, hb_shape}; -use harfbuzz::{hb_buffer_set_direction, hb_buffer_set_script}; -use harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t}; -use harfbuzz::{hb_face_t, hb_font_t}; -use harfbuzz::{hb_position_t, hb_tag_t}; -use harfbuzz::hb_blob_t; -use harfbuzz::hb_bool_t; -use harfbuzz::hb_buffer_add_utf8; -use harfbuzz::hb_buffer_destroy; -use harfbuzz::hb_buffer_get_glyph_positions; -use harfbuzz::hb_buffer_get_length; -use harfbuzz::hb_face_destroy; -use harfbuzz::hb_feature_t; -use harfbuzz::hb_font_create; -use harfbuzz::hb_font_funcs_create; -use harfbuzz::hb_font_funcs_set_glyph_h_advance_func; -use harfbuzz::hb_font_funcs_set_glyph_h_kerning_func; -use harfbuzz::hb_font_funcs_set_nominal_glyph_func; -use harfbuzz::hb_font_set_funcs; -use harfbuzz::hb_font_set_ppem; -use harfbuzz::hb_font_set_scale; -use harfbuzz::hb_glyph_info_t; -use harfbuzz::hb_glyph_position_t; -use platform::font::FontTable; +use crate::font::{ShapingFlags, Font, FontTableMethods, FontTableTag, ShapingOptions, KERN}; +use crate::harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY}; +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_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::platform::font::FontTable; use std::{char, cmp, ptr}; use std::os::raw::{c_char, c_int, c_uint, c_void}; -use text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; -use text::shaping::ShaperMethods; -use text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; +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}; const NO_GLYPH: i32 = -1; const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a'); diff --git a/components/gfx/text/shaping/mod.rs b/components/gfx/text/shaping/mod.rs index 97d96980596..8c59c13427a 100644 --- a/components/gfx/text/shaping/mod.rs +++ b/components/gfx/text/shaping/mod.rs @@ -7,10 +7,10 @@ //! //! Currently, only harfbuzz bindings are implemented. -use font::ShapingOptions; -use text::glyph::GlyphStore; +use crate::font::ShapingOptions; +use crate::text::glyph::GlyphStore; -pub use text::shaping::harfbuzz::Shaper; +pub use crate::text::shaping::harfbuzz::Shaper; pub mod harfbuzz; diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 3eab1cd738d..c97575bf636 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -3,16 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::Au; -use font::{Font, FontHandleMethods, FontMetrics, ShapingFlags}; -use font::{RunMetrics, ShapingOptions}; -use platform::font_template::FontTemplateData; +use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags}; +use crate::font::{RunMetrics, ShapingOptions}; +use crate::platform::font_template::FontTemplateData; use range::Range; use std::cell::Cell; use std::cmp::{Ordering, max}; use std::slice::Iter; use std::sync::Arc; use style::str::char_is_whitespace; -use text::glyph::{ByteIndex, GlyphStore}; +use crate::text::glyph::{ByteIndex, GlyphStore}; use unicode_bidi as bidi; use webrender_api; use xi_unicode::LineBreakLeafIter; |