Struct owned_ttf_parser::name::Name
source · pub struct Name<'a> {
pub platform_id: PlatformId,
pub encoding_id: u16,
pub language_id: u16,
pub name_id: u16,
pub name: &'a [u8],
}
Expand description
A Name Record.
Fields§
§platform_id: PlatformId
A platform ID.
encoding_id: u16
A platform-specific encoding ID.
language_id: u16
A language ID.
name_id: u16
§name: &'a [u8]
A raw name data.
Can be in any encoding. Can be empty.
Implementations§
source§impl<'a> Name<'a>
impl<'a> Name<'a>
sourcepub fn to_string(&self) -> Option<String>
pub fn to_string(&self) -> Option<String>
Returns the Name’s data as a UTF-8 string.
Only Unicode names are supported. And since they are stored as UTF-16BE,
we can’t return &str
and have to allocate a String
.
Supports:
- Unicode Platform ID
- Windows Platform ID + Symbol
- Windows Platform ID + Unicode BMP
sourcepub fn is_unicode(&self) -> bool
pub fn is_unicode(&self) -> bool
Checks that the current Name data has a Unicode encoding.
Trait Implementations§
impl<'a> Copy for Name<'a>
Auto Trait Implementations§
impl<'a> Freeze for Name<'a>
impl<'a> RefUnwindSafe for Name<'a>
impl<'a> Send for Name<'a>
impl<'a> Sync for Name<'a>
impl<'a> Unpin for Name<'a>
impl<'a> UnwindSafe for Name<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more