[−][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 = b"calt"; // 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]);
Implementations
impl Feature
[src]
pub fn new(
tag: impl Into<Tag>,
value: u32,
range: impl RangeBounds<usize>
) -> Feature
[src]
tag: impl Into<Tag>,
value: u32,
range: impl RangeBounds<usize>
) -> Feature
Create a new Feature
struct.
The feature will be applied with the given value to all glyphs which are
in clusters contained in range
.
Arguments
tag
: The OpenType feature tag to use.value
: Some OpenType features accept different values to change their behaviour.range
: The cluster 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
Auto Trait Implementations
impl RefUnwindSafe for Feature
impl Send for Feature
impl Sync for Feature
impl Unpin for Feature
impl UnwindSafe for Feature
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,