pub fn load_font(path: PathBuf) -> Result<FontFace, Error> {
    let file = File::open(path).context("File::open")?;
    let vmo = fdio::get_vmo_copy_from_file(&file).context("fdio::get_vmo_copy_from_file")?;
    let size = file.metadata()?.len() as usize;
    let root_vmar = fuchsia_runtime::vmar_root_self();
    let address = root_vmar.map(
        0,
        &vmo,
        0,
        size,
        zx::VmarFlags::PERM_READ | zx::VmarFlags::MAP_RANGE | zx::VmarFlags::REQUIRE_NON_RESIZABLE,
    )?;

    let mapped_font_data = unsafe { slice::from_raw_parts(address as *mut u8, size) };
    Ok(FontFace::new(&*mapped_font_data)?)
}
/// Load a font from the provided path.
Load a font from the provided path.
Load a font from the provided path .
pub fn load_font(path: PathBuf) -> Result<FontFace, Error> {
    let file = File::open(path).context("File::open")?;
    let vmo = fdio::get_vmo_copy_from_file(&file).context("fdio::get_vmo_copy_from_file")?;
    let size = file.metadata()?.len() as usize;
    let root_vmar = fuchsia_runtime::vmar_root_self();
    let address = root_vmar.map(
        0,
        &vmo,
        0,
        size,
        zx::VmarFlags::PERM_READ | zx::VmarFlags::MAP_RANGE | zx::VmarFlags::REQUIRE_NON_RESIZABLE,
    )?;
    let mapped_font_data = unsafe { slice::from_raw_parts(address as *mut u8, size) };
    Ok(FontFace::new(&*mapped_font_data)?)
}
pub fn load_font ( path : PathBuf ) -> Result < FontFace , Error > { let file = File :: open ( path ) . context ( " " ) ? ; let vmo = fdio :: get_vmo_copy_from_file ( & file ) . context ( " " ) ? ; let size = file . metadata ( ) ? . len ( ) as usize ; let root_vmar = fuchsia_runtime :: vmar_root_self ( ) ; let address = root_vmar . map ( 0 , & vmo , 0 , size , zx :: VmarFlags :: PERM_READ | zx :: VmarFlags :: MAP_RANGE | zx :: VmarFlags :: REQUIRE_NON_RESIZABLE , ) ? ; let mapped_font_data = unsafe { slice :: from_raw_parts ( address as * mut u8 , size ) } ; Ok ( FontFace :: new ( & * mapped_font_data ) ? ) }
Load a font from the provided path.
Load a font from the provided path .
path
PathBuf
path
PathBuf