diff options
Diffstat (limited to 'components/gfx')
-rw-r--r-- | components/gfx/font.rs | 2 | ||||
-rw-r--r-- | components/gfx/font_cache_thread.rs | 2 | ||||
-rw-r--r-- | components/gfx/font_context.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/freetype/font.rs | 2 | ||||
-rw-r--r-- | components/gfx/platform/macos/font.rs | 14 | ||||
-rw-r--r-- | components/gfx/platform/windows/font.rs | 2 | ||||
-rw-r--r-- | components/gfx/tests/font_template.rs | 4 | ||||
-rw-r--r-- | components/gfx/text/glyph.rs | 11 | ||||
-rw-r--r-- | components/gfx/text/shaping/harfbuzz.rs | 2 | ||||
-rw-r--r-- | components/gfx/text/text_run.rs | 9 |
10 files changed, 26 insertions, 24 deletions
diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 9ee543227b9..46dc113fa76 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use app_units::Au; use crate::font_context::{FontContext, FontSource}; use crate::font_template::FontTemplateDescriptor; use crate::platform::font::{FontHandle, FontTable}; @@ -12,6 +11,7 @@ use crate::platform::font_template::FontTemplateData; use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::shaping::ShaperMethods; use crate::text::Shaper; +use app_units::Au; use euclid::{Point2D, Rect, Size2D}; use ordered_float::NotNan; use servo_atoms::Atom; diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index c932df2686b..4e8712c4ec1 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use app_units::Au; use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; use crate::font_context::FontSource; use crate::font_template::{FontTemplate, FontTemplateDescriptor}; @@ -12,6 +11,7 @@ use crate::platform::font_list::for_each_variation; use crate::platform::font_list::system_default_family; use crate::platform::font_list::SANS_SERIF_FONT_FAMILY; use crate::platform::font_template::FontTemplateData; +use app_units::Au; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use net_traits::request::{Destination, RequestInit}; use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg}; diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 20b30a49159..d33c3cff602 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use app_units::Au; use crate::font::{ Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef, }; @@ -10,6 +9,7 @@ use crate::font_cache_thread::FontTemplateInfo; use crate::font_template::FontTemplateDescriptor; use crate::platform::font::FontHandle; pub use crate::platform::font_context::FontContextHandle; +use app_units::Au; use fnv::FnvHasher; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use servo_arc::Arc; diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index bf39a418f6e..d577fc9e92b 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -3,13 +3,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use super::c_str_to_string; -use app_units::Au; use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods}; use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN}; use crate::platform::font_context::FontContextHandle; use crate::platform::font_template::FontTemplateData; use crate::text::glyph::GlyphId; use crate::text::util::fixed_to_float; +use app_units::Au; use freetype::freetype::FT_Sfnt_Tag; use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face}; use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec}; diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index d346dc1838c..eff3d51789d 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -2,6 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +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 crate::text::glyph::GlyphId; /// Implementation of Quartz (CoreGraphics) fonts. use app_units::Au; use byteorder::{BigEndian, ByteOrder}; @@ -13,13 +20,6 @@ use core_graphics::geometry::CGRect; use core_text::font::CTFont; use core_text::font_descriptor::kCTFontDefaultOrientation; use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors}; -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 crate::text::glyph::GlyphId; use servo_atoms::Atom; use std::ops::Range; use std::sync::Arc; diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs index 23195c9bc74..6c183066a9b 100644 --- a/components/gfx/platform/windows/font.rs +++ b/components/gfx/platform/windows/font.rs @@ -6,13 +6,13 @@ // information for an approach that we'll likely need to take when the // renderer moves to a sandboxed process. -use app_units::Au; 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 crate::text::glyph::GlyphId; +use app_units::Au; use dwrote::{Font, FontFace, FontFile}; use dwrote::{FontStretch, FontStyle}; use servo_atoms::Atom; diff --git a/components/gfx/tests/font_template.rs b/components/gfx/tests/font_template.rs index f3771072c20..2e11f2d1f36 100644 --- a/components/gfx/tests/font_template.rs +++ b/components/gfx/tests/font_template.rs @@ -25,8 +25,8 @@ fn test_font_template_descriptor() { "dejavu-fonts-ttf-2.37", "ttf", ] - .iter() - .collect(); + .iter() + .collect(); path.push(format!("{}.ttf", filename)); let file = File::open(path).unwrap(); diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index c5dc268165e..d84570442ab 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -806,11 +806,12 @@ impl<'a> Iterator for GlyphIterator<'a> { } // No glyph range. Look at next byte. - self.byte_index = self.byte_index + if self.store.is_rtl { - ByteIndex(-1) - } else { - ByteIndex(1) - }; + self.byte_index = self.byte_index + + if self.store.is_rtl { + ByteIndex(-1) + } else { + ByteIndex(1) + }; let i = self.byte_index; if !self.byte_range.contains(i) { return None; diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index acbf8669be8..88cd19d59ff 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -4,12 +4,12 @@ #![allow(unsafe_code)] -use app_units::Au; use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN}; 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 app_units::Au; 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. diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 17c2fdc27fc..12bee8a8e39 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use app_units::Au; use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags}; use crate::font::{RunMetrics, ShapingOptions}; use crate::platform::font_template::FontTemplateData; use crate::text::glyph::{ByteIndex, GlyphStore}; +use app_units::Au; use range::Range; use std::cell::Cell; use std::cmp::{max, Ordering}; @@ -293,9 +293,10 @@ impl<'a> TextRun { // TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text self.natural_word_slices_in_range(range) .fold(Au(0), |advance, slice| { - advance + slice - .glyphs - .advance_for_byte_range(&slice.range, self.extra_word_spacing) + advance + + slice + .glyphs + .advance_for_byte_range(&slice.range, self.extra_word_spacing) }) } |