fn decode_name_utf16_be(name_entry: &FT_SfntName) -> Result<String, Error> {
        let as_u8 = unsafe {
            std::slice::from_raw_parts(name_entry.string, name_entry.string_len as usize)
        };
        // FT_SfntName.string_len is in bytes. One UTF-16 code unit is two bytes.
        let num_code_units = (name_entry.string_len / 2) as usize;
        let mut reader = Cursor::new(as_u8);
        let mut as_u16 = Vec::with_capacity(num_code_units);
        for _i in 0..num_code_units {
            let ch = reader.read_u16::<BigEndian>()?;
            as_u16.push(ch);
        }
        Ok(String::from_utf16(as_u16.as_slice())?)
    }
/// Decodes the the given `FT_SfntName` as a UTF-16 Big Endian string.
Decodes the the given `FT_SfntName` as a UTF-16 Big Endian string.
Decodes the the given ` FT_SfntName ` as a UTF - 16 Big Endian string .
fn decode_name_utf16_be(name_entry: &FT_SfntName) -> Result<String, Error> {
        let as_u8 = unsafe {
            std::slice::from_raw_parts(name_entry.string, name_entry.string_len as usize)
        };
        // FT_SfntName.string_len is in bytes. One UTF-16 code unit is two bytes.
        let num_code_units = (name_entry.string_len / 2) as usize;
        let mut reader = Cursor::new(as_u8);
        let mut as_u16 = Vec::with_capacity(num_code_units);
        for _i in 0..num_code_units {
            let ch = reader.read_u16::<BigEndian>()?;
            as_u16.push(ch);
        }
        Ok(String::from_utf16(as_u16.as_slice())?)
    }
fn decode_name_utf16_be ( name_entry : & FT_SfntName ) -> Result < String , Error > { let as_u8 = unsafe { std :: slice :: from_raw_parts ( name_entry . string , name_entry . string_len as usize ) } ; // FT_SfntName.string_len is in bytes. One UTF-16 code unit is two bytes. let num_code_units = ( name_entry . string_len / 2 ) as usize ; let mut reader = Cursor :: new ( as_u8 ) ; let mut as_u16 = Vec :: with_capacity ( num_code_units ) ; for _i in 0 .. num_code_units { let ch = reader . read_u16 :: < BigEndian > ( ) ? ; as_u16 . push ( ch ) ; } Ok ( String :: from_utf16 ( as_u16 . as_slice ( ) ) ? ) }
Decodes the the given `FT_SfntName` as a UTF-16 Big Endian string.
Decodes the the given ` FT_SfntName ` as a UTF - 16 Big Endian string .
name_entry
&FT_SfntName
name_entry
&FT_SfntName