pangocairo/auto/
font.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// [`Font`][crate::Font] is an interface exported by fonts for
10    /// use with Cairo.
11    ///
12    /// The actual type of the font will depend on the particular
13    /// font technology Cairo was compiled to use.
14    ///
15    /// # Implements
16    ///
17    /// [`PangoCairoFontExt`][trait@crate::prelude::PangoCairoFontExt], [`trait@pango::prelude::FontExt`]
18    #[doc(alias = "PangoCairoFont")]
19    pub struct Font(Interface<ffi::PangoCairoFont>) @requires pango::Font;
20
21    match fn {
22        type_ => || ffi::pango_cairo_font_get_type(),
23    }
24}
25
26impl Font {
27    pub const NONE: Option<&'static Font> = None;
28}
29
30/// Trait containing all [`struct@Font`] methods.
31///
32/// # Implementors
33///
34/// [`Font`][struct@crate::Font]
35pub trait PangoCairoFontExt: IsA<Font> + 'static {
36    /// Gets the [`cairo::ScaledFont`][crate::cairo::ScaledFont] used by @self.
37    /// The scaled font can be referenced and kept using
38    /// cairo_scaled_font_reference().
39    ///
40    /// # Returns
41    ///
42    /// the [`cairo::ScaledFont`][crate::cairo::ScaledFont]
43    ///   used by @self
44    #[doc(alias = "pango_cairo_font_get_scaled_font")]
45    #[doc(alias = "get_scaled_font")]
46    fn scaled_font(&self) -> Option<cairo::ScaledFont> {
47        unsafe {
48            from_glib_none(ffi::pango_cairo_font_get_scaled_font(
49                self.as_ref().to_glib_none().0,
50            ))
51        }
52    }
53}
54
55impl<O: IsA<Font>> PangoCairoFontExt for O {}