mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #6316 - frewsxcv:if-let, r=Ms2ger
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6316) <!-- Reviewable:end -->
This commit is contained in:
commit
6e0d0072b8
2 changed files with 13 additions and 21 deletions
|
@ -140,9 +140,8 @@ impl Font {
|
|||
text: text.to_owned(),
|
||||
options: options.clone(),
|
||||
};
|
||||
match self.shape_cache.find(&lookup_key) {
|
||||
None => {}
|
||||
Some(glyphs) => return glyphs.clone(),
|
||||
if let Some(glyphs) = self.shape_cache.find(&lookup_key) {
|
||||
return glyphs.clone();
|
||||
}
|
||||
|
||||
let mut glyphs = GlyphStore::new(text.chars().count(),
|
||||
|
@ -159,12 +158,9 @@ impl Font {
|
|||
|
||||
fn make_shaper<'a>(&'a mut self, options: &ShapingOptions) -> &'a Shaper {
|
||||
// fast path: already created a shaper
|
||||
match self.shaper {
|
||||
Some(ref mut shaper) => {
|
||||
shaper.set_options(options);
|
||||
return shaper
|
||||
},
|
||||
None => {}
|
||||
if let Some(ref mut shaper) = self.shaper {
|
||||
shaper.set_options(options);
|
||||
return shaper
|
||||
}
|
||||
|
||||
let shaper = Shaper::new(self, options);
|
||||
|
|
|
@ -23,19 +23,15 @@ pub fn get_available_families<F>(mut callback: F) where F: FnMut(String) {
|
|||
pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F: FnMut(String) {
|
||||
debug!("Looking for faces of family: {}", family_name);
|
||||
|
||||
let family_collection =
|
||||
core_text::font_collection::create_for_family(family_name);
|
||||
match family_collection {
|
||||
Some(family_collection) => {
|
||||
let family_descriptors = family_collection.get_descriptors();
|
||||
for descref in family_descriptors.iter() {
|
||||
let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) };
|
||||
let desc: CTFontDescriptor = unsafe { TCFType::wrap_under_get_rule(descref) };
|
||||
let postscript_name = desc.font_name();
|
||||
callback(postscript_name);
|
||||
}
|
||||
let family_collection = core_text::font_collection::create_for_family(family_name);
|
||||
if let Some(family_collection) = family_collection {
|
||||
let family_descriptors = family_collection.get_descriptors();
|
||||
for descref in family_descriptors.iter() {
|
||||
let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) };
|
||||
let desc: CTFontDescriptor = unsafe { TCFType::wrap_under_get_rule(descref) };
|
||||
let postscript_name = desc.font_name();
|
||||
callback(postscript_name);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue