Struct zng_ext_font::font_features::FontFeatures
source · pub struct FontFeatures(/* private fields */);
Expand description
Font features configuration.
Implementations§
source§impl FontFeatures
impl FontFeatures
sourcepub fn new() -> FontFeatures
pub fn new() -> FontFeatures
New default.
sourcepub fn builder() -> FontFeaturesBuilder
pub fn builder() -> FontFeaturesBuilder
New builder.
sourcepub fn set_all(
&mut self,
other: &FontFeatures,
) -> Vec<(FontFeatureName, Option<u32>)>
pub fn set_all( &mut self, other: &FontFeatures, ) -> Vec<(FontFeatureName, Option<u32>)>
Set or override the features of self
from other
.
Returns the previous state of all affected names.
sourcepub fn restore(&mut self, prev: Vec<(FontFeatureName, Option<u32>)>)
pub fn restore(&mut self, prev: Vec<(FontFeatureName, Option<u32>)>)
Restore feature states that where overridden in set_all
.
sourcepub fn feature(&mut self, name: FontFeatureName) -> FontFeature<'_>
pub fn feature(&mut self, name: FontFeatureName) -> FontFeature<'_>
Access to the named feature.
sourcepub fn feature_set(
&mut self,
names: &'static [FontFeatureName],
) -> FontFeatureSet<'_>
pub fn feature_set( &mut self, names: &'static [FontFeatureName], ) -> FontFeatureSet<'_>
Access to a set of named features that are managed together.
§Panics
If names
has less than 2 names.
sourcepub fn feature_exclusive_set<S: FontFeatureExclusiveSetState>(
&mut self,
) -> FontFeatureExclusiveSet<'_, S>
pub fn feature_exclusive_set<S: FontFeatureExclusiveSetState>( &mut self, ) -> FontFeatureExclusiveSet<'_, S>
Access to a set of named features where only one of the features can be enabled at a time.
§Panics
If S::names()
has less than 2 names.
sourcepub fn feature_exclusive_sets<S: FontFeatureExclusiveSetsState>(
&mut self,
) -> FontFeatureExclusiveSets<'_, S>
pub fn feature_exclusive_sets<S: FontFeatureExclusiveSetsState>( &mut self, ) -> FontFeatureExclusiveSets<'_, S>
Access to a set of named features where only one or more features can be enabled but each combination represents a single distinct state.
§Panics
If S::names()
has less than 2 entries.
sourcepub fn finalize(&self) -> RFontFeatures
pub fn finalize(&self) -> RFontFeatures
Generate the harfbuzz font features.
source§impl FontFeatures
impl FontFeatures
sourcepub fn caps(&mut self) -> FontFeatureExclusiveSets<'_, CapsVariant>
pub fn caps(&mut self) -> FontFeatureExclusiveSets<'_, CapsVariant>
Font capital glyph variants.
See CapsVariant
for more details.
sourcepub fn kerning(&mut self) -> FontFeature<'_>
pub fn kerning(&mut self) -> FontFeature<'_>
Allow glyphs boundaries to overlap for a more pleasant reading.
This corresponds to the kern
feature.
Auto
always activates these kerning.
sourcepub fn common_lig(&mut self) -> FontFeatureSet<'_>
pub fn common_lig(&mut self) -> FontFeatureSet<'_>
The most common ligatures, like for fi
, ffi
, th
or similar.
This corresponds to OpenType liga
and clig
features.
Auto
always activates these ligatures.
sourcepub fn discretionary_lig(&mut self) -> FontFeature<'_>
pub fn discretionary_lig(&mut self) -> FontFeature<'_>
Ligatures specific to the font, usually decorative.
This corresponds to OpenType dlig
feature.
Auto
usually disables these ligatures.
sourcepub fn historical_lig(&mut self) -> FontFeature<'_>
pub fn historical_lig(&mut self) -> FontFeature<'_>
Ligatures used historically, in old books, like the German tz digraph being displayed ß.
This corresponds to OpenType hlig
feature.
Auto
usually disables these ligatures.
sourcepub fn contextual_alt(&mut self) -> FontFeature<'_>
pub fn contextual_alt(&mut self) -> FontFeature<'_>
Alternative letters that adapt to their surrounding letters.
This corresponds to OpenType calt
feature.
Auto
usually activates this feature.
sourcepub fn ordinal(&mut self) -> FontFeature<'_>
pub fn ordinal(&mut self) -> FontFeature<'_>
Force usage of ordinal special glyphs, 1a becomes 1ª.
This corresponds to OpenType ordn
feature.
Auto
deactivates this feature.
sourcepub fn slashed_zero(&mut self) -> FontFeature<'_>
pub fn slashed_zero(&mut self) -> FontFeature<'_>
Force use of a slashed zero for 0
.
This corresponds to OpenType zero
feature.
Auto
deactivates this feature.
sourcepub fn swash(&mut self) -> FontFeatureSet<'_>
pub fn swash(&mut self) -> FontFeatureSet<'_>
Use swashes flourish style.
Fonts can have alternative swash styles, you can select then by enabling a number.
This corresponds to OpenType swsh
and cswh
feature.
Auto
does not use swashes.
sourcepub fn stylistic(&mut self) -> FontFeature<'_>
pub fn stylistic(&mut self) -> FontFeature<'_>
Use stylistic alternatives.
Fonts can have multiple alternative styles, you can select then by enabling a number.
This corresponds to OpenType salt
feature.
Auto
does not use alternative styles.
sourcepub fn historical_forms(&mut self) -> FontFeature<'_>
pub fn historical_forms(&mut self) -> FontFeature<'_>
Use glyphs that were common in the past but not today.
This corresponds to OpenType hist
feature.
Auto
does not use alternative styles.
sourcepub fn ornaments(&mut self) -> FontFeature<'_>
pub fn ornaments(&mut self) -> FontFeature<'_>
Replace letter with fleurons, dingbats and border elements.
Fonts can have multiple alternative styles, you can select then by enabling a number.
This corresponds to OpenType ornm
feature.
Auto
does not enable this by default, but some fonts are purely dingbats glyphs.
sourcepub fn annotation(&mut self) -> FontFeature<'_>
pub fn annotation(&mut self) -> FontFeature<'_>
Font annotation alternatives, like circled digits or inverted characters.
Fonts can have multiple alternative styles, you can select then by enabling a number.
This corresponds to OpenType nalt
feature.
Auto
does not use alternative styles.
sourcepub fn numeric(&mut self) -> FontFeatureExclusiveSet<'_, NumVariant>
pub fn numeric(&mut self) -> FontFeatureExclusiveSet<'_, NumVariant>
Font numeric glyph variants.
See NumVariant
for more details.
sourcepub fn num_spacing(&mut self) -> FontFeatureExclusiveSet<'_, NumSpacing>
pub fn num_spacing(&mut self) -> FontFeatureExclusiveSet<'_, NumSpacing>
Font numeric spacing variants.
See NumSpacing
for more details.
sourcepub fn num_fraction(&mut self) -> FontFeatureExclusiveSet<'_, NumFraction>
pub fn num_fraction(&mut self) -> FontFeatureExclusiveSet<'_, NumFraction>
Font numeric spacing variants.
See NumSpacing
for more details.
sourcepub fn style_set(&mut self) -> FontFeatureExclusiveSet<'_, FontStyleSet>
pub fn style_set(&mut self) -> FontFeatureExclusiveSet<'_, FontStyleSet>
Font stylistic alternatives for sets of characters.
See FontStyleSet
for more details.
sourcepub fn char_variant(&mut self) -> FontFeatureExclusiveSet<'_, CharVariant>
pub fn char_variant(&mut self) -> FontFeatureExclusiveSet<'_, CharVariant>
Font stylistic alternatives for individual characters.
See CharVariant
for more details.
sourcepub fn position(&mut self) -> FontFeatureExclusiveSet<'_, FontPosition>
pub fn position(&mut self) -> FontFeatureExclusiveSet<'_, FontPosition>
Font sub/super script alternatives.
See FontPosition
for more details.
sourcepub fn ruby(&mut self) -> FontFeature<'_>
pub fn ruby(&mut self) -> FontFeature<'_>
Force the use of ruby (rubi) glyph variants.
This corresponds to OpenType ruby
feature.
Auto
does not force the use of ruby variants.
sourcepub fn jp_variant(&mut self) -> FontFeatureExclusiveSet<'_, JpVariant>
pub fn jp_variant(&mut self) -> FontFeatureExclusiveSet<'_, JpVariant>
Japanese logographic set selection.
See JpVariant
for more details.
sourcepub fn horizontal_kana(&mut self) -> FontFeature<'_>
pub fn horizontal_kana(&mut self) -> FontFeature<'_>
Use kana glyphs optimized for horizontal writing.
This corresponds to OpenType hkna
feature.
sourcepub fn cn_variant(&mut self) -> FontFeatureExclusiveSet<'_, CnVariant>
pub fn cn_variant(&mut self) -> FontFeatureExclusiveSet<'_, CnVariant>
Chinese logographic set selection.
See CnVariant
for more details.
sourcepub fn ea_width(&mut self) -> FontFeatureExclusiveSet<'_, EastAsianWidth>
pub fn ea_width(&mut self) -> FontFeatureExclusiveSet<'_, EastAsianWidth>
East Asian figure width control
See EastAsianWidth
for more details.
Trait Implementations§
source§impl Clone for FontFeatures
impl Clone for FontFeatures
source§fn clone(&self) -> FontFeatures
fn clone(&self) -> FontFeatures
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FontFeatures
impl Debug for FontFeatures
source§impl Default for FontFeatures
impl Default for FontFeatures
source§fn default() -> FontFeatures
fn default() -> FontFeatures
source§impl<'de> Deserialize<'de> for FontFeatures
impl<'de> Deserialize<'de> for FontFeatures
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for FontFeatures
impl PartialEq for FontFeatures
source§impl Serialize for FontFeatures
impl Serialize for FontFeatures
impl StructuralPartialEq for FontFeatures
Auto Trait Implementations§
impl Freeze for FontFeatures
impl RefUnwindSafe for FontFeatures
impl Send for FontFeatures
impl Sync for FontFeatures
impl Unpin for FontFeatures
impl UnwindSafe for FontFeatures
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more