pango/auto/fontset_simple.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, Font, Fontset, Language};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// [`FontsetSimple`][crate::FontsetSimple] is a implementation of the abstract
10 /// [`Fontset`][crate::Fontset] base class as an array of fonts.
11 ///
12 /// When creating a [`FontsetSimple`][crate::FontsetSimple], you have to provide
13 /// the array of fonts that make up the fontset.
14 ///
15 /// # Implements
16 ///
17 /// [`FontsetExt`][trait@crate::prelude::FontsetExt]
18 #[doc(alias = "PangoFontsetSimple")]
19 pub struct FontsetSimple(Object<ffi::PangoFontsetSimple, ffi::PangoFontsetSimpleClass>) @extends Fontset;
20
21 match fn {
22 type_ => || ffi::pango_fontset_simple_get_type(),
23 }
24}
25
26impl FontsetSimple {
27 /// Creates a new [`FontsetSimple`][crate::FontsetSimple] for the given language.
28 /// ## `language`
29 /// a [`Language`][crate::Language] tag
30 ///
31 /// # Returns
32 ///
33 /// the newly allocated [`FontsetSimple`][crate::FontsetSimple]
34 #[doc(alias = "pango_fontset_simple_new")]
35 pub fn new(language: &mut Language) -> FontsetSimple {
36 unsafe { from_glib_full(ffi::pango_fontset_simple_new(language.to_glib_none_mut().0)) }
37 }
38
39 /// Adds a font to the fontset.
40 ///
41 /// The fontset takes ownership of @font.
42 /// ## `font`
43 /// a [`Font`][crate::Font].
44 #[doc(alias = "pango_fontset_simple_append")]
45 pub fn append(&self, font: impl IsA<Font>) {
46 unsafe {
47 ffi::pango_fontset_simple_append(self.to_glib_none().0, font.upcast().into_glib_ptr());
48 }
49 }
50
51 /// Returns the number of fonts in the fontset.
52 ///
53 /// # Returns
54 ///
55 /// the size of @self
56 #[doc(alias = "pango_fontset_simple_size")]
57 pub fn size(&self) -> i32 {
58 unsafe { ffi::pango_fontset_simple_size(self.to_glib_none().0) }
59 }
60}