pub struct Font {
pub metrics: Arc<FontMetrics>,
pub descriptor: FontDescriptor,
/* private fields */
}Fields§
§metrics: Arc<FontMetrics>§descriptor: FontDescriptorImplementations§
Source§impl Font
impl Font
pub fn new( template: FontTemplateRef, descriptor: FontDescriptor, data: Option<FontData>, synthesized_small_caps: Option<FontRef>, ) -> Result<Font, &'static str>
Sourcepub fn identifier(&self) -> FontIdentifier
pub fn identifier(&self) -> FontIdentifier
A unique identifier for the font, allowing comparison.
pub fn key( &self, painter_id: PainterId, font_context: &FontContext, ) -> FontInstanceKey
Sourcepub fn font_data_and_index(&self) -> Result<&FontDataAndIndex, FontDataError>
pub fn font_data_and_index(&self) -> Result<&FontDataAndIndex, FontDataError>
Return the data for this Font. Note that this is currently highly inefficient for system
fonts and should not be used except in legacy canvas code.
Source§impl Font
impl Font
pub fn shape_text( &self, text: &str, options: &ShapingOptions, ) -> Arc<GlyphStore>
Sourcepub fn can_do_fast_shaping(&self, text: &str, options: &ShapingOptions) -> bool
pub fn can_do_fast_shaping(&self, text: &str, options: &ShapingOptions) -> bool
Whether not a particular text and ShapingOptions combination can use
“fast shaping” ie shaping without Harfbuzz.
Note: This will eventually be removed.
pub fn glyph_index(&self, codepoint: char) -> Option<u32>
pub fn glyph_h_advance(&self, glyph_id: u32) -> f64
pub fn typographic_bounds(&self, glyph_id: u32) -> Rect<f32>
Sourcepub fn baseline(&self) -> Option<FontBaseline>
pub fn baseline(&self) -> Option<FontBaseline>
Get the FontBaseline for this font.
Trait Implementations§
Source§impl MallocSizeOf for Font
impl MallocSizeOf for Font
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl !Freeze for Font
impl !RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnsafeUnpin for Font
impl !UnwindSafe for Font
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
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert