pub fn to_font(&self, size: f64, load_fallbacks: bool) -> Font {
        let ct_font = ct_new_from_descriptor(&self.ct_descriptor, size);
        let cg_font = ct_font.copy_to_CGFont();

        let fallbacks = if load_fallbacks {
            descriptors_for_family("Menlo")
                .into_iter()
                .find(|d| d.font_name == "Menlo-Regular")
                .map(|descriptor| {
                    let menlo = ct_new_from_descriptor(&descriptor.ct_descriptor, size);

                    // TODO fixme, hardcoded en for english
                    let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()])
                        .into_iter()
                        .filter(|desc| !desc.font_path.as_os_str().is_empty())
                        .map(|desc| desc.to_font(size, false))
                        .collect::<Vec<_>>();

                    // TODO, we can't use apple's proposed
                    // .Apple Symbol Fallback (filtered out below),
                    // but not having these makes us not able to render
                    // many chars. We add the symbols back in.
                    // Investigate if we can actually use the .-prefixed
                    // fallbacks somehow.
                    if let Some(descriptor) =
                        descriptors_for_family("Apple Symbols").into_iter().next()
                    {
                        fallbacks.push(descriptor.to_font(size, false))
                    };

                    // Include Menlo in the fallback list as well
                    fallbacks.insert(0, Font {
                        cg_font: menlo.copy_to_CGFont(),
                        ct_font: menlo,
                        fallbacks: Vec::new(),
                    });

                    fallbacks
                })
                .unwrap_or_else(Vec::new)
        } else {
            Vec::new()
        };

        Font { ct_font, cg_font, fallbacks }
    }
/// Create a Font from this descriptor
Create a Font from this descriptor
Create a Font from this descriptor
pub fn to_font(&self, size: f64, load_fallbacks: bool) -> Font {
        let ct_font = ct_new_from_descriptor(&self.ct_descriptor, size);
        let cg_font = ct_font.copy_to_CGFont();
        let fallbacks = if load_fallbacks {
            descriptors_for_family("Menlo")
                .into_iter()
                .find(|d| d.font_name == "Menlo-Regular")
                .map(|descriptor| {
                    let menlo = ct_new_from_descriptor(&descriptor.ct_descriptor, size);
                    // TODO fixme, hardcoded en for english
                    let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()])
                        .into_iter()
                        .filter(|desc| !desc.font_path.as_os_str().is_empty())
                        .map(|desc| desc.to_font(size, false))
                        .collect::<Vec<_>>();
                    // TODO, we can't use apple's proposed
                    // .Apple Symbol Fallback (filtered out below),
                    // but not having these makes us not able to render
                    // many chars. We add the symbols back in.
                    // Investigate if we can actually use the .-prefixed
                    // fallbacks somehow.
                    if let Some(descriptor) =
                        descriptors_for_family("Apple Symbols").into_iter().next()
                    {
                        fallbacks.push(descriptor.to_font(size, false))
                    };
                    // Include Menlo in the fallback list as well
                    fallbacks.insert(0, Font {
                        cg_font: menlo.copy_to_CGFont(),
                        ct_font: menlo,
                        fallbacks: Vec::new(),
                    });
                    fallbacks
                })
                .unwrap_or_else(Vec::new)
        } else {
            Vec::new()
        };
        Font { ct_font, cg_font, fallbacks }
    }
pub fn to_font ( & self , size : f64 , load_fallbacks : bool ) -> Font { let ct_font = ct_new_from_descriptor ( & self . ct_descriptor , size ) ; let cg_font = ct_font . copy_to_CGFont ( ) ; let fallbacks = if load_fallbacks { descriptors_for_family ( " " ) . into_iter ( ) . find ( | d | d . font_name == " " ) . map ( | descriptor | { let menlo = ct_new_from_descriptor ( & descriptor . ct_descriptor , size ) ; // TODO fixme, hardcoded en for english let mut fallbacks = cascade_list_for_languages ( & menlo , & [ " " . to_owned ( ) ] ) . into_iter ( ) . filter ( | desc | ! desc . font_path . as_os_str ( ) . is_empty ( ) ) . map ( | desc | desc . to_font ( size , false ) ) . collect :: < Vec < _ > > ( ) ; // TODO, we can't use apple's proposed // .Apple Symbol Fallback (filtered out below), // but not having these makes us not able to render // many chars. We add the symbols back in. // Investigate if we can actually use the .-prefixed // fallbacks somehow. if let Some ( descriptor ) = descriptors_for_family ( " " ) . into_iter ( ) . next ( ) { fallbacks . push ( descriptor . to_font ( size , false ) ) } ; // Include Menlo in the fallback list as well fallbacks . insert ( 0 , Font { cg_font : menlo . copy_to_CGFont ( ) , ct_font : menlo , fallbacks : Vec :: new ( ) , } ) ; fallbacks } ) . unwrap_or_else ( Vec :: new ) } else { Vec :: new ( ) } ; Font { ct_font , cg_font , fallbacks } }
Create a Font from this descriptor
Create a Font from this descriptor
&self
size
f64
load_fallbacks
bool