[−][src]Struct harfbuzz_rs::GlyphBuffer
A GlyphBuffer
contains the resulting output information of the shaping
process.
An object of this type is obtained through the shape
function.
Methods
impl GlyphBuffer
[src]
pub fn len(&self) -> usize
[src]
Returns the length of the data of the buffer.
When called before shaping this is the number of unicode codepoints contained in the buffer. When called after shaping it returns the number of glyphs stored.
pub fn into_raw(self) -> *mut hb_buffer_t
[src]
Converts this buffer to a raw harfbuzz object pointer.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the buffer contains no elements.
pub fn get_glyph_positions(&self) -> &[GlyphPosition]
[src]
Get the glyph positions.
pub fn get_glyph_infos(&self) -> &[GlyphInfo]
[src]
Get the glyph infos.
pub fn reverse(&mut self)
[src]
Reverse the Buffer
's contents.
pub fn reverse_range(&mut self, start: usize, end: usize)
[src]
Reverse the Buffer
's contents in the range from start
to end
.
pub fn clear(self) -> UnicodeBuffer
[src]
Clears the contents of the glyph buffer and returns an empty
UnicodeBuffer
reusing the existing allocation.
ⓘImportant traits for BufferSerializer<'a>pub fn serializer<'a>(
&'a self,
font: Option<&'a Font<'a>>,
format: SerializeFormat,
flags: SerializeFlags
) -> BufferSerializer<'a>
[src]
&'a self,
font: Option<&'a Font<'a>>,
format: SerializeFormat,
flags: SerializeFlags
) -> BufferSerializer<'a>
Returns a serializer that allows the contents of the buffer to be converted into a human or machine readable representation.
Arguments
font
: Optionally a font can be provided for access to glyph names and glyph extents. IfNone
is passed an empty font is assumed.format
: The serialization format to use.flags
: Allows you to control which information will be contained in the serialized output.
Examples
Serialize the glyph buffer contents to a string using the textual format without any special flags.
use harfbuzz_rs::*; use std::io::Read; let face = Face::from_file(path, 0).expect("Error reading font file."); let font = Font::new(face); let buffer = UnicodeBuffer::new().add_str("ABC"); let buffer = shape(&font, buffer, &[]); let mut string = String::new(); buffer .serializer( Some(&font), SerializeFormat::Text, SerializeFlags::default(), ).read_to_string(&mut string) .unwrap(); assert_eq!(string, "gid2=0+520|gid3=1+574|gid4=2+562")
Trait Implementations
impl Debug for GlyphBuffer
[src]
impl Display for GlyphBuffer
[src]
Auto Trait Implementations
impl !Send for GlyphBuffer
impl !Sync for GlyphBuffer
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,