[−][src]Struct harfbuzz_rs::Feature
A feature tag with an accompanying range specifying on which subslice of
shape
s input it should be applied.
You can pass a slice of Feature
s to shape
that will be activated for the
corresponding slices of input.
Examples
Shape some text using the calt
(Contextual Alternatives) feature.
use harfbuzz_rs::{Face, Font, UnicodeBuffer, shape, Feature, Tag}; let path = "testfiles/SourceSansVariable-Roman.ttf"; let face = Face::from_file(path, 0).expect("could not load face"); let font = Font::new(face); let buffer = UnicodeBuffer::new().add_str("Hello World!"); // contextual alternatives feature let feature_tag = Tag::new('c', 'a', 'l', 't'); // use the feature on the entire input let feature_range = 0..; let feature = Feature::new(feature_tag, 0, feature_range); let output = shape(&font, buffer, &[feature]);
Methods
impl Feature
[src]
pub fn new(
tag: Tag,
value: u32,
range: impl RangeBounds<usize>
) -> Feature
[src]
tag: Tag,
value: u32,
range: impl RangeBounds<usize>
) -> Feature
Create a new Feature
struct.
Arguments
tag
: The OpenType feature tag to use.value
: Some OpenType features accept different values to change their behaviour.range
: The character range that should be affected by this feature.
pub fn tag(&self) -> Tag
[src]
pub fn value(&self) -> u32
[src]
pub fn start(&self) -> usize
[src]
pub fn end(&self) -> usize
[src]
Trait Implementations
impl Clone for Feature
[src]
fn clone(&self) -> Feature
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Feature
[src]
impl Debug for Feature
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
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
🔬 This is a nightly-only experimental API. (
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,