pub fn synchronize_fonts(&mut self, canvas: &mut Canvas) {
        for (name, font) in self.resource_manager.fonts.iter_mut() {
            match font {
                FontOrId::Font(data) => {
                    let id1 = canvas
                        .add_font_mem(&data.clone())
                        .expect(&format!("Failed to load font file for: {}", name));
                    let id2 = self.text_context.add_font_mem(&data.clone()).expect("failed");
                    if id1 != id2 {
                        panic!(
                            "Fonts in canvas must have the same id as fonts in the text context"
                        );
                    }
                    *font = FontOrId::Id(id1);
                }

                _ => {}
            }
        }
    }
/// Ensure all FontOrId entires are loaded into the contexts and become Ids.
Ensure all FontOrId entires are loaded into the contexts and become Ids.
Ensure all FontOrId entires are loaded into the contexts and become Ids .
pub fn synchronize_fonts(&mut self, canvas: &mut Canvas) {
        for (name, font) in self.resource_manager.fonts.iter_mut() {
            match font {
                FontOrId::Font(data) => {
                    let id1 = canvas
                        .add_font_mem(&data.clone())
                        .expect(&format!("Failed to load font file for: {}", name));
                    let id2 = self.text_context.add_font_mem(&data.clone()).expect("failed");
                    if id1 != id2 {
                        panic!(
                            "Fonts in canvas must have the same id as fonts in the text context"
                        );
                    }
                    *font = FontOrId::Id(id1);
                }
                _ => {}
            }
        }
    }
pub fn synchronize_fonts ( & mut self , canvas : & mut Canvas ) { for ( name , font ) in self . resource_manager . fonts . iter_mut ( ) { match font { FontOrId :: Font ( data ) => { let id1 = canvas . add_font_mem ( & data . clone ( ) ) . expect ( & format ! ( " " name ) ) ; let id2 = self . text_context . add_font_mem ( & data . clone ( ) ) . expect ( " " ) ; if id1 != id2 { panic ! ( " " ) ; } * font = FontOrId :: Id ( id1 ) ; } _ => { } } } }
Ensure all FontOrId entires are loaded into the contexts and become Ids.
Ensure all FontOrId entires are loaded into the contexts and become Ids .
&mut self
canvas
&mut Canvas