pango/
attr_float.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    AttrFloat,
9    ffi::PangoAttrFloat,
10    &[
11        AttrType::Scale,
12        #[cfg(feature = "v1_50")]
13        AttrType::LineHeight
14    ]
15);
16
17impl AttrFloat {
18    #[doc(alias = "pango_attr_scale_new")]
19    pub fn new_scale(scale_factor: f64) -> Self {
20        unsafe { from_glib_full(ffi::pango_attr_scale_new(scale_factor)) }
21    }
22
23    #[cfg(feature = "v1_50")]
24    #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
25    #[doc(alias = "pango_attr_line_height_new")]
26    pub fn new_line_height(factor: f64) -> Self {
27        unsafe { from_glib_full(ffi::pango_attr_line_height_new(factor)) }
28    }
29
30    pub fn value(&self) -> f64 {
31        self.inner.value
32    }
33}