[][src]Struct harfbuzz_rs::Feature

#[repr(transparent)]pub struct Feature(_);

A feature tag with an accompanying range specifying on which subslice of shapes input it should be applied.

You can pass a slice of Features 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]

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

impl Clone for Feature[src]

impl Copy for Feature[src]

impl Debug for Feature[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.