aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-11-07 08:47:57 -0500
committerGitHub <noreply@github.com>2018-11-07 08:47:57 -0500
commitda2d9b2228441863feba2af2a60f84d2657fb962 (patch)
tree760c0eb675e95b46890480a9e10bc2c2cc714512 /components/gfx/platform
parent618a790050d8eab39e3c44b3d39dfefa7648445e (diff)
parent1855c88d6106c73febec1f5f29e246a75ff2f849 (diff)
downloadservo-da2d9b2228441863feba2af2a60f84d2657fb962.tar.gz
servo-da2d9b2228441863feba2af2a60f84d2657fb962.zip
Auto merge of #22126 - pyfisch:autoformat, r=jdm
Enforce rustfmt on CI <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22126) <!-- Reviewable:end -->
Diffstat (limited to 'components/gfx/platform')
-rw-r--r--components/gfx/platform/freetype/android/font_list.rs19
-rw-r--r--components/gfx/platform/freetype/font.rs9
-rw-r--r--components/gfx/platform/freetype/font_context.rs2
-rw-r--r--components/gfx/platform/freetype/font_list.rs6
-rw-r--r--components/gfx/platform/freetype/font_template.rs5
-rw-r--r--components/gfx/platform/macos/font.rs11
-rw-r--r--components/gfx/platform/macos/font_template.rs10
-rw-r--r--components/gfx/platform/windows/font.rs10
-rw-r--r--components/gfx/platform/windows/font_list.rs4
-rw-r--r--components/gfx/platform/windows/font_template.rs3
10 files changed, 49 insertions, 30 deletions
diff --git a/components/gfx/platform/freetype/android/font_list.rs b/components/gfx/platform/freetype/android/font_list.rs
index ef4a0612f24..d4b422ef111 100644
--- a/components/gfx/platform/freetype/android/font_list.rs
+++ b/components/gfx/platform/freetype/android/font_list.rs
@@ -8,11 +8,11 @@ use std::fs::File;
use std::io::{self, Read};
use std::path::Path;
use ucd::{Codepoint, UnicodeBlock};
-use xml5ever::Attribute;
use xml5ever::driver::parse_document;
use xml5ever::rcdom::*;
use xml5ever::rcdom::{Node, RcDom};
use xml5ever::tendril::TendrilSink;
+use xml5ever::Attribute;
lazy_static! {
static ref FONT_LIST: FontList = FontList::new();
@@ -127,7 +127,11 @@ struct FontList {
impl FontList {
fn new() -> FontList {
// Possible paths containing the font mapping xml file.
- let paths = ["/etc/fonts.xml", "/system/etc/system_fonts.xml", "/package/etc/fonts.xml"];
+ let paths = [
+ "/etc/fonts.xml",
+ "/system/etc/system_fonts.xml",
+ "/package/etc/fonts.xml",
+ ];
// Try to load and parse paths until one of them success.
let mut result = None;
@@ -213,7 +217,10 @@ impl FontList {
let alternatives = [
("sans-serif", "Roboto-Regular.ttf"),
("Droid Sans", "DroidSans.ttf"),
- ("Lomino", "/system/etc/ml/kali/Fonts/Lomino/Medium/LominoUI_Md.ttf"),
+ (
+ "Lomino",
+ "/system/etc/ml/kali/Fonts/Lomino/Medium/LominoUI_Md.ttf",
+ ),
];
alternatives
@@ -225,7 +232,8 @@ impl FontList {
filename: item.1.into(),
weight: None,
}],
- }).collect()
+ })
+ .collect()
}
// All Android fonts are located in /system/fonts
@@ -348,7 +356,8 @@ impl FontList {
.map(|f| Font {
filename: f.clone(),
weight: None,
- }).collect();
+ })
+ .collect();
if !fonts.is_empty() {
out.push(FontFamily {
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index 4ce38aa96d5..ab315b7cc02 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -2,6 +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 super::c_str_to_string;
use app_units::Au;
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN};
@@ -9,6 +10,7 @@ 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 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};
use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name};
@@ -17,18 +19,16 @@ use freetype::freetype::{FT_GlyphSlot, FT_Library, FT_Long, FT_ULong};
use freetype::freetype::{FT_Int32, FT_Kerning_Mode, FT_STYLE_FLAG_ITALIC};
use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size};
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 servo_atoms::Atom;
-use std::{mem, ptr};
use std::ffi::CString;
use std::os::raw::{c_char, c_long};
use std::sync::Arc;
+use std::{mem, ptr};
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;
// This constant is not present in the freetype
// bindings due to bindgen not handling the way
@@ -216,7 +216,8 @@ impl FontHandleMethods for FontHandle {
}
} else {
FontStretchKeyword::Normal
- }.compute();
+ }
+ .compute();
FontStretch(NonNegative(percentage))
}
diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs
index dbc8816efc5..2da91cf5008 100644
--- a/components/gfx/platform/freetype/font_context.rs
+++ b/components/gfx/platform/freetype/font_context.rs
@@ -10,7 +10,7 @@ use freetype::freetype::FT_MemoryRec_;
use freetype::freetype::FT_New_Library;
use freetype::succeeded;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use servo_allocator::libc_compat::{malloc, realloc, free};
+use servo_allocator::libc_compat::{free, malloc, realloc};
use servo_allocator::usable_size;
use std::os::raw::{c_long, c_void};
use std::ptr;
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index 71b7e9bc4e0..e285a4eee58 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.rs
@@ -2,18 +2,20 @@
* 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 super::c_str_to_string;
use crate::text::util::is_cjk;
use fontconfig::fontconfig::{FcChar8, FcResultMatch, FcSetSystem};
use fontconfig::fontconfig::{FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute};
use fontconfig::fontconfig::{FcDefaultSubstitute, FcFontMatch, FcNameParse, FcPatternGetString};
use fontconfig::fontconfig::{FcFontSetDestroy, FcMatchPattern, FcPatternCreate, FcPatternDestroy};
-use fontconfig::fontconfig::{FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString};
+use fontconfig::fontconfig::{
+ FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString,
+};
use fontconfig::fontconfig::{FcObjectSetAdd, FcPatternGetInteger};
use libc;
use libc::{c_char, c_int};
use std::ffi::CString;
use std::ptr;
-use super::c_str_to_string;
static FC_FAMILY: &'static [u8] = b"family\0";
static FC_FILE: &'static [u8] = b"file\0";
diff --git a/components/gfx/platform/freetype/font_template.rs b/components/gfx/platform/freetype/font_template.rs
index 674739b69ce..90bb5677167 100644
--- a/components/gfx/platform/freetype/font_template.rs
+++ b/components/gfx/platform/freetype/font_template.rs
@@ -5,7 +5,7 @@
use servo_atoms::Atom;
use std::fmt;
use std::fs::File;
-use std::io::{Read, Error};
+use std::io::{Error, Read};
use webrender_api::NativeFontHandle;
/// Platform specific font representation for Linux.
@@ -25,7 +25,8 @@ impl fmt::Debug for FontTemplateData {
.field(
"bytes",
&self.bytes.as_ref().map(|b| format!("[{} bytes]", b.len())),
- ).field("identifier", &self.identifier)
+ )
+ .field("identifier", &self.identifier)
.finish()
}
}
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index b9570da0760..a27cc2a7c43 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -11,17 +11,19 @@ use core_foundation::string::UniChar;
use core_graphics::font::CGGlyph;
use core_graphics::geometry::CGRect;
use core_text::font::CTFont;
-use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
use core_text::font_descriptor::kCTFontDefaultOrientation;
-use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel};
+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::{fmt, ptr};
use std::ops::Range;
use std::sync::Arc;
+use std::{fmt, ptr};
use style::values::computed::font::{FontStretch, FontStyle, FontWeight};
const KERN_PAIR_LEN: usize = 6;
@@ -236,8 +238,7 @@ impl FontHandleMethods for FontHandle {
let count: CFIndex = 1;
let result = unsafe {
- self
- .ctfont
+ self.ctfont
.get_glyphs_for_characters(&characters[0], &mut glyphs[0], count)
};
diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs
index 85d134f45a2..ea6bd57e413 100644
--- a/components/gfx/platform/macos/font_template.rs
+++ b/components/gfx/platform/macos/font_template.rs
@@ -7,15 +7,15 @@ use core_graphics::data_provider::CGDataProvider;
use core_graphics::font::CGFont;
use core_text;
use core_text::font::CTFont;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{Error, Visitor};
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::fmt;
use std::fs::File;
-use std::io::{Read, Error as IoError};
+use std::io::{Error as IoError, Read};
use std::ops::Deref;
use std::sync::{Arc, Mutex};
use webrender_api::NativeFontHandle;
@@ -51,7 +51,8 @@ impl fmt::Debug for FontTemplateData {
.font_data
.as_ref()
.map(|bytes| format!("[{} bytes]", bytes.len())),
- ).finish()
+ )
+ .finish()
}
}
@@ -111,7 +112,8 @@ impl FontTemplateData {
.expect("No URL for Core Text font!")
.get_string()
.to_string(),
- ).expect("Couldn't parse Core Text font URL!")
+ )
+ .expect("Couldn't parse Core Text font URL!")
.as_url()
.to_file_path()
.expect("Core Text font didn't name a path!");
diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs
index 9fb075aa027..b654b47e0cb 100644
--- a/components/gfx/platform/windows/font.rs
+++ b/components/gfx/platform/windows/font.rs
@@ -23,8 +23,8 @@ use std::sync::Arc;
use style::computed_values::font_stretch::T as StyleFontStretch;
use style::computed_values::font_weight::T as StyleFontWeight;
use style::values::computed::font::FontStyle as StyleFontStyle;
-use style::values::generics::NonNegative;
use style::values::generics::font::FontStyle as GenericFontStyle;
+use style::values::generics::NonNegative;
use style::values::specified::font::FontStretchKeyword;
use truetype;
@@ -119,7 +119,7 @@ struct FontInfo {
impl FontInfo {
fn new_from_face(face: &FontFace) -> Result<FontInfo, ()> {
- use std::cmp::{min, max};
+ use std::cmp::{max, min};
use std::io::Cursor;
use truetype::{NamingTable, Value, WindowsMetrics};
@@ -187,7 +187,8 @@ impl FontInfo {
8 => FontStretchKeyword::ExtraExpanded,
9 => FontStretchKeyword::UltraExpanded,
_ => return Err(()),
- }.compute(),
+ }
+ .compute(),
));
let style = if italic_bool {
@@ -224,7 +225,8 @@ impl FontInfo {
FontStretch::Expanded => FontStretchKeyword::Expanded,
FontStretch::ExtraExpanded => FontStretchKeyword::ExtraExpanded,
FontStretch::UltraExpanded => FontStretchKeyword::UltraExpanded,
- }.compute(),
+ }
+ .compute(),
));
Ok(FontInfo {
diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs
index 21e47aa76e6..ac58f7c91d4 100644
--- a/components/gfx/platform/windows/font_list.rs
+++ b/components/gfx/platform/windows/font_list.rs
@@ -3,11 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::text::util::unicode_plane;
-use dwrote::{Font, FontDescriptor, FontCollection};
+use dwrote::{Font, FontCollection, FontDescriptor};
use servo_atoms::Atom;
use std::collections::HashMap;
+use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Mutex;
-use std::sync::atomic::{Ordering, AtomicUsize};
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 49deeee736f..5a0cd14221d 100644
--- a/components/gfx/platform/windows/font_template.rs
+++ b/components/gfx/platform/windows/font_template.rs
@@ -24,7 +24,8 @@ impl fmt::Debug for FontTemplateData {
.bytes
.as_ref()
.map(|bytes| format!("[{} bytes]", bytes.len())),
- ).field("identifier", &self.identifier)
+ )
+ .field("identifier", &self.identifier)
.finish()
}
}