pango/auto/
flags.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::{bitflags::bitflags, prelude::*, translate::*};
7
8bitflags! {
9    /// The bits in a [`FontMask`][crate::FontMask] correspond to the set fields in a
10    /// [`FontDescription`][crate::FontDescription].
11    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
12    #[doc(alias = "PangoFontMask")]
13    pub struct FontMask: u32 {
14        /// the font family is specified.
15        #[doc(alias = "PANGO_FONT_MASK_FAMILY")]
16        const FAMILY = ffi::PANGO_FONT_MASK_FAMILY as _;
17        /// the font style is specified.
18        #[doc(alias = "PANGO_FONT_MASK_STYLE")]
19        const STYLE = ffi::PANGO_FONT_MASK_STYLE as _;
20        /// the font variant is specified.
21        #[doc(alias = "PANGO_FONT_MASK_VARIANT")]
22        const VARIANT = ffi::PANGO_FONT_MASK_VARIANT as _;
23        /// the font weight is specified.
24        #[doc(alias = "PANGO_FONT_MASK_WEIGHT")]
25        const WEIGHT = ffi::PANGO_FONT_MASK_WEIGHT as _;
26        /// the font stretch is specified.
27        #[doc(alias = "PANGO_FONT_MASK_STRETCH")]
28        const STRETCH = ffi::PANGO_FONT_MASK_STRETCH as _;
29        /// the font size is specified.
30        #[doc(alias = "PANGO_FONT_MASK_SIZE")]
31        const SIZE = ffi::PANGO_FONT_MASK_SIZE as _;
32        /// The font gravity is specified.
33        #[doc(alias = "PANGO_FONT_MASK_GRAVITY")]
34        const GRAVITY = ffi::PANGO_FONT_MASK_GRAVITY as _;
35        /// OpenType font variations are specified.
36        #[cfg(feature = "v1_42")]
37        #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
38        #[doc(alias = "PANGO_FONT_MASK_VARIATIONS")]
39        const VARIATIONS = ffi::PANGO_FONT_MASK_VARIATIONS as _;
40        /// OpenType font features are specified.
41        #[cfg(feature = "v1_56")]
42        #[cfg_attr(docsrs, doc(cfg(feature = "v1_56")))]
43        #[doc(alias = "PANGO_FONT_MASK_FEATURES")]
44        const FEATURES = ffi::PANGO_FONT_MASK_FEATURES as _;
45        /// Font color is specified.
46        #[cfg(feature = "v1_57")]
47        #[cfg_attr(docsrs, doc(cfg(feature = "v1_57")))]
48        #[doc(alias = "PANGO_FONT_MASK_COLOR")]
49        const COLOR = ffi::PANGO_FONT_MASK_COLOR as _;
50    }
51}
52
53#[doc(hidden)]
54impl IntoGlib for FontMask {
55    type GlibType = ffi::PangoFontMask;
56
57    #[inline]
58    fn into_glib(self) -> ffi::PangoFontMask {
59        self.bits()
60    }
61}
62
63#[doc(hidden)]
64impl FromGlib<ffi::PangoFontMask> for FontMask {
65    #[inline]
66    unsafe fn from_glib(value: ffi::PangoFontMask) -> Self {
67        Self::from_bits_truncate(value)
68    }
69}
70
71impl StaticType for FontMask {
72    #[inline]
73    #[doc(alias = "pango_font_mask_get_type")]
74    fn static_type() -> glib::Type {
75        unsafe { from_glib(ffi::pango_font_mask_get_type()) }
76    }
77}
78
79impl glib::HasParamSpec for FontMask {
80    type ParamSpec = glib::ParamSpecFlags;
81    type SetValue = Self;
82    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
83
84    fn param_spec_builder() -> Self::BuilderFn {
85        Self::ParamSpec::builder
86    }
87}
88
89impl glib::value::ValueType for FontMask {
90    type Type = Self;
91}
92
93unsafe impl<'a> glib::value::FromValue<'a> for FontMask {
94    type Checker = glib::value::GenericValueTypeChecker<Self>;
95
96    #[inline]
97    unsafe fn from_value(value: &'a glib::Value) -> Self {
98        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
99    }
100}
101
102impl ToValue for FontMask {
103    #[inline]
104    fn to_value(&self) -> glib::Value {
105        let mut value = glib::Value::for_value_type::<Self>();
106        unsafe {
107            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
108        }
109        value
110    }
111
112    #[inline]
113    fn value_type(&self) -> glib::Type {
114        Self::static_type()
115    }
116}
117
118impl From<FontMask> for glib::Value {
119    #[inline]
120    fn from(v: FontMask) -> Self {
121        ToValue::to_value(&v)
122    }
123}
124
125#[cfg(feature = "v1_50")]
126bitflags! {
127    /// Flags that influence the behavior of `Pango::Layout::deserialize()`.
128    ///
129    /// New members may be added to this enumeration over time.
130    #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
131    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
132    #[doc(alias = "PangoLayoutDeserializeFlags")]
133    pub struct LayoutDeserializeFlags: u32 {
134        /// Default behavior
135        #[doc(alias = "PANGO_LAYOUT_DESERIALIZE_DEFAULT")]
136        const DEFAULT = ffi::PANGO_LAYOUT_DESERIALIZE_DEFAULT as _;
137        /// Apply context information
138        ///   from the serialization to the [`Context`][crate::Context]
139        #[doc(alias = "PANGO_LAYOUT_DESERIALIZE_CONTEXT")]
140        const CONTEXT = ffi::PANGO_LAYOUT_DESERIALIZE_CONTEXT as _;
141    }
142}
143
144#[cfg(feature = "v1_50")]
145#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
146#[doc(hidden)]
147impl IntoGlib for LayoutDeserializeFlags {
148    type GlibType = ffi::PangoLayoutDeserializeFlags;
149
150    #[inline]
151    fn into_glib(self) -> ffi::PangoLayoutDeserializeFlags {
152        self.bits()
153    }
154}
155
156#[cfg(feature = "v1_50")]
157#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
158#[doc(hidden)]
159impl FromGlib<ffi::PangoLayoutDeserializeFlags> for LayoutDeserializeFlags {
160    #[inline]
161    unsafe fn from_glib(value: ffi::PangoLayoutDeserializeFlags) -> Self {
162        Self::from_bits_truncate(value)
163    }
164}
165
166#[cfg(feature = "v1_50")]
167#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
168impl StaticType for LayoutDeserializeFlags {
169    #[inline]
170    #[doc(alias = "pango_layout_deserialize_flags_get_type")]
171    fn static_type() -> glib::Type {
172        unsafe { from_glib(ffi::pango_layout_deserialize_flags_get_type()) }
173    }
174}
175
176#[cfg(feature = "v1_50")]
177#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
178impl glib::HasParamSpec for LayoutDeserializeFlags {
179    type ParamSpec = glib::ParamSpecFlags;
180    type SetValue = Self;
181    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
182
183    fn param_spec_builder() -> Self::BuilderFn {
184        Self::ParamSpec::builder
185    }
186}
187
188#[cfg(feature = "v1_50")]
189#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
190impl glib::value::ValueType for LayoutDeserializeFlags {
191    type Type = Self;
192}
193
194#[cfg(feature = "v1_50")]
195#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
196unsafe impl<'a> glib::value::FromValue<'a> for LayoutDeserializeFlags {
197    type Checker = glib::value::GenericValueTypeChecker<Self>;
198
199    #[inline]
200    unsafe fn from_value(value: &'a glib::Value) -> Self {
201        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
202    }
203}
204
205#[cfg(feature = "v1_50")]
206#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
207impl ToValue for LayoutDeserializeFlags {
208    #[inline]
209    fn to_value(&self) -> glib::Value {
210        let mut value = glib::Value::for_value_type::<Self>();
211        unsafe {
212            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
213        }
214        value
215    }
216
217    #[inline]
218    fn value_type(&self) -> glib::Type {
219        Self::static_type()
220    }
221}
222
223#[cfg(feature = "v1_50")]
224#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
225impl From<LayoutDeserializeFlags> for glib::Value {
226    #[inline]
227    fn from(v: LayoutDeserializeFlags) -> Self {
228        ToValue::to_value(&v)
229    }
230}
231
232#[cfg(feature = "v1_50")]
233bitflags! {
234    /// Flags that influence the behavior of [`Layout::serialize()`][crate::Layout::serialize()].
235    ///
236    /// New members may be added to this enumeration over time.
237    #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
238    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
239    #[doc(alias = "PangoLayoutSerializeFlags")]
240    pub struct LayoutSerializeFlags: u32 {
241        /// Default behavior
242        #[doc(alias = "PANGO_LAYOUT_SERIALIZE_DEFAULT")]
243        const DEFAULT = ffi::PANGO_LAYOUT_SERIALIZE_DEFAULT as _;
244        /// Include context information
245        #[doc(alias = "PANGO_LAYOUT_SERIALIZE_CONTEXT")]
246        const CONTEXT = ffi::PANGO_LAYOUT_SERIALIZE_CONTEXT as _;
247        /// Include information about the formatted output
248        #[doc(alias = "PANGO_LAYOUT_SERIALIZE_OUTPUT")]
249        const OUTPUT = ffi::PANGO_LAYOUT_SERIALIZE_OUTPUT as _;
250    }
251}
252
253#[cfg(feature = "v1_50")]
254#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
255#[doc(hidden)]
256impl IntoGlib for LayoutSerializeFlags {
257    type GlibType = ffi::PangoLayoutSerializeFlags;
258
259    #[inline]
260    fn into_glib(self) -> ffi::PangoLayoutSerializeFlags {
261        self.bits()
262    }
263}
264
265#[cfg(feature = "v1_50")]
266#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
267#[doc(hidden)]
268impl FromGlib<ffi::PangoLayoutSerializeFlags> for LayoutSerializeFlags {
269    #[inline]
270    unsafe fn from_glib(value: ffi::PangoLayoutSerializeFlags) -> Self {
271        Self::from_bits_truncate(value)
272    }
273}
274
275#[cfg(feature = "v1_50")]
276#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
277impl StaticType for LayoutSerializeFlags {
278    #[inline]
279    #[doc(alias = "pango_layout_serialize_flags_get_type")]
280    fn static_type() -> glib::Type {
281        unsafe { from_glib(ffi::pango_layout_serialize_flags_get_type()) }
282    }
283}
284
285#[cfg(feature = "v1_50")]
286#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
287impl glib::HasParamSpec for LayoutSerializeFlags {
288    type ParamSpec = glib::ParamSpecFlags;
289    type SetValue = Self;
290    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
291
292    fn param_spec_builder() -> Self::BuilderFn {
293        Self::ParamSpec::builder
294    }
295}
296
297#[cfg(feature = "v1_50")]
298#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
299impl glib::value::ValueType for LayoutSerializeFlags {
300    type Type = Self;
301}
302
303#[cfg(feature = "v1_50")]
304#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
305unsafe impl<'a> glib::value::FromValue<'a> for LayoutSerializeFlags {
306    type Checker = glib::value::GenericValueTypeChecker<Self>;
307
308    #[inline]
309    unsafe fn from_value(value: &'a glib::Value) -> Self {
310        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
311    }
312}
313
314#[cfg(feature = "v1_50")]
315#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
316impl ToValue for LayoutSerializeFlags {
317    #[inline]
318    fn to_value(&self) -> glib::Value {
319        let mut value = glib::Value::for_value_type::<Self>();
320        unsafe {
321            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
322        }
323        value
324    }
325
326    #[inline]
327    fn value_type(&self) -> glib::Type {
328        Self::static_type()
329    }
330}
331
332#[cfg(feature = "v1_50")]
333#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
334impl From<LayoutSerializeFlags> for glib::Value {
335    #[inline]
336    fn from(v: LayoutSerializeFlags) -> Self {
337        ToValue::to_value(&v)
338    }
339}
340
341#[cfg(feature = "v1_44")]
342bitflags! {
343    /// Flags influencing the shaping process.
344    ///
345    /// [`ShapeFlags`][crate::ShapeFlags] can be passed to [`shape_with_flags()`][crate::shape_with_flags()].
346    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
347    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
348    #[doc(alias = "PangoShapeFlags")]
349    pub struct ShapeFlags: u32 {
350        /// Default value
351        #[doc(alias = "PANGO_SHAPE_NONE")]
352        const NONE = ffi::PANGO_SHAPE_NONE as _;
353        /// Round glyph positions and widths to whole device units
354        ///   This option should be set if the target renderer can't do subpixel positioning of glyphs
355        #[doc(alias = "PANGO_SHAPE_ROUND_POSITIONS")]
356        const ROUND_POSITIONS = ffi::PANGO_SHAPE_ROUND_POSITIONS as _;
357    }
358}
359
360#[cfg(feature = "v1_44")]
361#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
362#[doc(hidden)]
363impl IntoGlib for ShapeFlags {
364    type GlibType = ffi::PangoShapeFlags;
365
366    #[inline]
367    fn into_glib(self) -> ffi::PangoShapeFlags {
368        self.bits()
369    }
370}
371
372#[cfg(feature = "v1_44")]
373#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
374#[doc(hidden)]
375impl FromGlib<ffi::PangoShapeFlags> for ShapeFlags {
376    #[inline]
377    unsafe fn from_glib(value: ffi::PangoShapeFlags) -> Self {
378        Self::from_bits_truncate(value)
379    }
380}
381
382#[cfg(feature = "v1_44")]
383#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
384impl StaticType for ShapeFlags {
385    #[inline]
386    #[doc(alias = "pango_shape_flags_get_type")]
387    fn static_type() -> glib::Type {
388        unsafe { from_glib(ffi::pango_shape_flags_get_type()) }
389    }
390}
391
392#[cfg(feature = "v1_44")]
393#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
394impl glib::HasParamSpec for ShapeFlags {
395    type ParamSpec = glib::ParamSpecFlags;
396    type SetValue = Self;
397    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
398
399    fn param_spec_builder() -> Self::BuilderFn {
400        Self::ParamSpec::builder
401    }
402}
403
404#[cfg(feature = "v1_44")]
405#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
406impl glib::value::ValueType for ShapeFlags {
407    type Type = Self;
408}
409
410#[cfg(feature = "v1_44")]
411#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
412unsafe impl<'a> glib::value::FromValue<'a> for ShapeFlags {
413    type Checker = glib::value::GenericValueTypeChecker<Self>;
414
415    #[inline]
416    unsafe fn from_value(value: &'a glib::Value) -> Self {
417        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
418    }
419}
420
421#[cfg(feature = "v1_44")]
422#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
423impl ToValue for ShapeFlags {
424    #[inline]
425    fn to_value(&self) -> glib::Value {
426        let mut value = glib::Value::for_value_type::<Self>();
427        unsafe {
428            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
429        }
430        value
431    }
432
433    #[inline]
434    fn value_type(&self) -> glib::Type {
435        Self::static_type()
436    }
437}
438
439#[cfg(feature = "v1_44")]
440#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
441impl From<ShapeFlags> for glib::Value {
442    #[inline]
443    fn from(v: ShapeFlags) -> Self {
444        ToValue::to_value(&v)
445    }
446}
447
448#[cfg(feature = "v1_44")]
449bitflags! {
450    /// These flags affect how Pango treats characters that are normally
451    /// not visible in the output.
452    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
453    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
454    #[doc(alias = "PangoShowFlags")]
455    pub struct ShowFlags: u32 {
456        /// No special treatment for invisible characters
457        #[doc(alias = "PANGO_SHOW_NONE")]
458        const NONE = ffi::PANGO_SHOW_NONE as _;
459        /// Render spaces, tabs and newlines visibly
460        #[doc(alias = "PANGO_SHOW_SPACES")]
461        const SPACES = ffi::PANGO_SHOW_SPACES as _;
462        /// Render line breaks visibly
463        #[doc(alias = "PANGO_SHOW_LINE_BREAKS")]
464        const LINE_BREAKS = ffi::PANGO_SHOW_LINE_BREAKS as _;
465        /// Render default-ignorable Unicode
466        ///   characters visibly
467        #[doc(alias = "PANGO_SHOW_IGNORABLES")]
468        const IGNORABLES = ffi::PANGO_SHOW_IGNORABLES as _;
469    }
470}
471
472#[cfg(feature = "v1_44")]
473#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
474#[doc(hidden)]
475impl IntoGlib for ShowFlags {
476    type GlibType = ffi::PangoShowFlags;
477
478    #[inline]
479    fn into_glib(self) -> ffi::PangoShowFlags {
480        self.bits()
481    }
482}
483
484#[cfg(feature = "v1_44")]
485#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
486#[doc(hidden)]
487impl FromGlib<ffi::PangoShowFlags> for ShowFlags {
488    #[inline]
489    unsafe fn from_glib(value: ffi::PangoShowFlags) -> Self {
490        Self::from_bits_truncate(value)
491    }
492}
493
494#[cfg(feature = "v1_44")]
495#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
496impl StaticType for ShowFlags {
497    #[inline]
498    #[doc(alias = "pango_show_flags_get_type")]
499    fn static_type() -> glib::Type {
500        unsafe { from_glib(ffi::pango_show_flags_get_type()) }
501    }
502}
503
504#[cfg(feature = "v1_44")]
505#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
506impl glib::HasParamSpec for ShowFlags {
507    type ParamSpec = glib::ParamSpecFlags;
508    type SetValue = Self;
509    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
510
511    fn param_spec_builder() -> Self::BuilderFn {
512        Self::ParamSpec::builder
513    }
514}
515
516#[cfg(feature = "v1_44")]
517#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
518impl glib::value::ValueType for ShowFlags {
519    type Type = Self;
520}
521
522#[cfg(feature = "v1_44")]
523#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
524unsafe impl<'a> glib::value::FromValue<'a> for ShowFlags {
525    type Checker = glib::value::GenericValueTypeChecker<Self>;
526
527    #[inline]
528    unsafe fn from_value(value: &'a glib::Value) -> Self {
529        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
530    }
531}
532
533#[cfg(feature = "v1_44")]
534#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
535impl ToValue for ShowFlags {
536    #[inline]
537    fn to_value(&self) -> glib::Value {
538        let mut value = glib::Value::for_value_type::<Self>();
539        unsafe {
540            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
541        }
542        value
543    }
544
545    #[inline]
546    fn value_type(&self) -> glib::Type {
547        Self::static_type()
548    }
549}
550
551#[cfg(feature = "v1_44")]
552#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
553impl From<ShowFlags> for glib::Value {
554    #[inline]
555    fn from(v: ShowFlags) -> Self {
556        ToValue::to_value(&v)
557    }
558}