pub struct Font { /* private fields */ }Expand description
A struct representing a font.
Implementations§
Source§impl Font
impl Font
Sourcepub fn new(bytes: &[u8]) -> Result<Font, BacktraceError<ErrorMessage>>
pub fn new(bytes: &[u8]) -> Result<Font, BacktraceError<ErrorMessage>>
Constructs a new font from the specified bytes.
The font may be in TrueType or OpenType format. Support for OpenType fonts may be limited.
Trait Implementations§
impl Eq for Font
Source§impl TextLayout for Font
impl TextLayout for Font
Source§fn lookup_glyph_for_codepoint(&self, codepoint: char) -> Option<FontGlyph>
fn lookup_glyph_for_codepoint(&self, codepoint: char) -> Option<FontGlyph>
Returns the glyph corresponding to the provided codepoint. If the glyph
cannot be found,
None is returned.Source§fn empty_line_vertical_metrics(&self, scale: f32) -> LineVerticalMetrics
fn empty_line_vertical_metrics(&self, scale: f32) -> LineVerticalMetrics
The default metrics of a line which contains no characters.
Source§fn layout_text(
&self,
text: &str,
scale: f32,
options: TextOptions,
) -> FormattedTextBlock
fn layout_text( &self, text: &str, scale: f32, options: TextOptions, ) -> FormattedTextBlock
Lays out a block of text with the specified scale and options. The
result may be passed to
Graphics2D::draw_text. Read moreSource§fn layout_text_from_unindexed_codepoints(
&self,
unindexed_codepoints: &[char],
scale: f32,
options: TextOptions,
) -> FormattedTextBlock
fn layout_text_from_unindexed_codepoints( &self, unindexed_codepoints: &[char], scale: f32, options: TextOptions, ) -> FormattedTextBlock
Lays out a block of text with the specified scale and options. The
result may be passed to
Graphics2D::draw_text. Read moreSource§fn layout_text_from_codepoints(
&self,
codepoints: &[Codepoint],
scale: f32,
options: TextOptions,
) -> FormattedTextBlock
fn layout_text_from_codepoints( &self, codepoints: &[Codepoint], scale: f32, options: TextOptions, ) -> FormattedTextBlock
Lays out a block of text with the specified scale and options. The
result may be passed to
Graphics2D::draw_text. Read moreAuto 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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>
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 more