Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -254,7 +254,8 @@ impl Font {
TEXT_SHAPING_PERFORMANCE_COUNTER
.fetch_add((end_time - start_time) as usize, Ordering::Relaxed);
Arc::new(glyphs)
}).clone();
})
.clone();
self.shaper = shaper;
result
}
@ -450,7 +451,8 @@ impl FontGroup {
iter::once(FontFamilyDescriptor::default())
.chain(fallback_font_families(codepoint).into_iter().map(|family| {
FontFamilyDescriptor::new(FontFamilyName::from(family), FontSearchScope::Local)
})).filter_map(|family| font_context.font(&self.descriptor, &family))
}))
.filter_map(|family| font_context.font(&self.descriptor, &family))
.find(predicate)
}
}

View file

@ -434,7 +434,8 @@ impl FontCache {
FontSearchScope::Local => {
self.find_font_in_local_family(&template_descriptor, &family_descriptor.name)
},
}.map(|t| self.get_font_template_info(t))
}
.map(|t| self.get_font_template_info(t))
}
}
@ -474,7 +475,8 @@ impl FontCacheThread {
cache.refresh_local_families();
cache.run();
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
FontCacheThread { chan: chan }
}
@ -490,7 +492,8 @@ impl FontCacheThread {
LowercaseString::new(&family.name),
sources,
sender,
)).unwrap();
))
.unwrap();
}
pub fn exit(&self) {
@ -538,7 +541,8 @@ impl FontSource for FontCacheThread {
template_descriptor,
family_descriptor,
response_chan,
)).expect("failed to send message to font cache thread");
))
.expect("failed to send message to font cache thread");
let reply = response_port.recv();

View file

@ -133,7 +133,8 @@ impl<S: FontSource> FontContext<S> {
.and_then(|template_info| {
self.create_font(template_info, font_descriptor.to_owned())
.ok()
}).map(|font| Rc::new(RefCell::new(font)));
})
.map(|font| Rc::new(RefCell::new(font)));
self.font_cache.insert(cache_key, font.clone());
font

View file

@ -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 {

View file

@ -216,7 +216,8 @@ impl FontHandleMethods for FontHandle {
}
} else {
FontStretchKeyword::Normal
}.compute();
}
.compute();
FontStretch(NonNegative(percentage))
}

View file

@ -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()
}
}

View file

@ -236,8 +236,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)
};

View file

@ -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!");

View file

@ -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 {

View file

@ -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()
}
}

View file

@ -119,7 +119,8 @@ fn font_family(names: Vec<&str>) -> FontFamily {
name: Atom::from(name),
syntax: FamilyNameSyntax::Quoted,
})
}).collect();
})
.collect();
FontFamily(FontFamilyList::new(names.into_boxed_slice()))
}

View file

@ -41,7 +41,8 @@ fn test_font_template_descriptor() {
let mut template = FontTemplate::new(
Atom::from(filename),
Some(file.bytes().map(|b| b.unwrap()).collect()),
).unwrap();
)
.unwrap();
let context = FontContextHandle::new();

View file

@ -226,9 +226,9 @@ impl<'a> DetailedGlyphStore {
/* TODO: don't actually assert this until asserts are compiled
in/out based on severity, debug/release, etc. This assertion
would wreck the complexity of the lookup.
See Rust Issue #3647, #2228, #3627 for related information.
do self.detail_lookup.borrow |arr| {
assert !arr.contains(entry)
}
@ -541,7 +541,8 @@ impl<'a> GlyphStore {
data_for_glyphs[i].advance,
data_for_glyphs[i].offset,
)
}).collect();
})
.collect();
self.has_detailed_glyphs = true;
self.detail_store

View file

@ -380,7 +380,8 @@ impl<'a> TextRun {
);
remaining -= slice_advance;
slice_index
}).sum()
})
.sum()
}
/// Returns an iterator that will iterate over all slices of glyphs that represent natural