pango/
attr_font_features.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, AttrType};
6
7define_attribute_struct!(
8    AttrFontFeatures,
9    ffi::PangoAttrFontFeatures,
10    &[AttrType::FontFeatures]
11);
12
13impl AttrFontFeatures {
14    /// Create a new font features tag attribute.
15    ///
16    /// You can use this attribute to select OpenType font features like small-caps,
17    /// alternative glyphs, ligatures, etc. for fonts that support them.
18    /// ## `features`
19    /// a string with OpenType font features, with the syntax of the [CSS
20    /// font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc)
21    ///
22    /// # Returns
23    ///
24    /// the newly allocated
25    ///   [`Attribute`][crate::Attribute], which should be freed with
26    ///   `Pango::Attribute::destroy()`
27    #[doc(alias = "pango_attr_font_features_new")]
28    pub fn new(features: &str) -> Self {
29        unsafe { from_glib_full(ffi::pango_attr_font_features_new(features.to_glib_none().0)) }
30    }
31
32    pub fn features(&self) -> glib::GString {
33        unsafe { from_glib_none(self.inner.features) }
34    }
35}