mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +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(),
|
text: text.to_owned(),
|
||||||
options: options.clone(),
|
options: options.clone(),
|
||||||
};
|
};
|
||||||
match self.shape_cache.find(&lookup_key) {
|
if let Some(glyphs) = self.shape_cache.find(&lookup_key) {
|
||||||
None => {}
|
return glyphs.clone();
|
||||||
Some(glyphs) => return glyphs.clone(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut glyphs = GlyphStore::new(text.chars().count(),
|
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 {
|
fn make_shaper<'a>(&'a mut self, options: &ShapingOptions) -> &'a Shaper {
|
||||||
// fast path: already created a shaper
|
// fast path: already created a shaper
|
||||||
match self.shaper {
|
if let Some(ref mut shaper) = self.shaper {
|
||||||
Some(ref mut shaper) => {
|
|
||||||
shaper.set_options(options);
|
shaper.set_options(options);
|
||||||
return shaper
|
return shaper
|
||||||
},
|
|
||||||
None => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let shaper = Shaper::new(self, options);
|
let shaper = Shaper::new(self, options);
|
||||||
|
|
|
@ -23,10 +23,8 @@ 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) {
|
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);
|
debug!("Looking for faces of family: {}", family_name);
|
||||||
|
|
||||||
let family_collection =
|
let family_collection = core_text::font_collection::create_for_family(family_name);
|
||||||
core_text::font_collection::create_for_family(family_name);
|
if let Some(family_collection) = family_collection {
|
||||||
match family_collection {
|
|
||||||
Some(family_collection) => {
|
|
||||||
let family_descriptors = family_collection.get_descriptors();
|
let family_descriptors = family_collection.get_descriptors();
|
||||||
for descref in family_descriptors.iter() {
|
for descref in family_descriptors.iter() {
|
||||||
let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) };
|
let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) };
|
||||||
|
@ -35,8 +33,6 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F:
|
||||||
callback(postscript_name);
|
callback(postscript_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_system_default_family(_generic_name: &str) -> Option<String> {
|
pub fn get_system_default_family(_generic_name: &str) -> Option<String> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue