Struct owned_ttf_parser::OwnedFace
source · pub struct OwnedFace(/* private fields */);
Expand description
An owned version of font Face
.
Implementations§
source§impl OwnedFace
impl OwnedFace
sourcepub fn from_vec(data: Vec<u8>, index: u32) -> Result<Self, FaceParsingError>
pub fn from_vec(data: Vec<u8>, index: u32) -> Result<Self, FaceParsingError>
Creates an OwnedFace
from owned data.
You can set index for font collections. For simple ttf fonts set index to 0.
§Example
let owned_face = OwnedFace::from_vec(owned_font_data, 0).unwrap();
sourcepub fn as_slice(&self) -> &[u8]
pub fn as_slice(&self) -> &[u8]
Extracts a slice containing the data passed into OwnedFace::from_vec
.
§Example
let data_clone = owned_font_data.clone();
let owned_face = OwnedFace::from_vec(owned_font_data, 0).unwrap();
assert_eq!(owned_face.as_slice(), data_clone);
sourcepub fn into_vec(self) -> Vec<u8>
pub fn into_vec(self) -> Vec<u8>
Unwraps the data passed into OwnedFace::from_vec
.
§Example
let data_clone = owned_font_data.clone();
let owned_face = OwnedFace::from_vec(owned_font_data, 0).unwrap();
assert_eq!(owned_face.into_vec(), data_clone);
Trait Implementations§
source§impl AsFaceRef for &OwnedFace
impl AsFaceRef for &OwnedFace
source§fn as_face_ref(&self) -> &Face<'_>
fn as_face_ref(&self) -> &Face<'_>
Convert to a
Face
reference.source§impl AsFaceRef for OwnedFace
impl AsFaceRef for OwnedFace
source§fn as_face_ref(&self) -> &Face<'_>
fn as_face_ref(&self) -> &Face<'_>
Convert to a
Face
reference.source§impl FaceMut for &mut OwnedFace
impl FaceMut for &mut OwnedFace
source§fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
Sets a variation axis coordinate. Read more