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§
source§impl PartialEq for Font
impl PartialEq 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 moreimpl Eq for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin 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