pub(crate) struct FreeTypeFace {
face: NonNull<FT_FaceRec>,
}
Expand description
A safe wrapper around FT_Face.
Fields§
§face: NonNull<FT_FaceRec>
§Safety Invariant
The pointer must have been returned from FT_New_Face or FT_New_Memory_Face
and must not be freed before FreetypeFace::drop
is called.
Implementations§
Source§impl FreeTypeFace
impl FreeTypeFace
pub(crate) fn new_from_memory( library: &FreeTypeLibraryHandle, data: &[u8], ) -> Result<Self, &'static str>
pub(crate) fn new_from_file( library: &FreeTypeLibraryHandle, filename: &CStr, index: u32, ) -> Result<Self, &'static str>
pub(crate) fn as_ref(&self) -> &FT_FaceRec
pub(crate) fn as_ptr(&self) -> FT_Face
Sourcepub(crate) fn scalable(&self) -> bool
pub(crate) fn scalable(&self) -> bool
Return true iff the font face flags contain FT_FACE_FLAG_SCALABLE.
Sourcepub(crate) fn color(&self) -> bool
pub(crate) fn color(&self) -> bool
Return true iff the font face flags contain FT_FACE_FLAG_COLOR.
Sourcepub(crate) fn set_size(&self, requested_size: Au) -> Result<Au, &'static str>
pub(crate) fn set_size(&self, requested_size: Au) -> Result<Au, &'static str>
Scale the font to the given size if it is scalable, or select the closest available size if it is not, preferring larger sizes over smaller ones.
Returns the selected size on success and a error message on failure
Sourcepub(crate) fn glyph_load_flags(&self) -> FT_Int32
pub(crate) fn glyph_load_flags(&self) -> FT_Int32
Select a reasonable set of glyph loading flags for the font.
Sourcepub(crate) fn set_variations_for_font(
&self,
variations: &[FontVariation],
library: &FreeTypeLibraryHandle,
) -> Result<Vec<FontVariation>, &'static str>
pub(crate) fn set_variations_for_font( &self, variations: &[FontVariation], library: &FreeTypeLibraryHandle, ) -> Result<Vec<FontVariation>, &'static str>
Applies to provided variations to the font face.
Returns the normalized font variations, which are clamped to fit within the range of their respective axis. Variation values for nonexistent axes are not included.
Trait Implementations§
Source§impl Debug for FreeTypeFace
impl Debug for FreeTypeFace
Source§impl Drop for FreeTypeFace
impl Drop for FreeTypeFace
impl Send for FreeTypeFace
FT_Face can be used in multiple threads, but from only one thread at a time. See https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face.
Auto Trait Implementations§
impl Freeze for FreeTypeFace
impl RefUnwindSafe for FreeTypeFace
impl !Sync for FreeTypeFace
impl Unpin for FreeTypeFace
impl UnwindSafe for FreeTypeFace
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more