[][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 = 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]

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_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

impl Send for Feature

impl Sync for Feature

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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