Struct GlyphBuffer

Source
pub struct GlyphBuffer { /* private fields */ }
Expand description

Glyph buffer.

Can hold either text or glyphs and provides basic memory management that is used for text shaping, character to glyph mapping, glyph substitution, and glyph positioning.

Glyph buffer provides two separate buffers called ‘primary’ and ‘secondary’ that serve different purposes during processing. Primary buffer always hold a GlyphItem array, and secondary buffer is either used as a scratch buffer during glyph substitution or hold glyph positions after the processing is complete and glyph positions were calculated.

Implementations§

Source§

impl GlyphBuffer

Source

pub fn new() -> Self

Creates a new empty GlyphBuffer.

Source

pub fn from_utf8_text(text: &str) -> Self

Creates a new GlyphBuffer initialized with the given text.

Source

pub fn glyph_run(&self) -> GlyphRun<'_>

Source

pub fn glyph_item_data(&self) -> GlyphRun<'_>

Source

pub fn size(&self) -> usize

Source

pub fn flags(&self) -> GlyphRunFlags

Returns the GlyphBuffer’s GlyphRunFlags.

Source

pub fn has_text(&self) -> bool

Returns true if this GlyphBuffer contains unicode data.

Source

pub fn has_glyphs(&self) -> bool

Returns true if this GlyphBuffer contains GlyphId data.

Source

pub fn has_invalid_chars(&self) -> bool

Returns true if this GlyphBuffer contains invalid characters(unicode encoding errors).

Source

pub fn has_undefined_chars(&self) -> bool

Returns true if this GlyphBuffer contains undefined characters that weren’t mapped properly to glyphs.

Source

pub fn has_invalid_font_data(&self) -> bool

Returns true if one or more operations were terminated before completion because of invalid data in a font.

Source

pub fn clear(&mut self)

Clears the content of this GlyphBuffer without releasing internal buffers.

Source

pub fn set_utf8_text(&mut self, text: &str)

Sets text content of this GlyphBuffer.

Trait Implementations§

Source§

impl Debug for GlyphBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for GlyphBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<&str> for GlyphBuffer

Source§

fn from(text: &str) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.