1use cairo;
6use glib::object::IsA;
7use glib::translate::*;
8use pango;
9use pango_cairo_sys;
10use std::fmt;
11
12glib_wrapper! {
13 pub struct Font(Interface<pango_cairo_sys::PangoCairoFont>) @requires pango::Font;
14
15 match fn {
16 get_type => || pango_cairo_sys::pango_cairo_font_get_type(),
17 }
18}
19
20pub const NONE_FONT: Option<&Font> = None;
21
22pub trait FontExt: 'static {
23 fn get_scaled_font(&self) -> Option<cairo::ScaledFont>;
24}
25
26impl<O: IsA<Font>> FontExt for O {
27 fn get_scaled_font(&self) -> Option<cairo::ScaledFont> {
28 unsafe {
29 from_glib_full(pango_cairo_sys::pango_cairo_font_get_scaled_font(
30 self.as_ref().to_glib_none().0,
31 ))
32 }
33 }
34}
35
36impl fmt::Display for Font {
37 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38 write!(f, "Font")
39 }
40}