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
30mod sealed {
31 pub trait Sealed {}
32 impl<T: super::IsA<super::Font>> Sealed for T {}
33}
34
35/// Trait containing all [`struct@Font`] methods.
36///
37/// # Implementors
38///
39/// [`Font`][struct@crate::Font]
40pub trait PangoCairoFontExt: IsA<Font> + sealed::Sealed + 'static {
41 /// Gets the [`cairo::ScaledFont`][crate::cairo::ScaledFont] used by @self.
42 /// The scaled font can be referenced and kept using
43 /// cairo_scaled_font_reference().
44 ///
45 /// # Returns
46 ///
47 /// the [`cairo::ScaledFont`][crate::cairo::ScaledFont]
48 /// used by @self
49 #[doc(alias = "pango_cairo_font_get_scaled_font")]
50 #[doc(alias = "get_scaled_font")]
51 fn scaled_font(&self) -> Option<cairo::ScaledFont> {
52 unsafe {
53 from_glib_none(ffi::pango_cairo_font_get_scaled_font(
54 self.as_ref().to_glib_none().0,
55 ))
56 }
57 }
58}
59
60impl<O: IsA<Font>> PangoCairoFontExt for O {}