pango/auto/
font_description.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, FontMask, Gravity, Stretch, Style, Variant, Weight};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// A [`FontDescription`][crate::FontDescription] describes a font in an implementation-independent
10    /// manner.
11    ///
12    /// [`FontDescription`][crate::FontDescription] structures are used both to list what fonts are
13    /// available on the system and also for specifying the characteristics of
14    /// a font to load.
15    #[derive(Debug, PartialOrd, Ord)]
16    pub struct FontDescription(Boxed<ffi::PangoFontDescription>);
17
18    match fn {
19        copy => |ptr| ffi::pango_font_description_copy(ptr),
20        free => |ptr| ffi::pango_font_description_free(ptr),
21        type_ => || ffi::pango_font_description_get_type(),
22    }
23}
24
25impl FontDescription {
26    /// Creates a new font description structure with all fields unset.
27    ///
28    /// # Returns
29    ///
30    /// the newly allocated [`FontDescription`][crate::FontDescription],
31    ///   which should be freed using `Pango::FontDescription::free()`.
32    #[doc(alias = "pango_font_description_new")]
33    pub fn new() -> FontDescription {
34        unsafe { from_glib_full(ffi::pango_font_description_new()) }
35    }
36
37    /// Determines if the style attributes of @new_match are a closer match
38    /// for @self than those of @old_match are, or if @old_match is [`None`],
39    /// determines if @new_match is a match at all.
40    ///
41    /// Approximate matching is done for weight and style; other style attributes
42    /// must match exactly. Style attributes are all attributes other than family
43    /// and size-related attributes. Approximate matching for style considers
44    /// [`Style::Oblique`][crate::Style::Oblique] and [`Style::Italic`][crate::Style::Italic] as matches, but not as good
45    /// a match as when the styles are equal.
46    ///
47    /// Note that @old_match must match @self.
48    /// ## `old_match`
49    /// a [`FontDescription`][crate::FontDescription], or [`None`]
50    /// ## `new_match`
51    /// a [`FontDescription`][crate::FontDescription]
52    ///
53    /// # Returns
54    ///
55    /// [`true`] if @new_match is a better match
56    #[doc(alias = "pango_font_description_better_match")]
57    pub fn better_match(
58        &self,
59        old_match: Option<&FontDescription>,
60        new_match: &FontDescription,
61    ) -> bool {
62        unsafe {
63            from_glib(ffi::pango_font_description_better_match(
64                self.to_glib_none().0,
65                old_match.to_glib_none().0,
66                new_match.to_glib_none().0,
67            ))
68        }
69    }
70
71    #[doc(alias = "pango_font_description_equal")]
72    fn equal(&self, desc2: &FontDescription) -> bool {
73        unsafe {
74            from_glib(ffi::pango_font_description_equal(
75                self.to_glib_none().0,
76                desc2.to_glib_none().0,
77            ))
78        }
79    }
80
81    /// Gets the family name field of a font description.
82    ///
83    /// See [`set_family()`][Self::set_family()].
84    ///
85    /// # Returns
86    ///
87    /// the family name field for the
88    ///   font description, or [`None`] if not previously set. This has the same
89    ///   life-time as the font description itself and should not be freed.
90    #[doc(alias = "pango_font_description_get_family")]
91    #[doc(alias = "get_family")]
92    pub fn family(&self) -> Option<glib::GString> {
93        unsafe {
94            from_glib_none(ffi::pango_font_description_get_family(
95                self.to_glib_none().0,
96            ))
97        }
98    }
99
100    /// Gets the features field of a font description.
101    ///
102    /// See [`set_features()`][Self::set_features()].
103    ///
104    /// # Returns
105    ///
106    /// the features field for the font
107    ///   description, or [`None`] if not previously set. This has the same
108    ///   life-time as the font description itself and should not be freed.
109    #[cfg(feature = "v1_56")]
110    #[cfg_attr(docsrs, doc(cfg(feature = "v1_56")))]
111    #[doc(alias = "pango_font_description_get_features")]
112    #[doc(alias = "get_features")]
113    pub fn features(&self) -> Option<glib::GString> {
114        unsafe {
115            from_glib_none(ffi::pango_font_description_get_features(
116                self.to_glib_none().0,
117            ))
118        }
119    }
120
121    /// Gets the gravity field of a font description.
122    ///
123    /// See [`set_gravity()`][Self::set_gravity()].
124    ///
125    /// # Returns
126    ///
127    /// the gravity field for the font description.
128    ///   Use [`set_fields()`][Self::set_fields()] to find out
129    ///   if the field was explicitly set or not.
130    #[doc(alias = "pango_font_description_get_gravity")]
131    #[doc(alias = "get_gravity")]
132    pub fn gravity(&self) -> Gravity {
133        unsafe {
134            from_glib(ffi::pango_font_description_get_gravity(
135                self.to_glib_none().0,
136            ))
137        }
138    }
139
140    /// Determines which fields in a font description have been set.
141    ///
142    /// # Returns
143    ///
144    /// a bitmask with bits set corresponding to the
145    ///   fields in @self that have been set.
146    #[doc(alias = "pango_font_description_get_set_fields")]
147    #[doc(alias = "get_set_fields")]
148    pub fn set_fields(&self) -> FontMask {
149        unsafe {
150            from_glib(ffi::pango_font_description_get_set_fields(
151                self.to_glib_none().0,
152            ))
153        }
154    }
155
156    /// Gets the size field of a font description.
157    ///
158    /// See [`set_size()`][Self::set_size()].
159    ///
160    /// # Returns
161    ///
162    /// the size field for the font description in points
163    ///   or device units. You must call
164    ///   [`is_size_absolute()`][Self::is_size_absolute()] to find out
165    ///   which is the case. Returns 0 if the size field has not previously
166    ///   been set or it has been set to 0 explicitly.
167    ///   Use [`set_fields()`][Self::set_fields()] to find out
168    ///   if the field was explicitly set or not.
169    #[doc(alias = "pango_font_description_get_size")]
170    #[doc(alias = "get_size")]
171    pub fn size(&self) -> i32 {
172        unsafe { ffi::pango_font_description_get_size(self.to_glib_none().0) }
173    }
174
175    /// Determines whether the size of the font is in points (not absolute)
176    /// or device units (absolute).
177    ///
178    /// See [`set_size()`][Self::set_size()]
179    /// and [`set_absolute_size()`][Self::set_absolute_size()].
180    ///
181    /// # Returns
182    ///
183    /// whether the size for the font description is in
184    ///   points or device units. Use [`set_fields()`][Self::set_fields()]
185    ///   to find out if the size field of the font description was explicitly
186    ///   set or not.
187    #[doc(alias = "pango_font_description_get_size_is_absolute")]
188    #[doc(alias = "get_size_is_absolute")]
189    pub fn is_size_absolute(&self) -> bool {
190        unsafe {
191            from_glib(ffi::pango_font_description_get_size_is_absolute(
192                self.to_glib_none().0,
193            ))
194        }
195    }
196
197    /// Gets the stretch field of a font description.
198    ///
199    /// See [`set_stretch()`][Self::set_stretch()].
200    ///
201    /// # Returns
202    ///
203    /// the stretch field for the font description.
204    ///   Use [`set_fields()`][Self::set_fields()] to find
205    ///   out if the field was explicitly set or not.
206    #[doc(alias = "pango_font_description_get_stretch")]
207    #[doc(alias = "get_stretch")]
208    pub fn stretch(&self) -> Stretch {
209        unsafe {
210            from_glib(ffi::pango_font_description_get_stretch(
211                self.to_glib_none().0,
212            ))
213        }
214    }
215
216    /// Gets the style field of a [`FontDescription`][crate::FontDescription].
217    ///
218    /// See [`set_style()`][Self::set_style()].
219    ///
220    /// # Returns
221    ///
222    /// the style field for the font description.
223    ///   Use [`set_fields()`][Self::set_fields()] to
224    ///   find out if the field was explicitly set or not.
225    #[doc(alias = "pango_font_description_get_style")]
226    #[doc(alias = "get_style")]
227    pub fn style(&self) -> Style {
228        unsafe { from_glib(ffi::pango_font_description_get_style(self.to_glib_none().0)) }
229    }
230
231    /// Gets the variant field of a [`FontDescription`][crate::FontDescription].
232    ///
233    /// See [`set_variant()`][Self::set_variant()].
234    ///
235    /// # Returns
236    ///
237    /// the variant field for the font description.
238    ///   Use [`set_fields()`][Self::set_fields()] to find
239    ///   out if the field was explicitly set or not.
240    #[doc(alias = "pango_font_description_get_variant")]
241    #[doc(alias = "get_variant")]
242    pub fn variant(&self) -> Variant {
243        unsafe {
244            from_glib(ffi::pango_font_description_get_variant(
245                self.to_glib_none().0,
246            ))
247        }
248    }
249
250    /// Gets the variations field of a font description.
251    ///
252    /// See [`set_variations()`][Self::set_variations()].
253    ///
254    /// # Returns
255    ///
256    /// the variations field for the font
257    ///   description, or [`None`] if not previously set. This has the same
258    ///   life-time as the font description itself and should not be freed.
259    #[cfg(feature = "v1_42")]
260    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
261    #[doc(alias = "pango_font_description_get_variations")]
262    #[doc(alias = "get_variations")]
263    pub fn variations(&self) -> Option<glib::GString> {
264        unsafe {
265            from_glib_none(ffi::pango_font_description_get_variations(
266                self.to_glib_none().0,
267            ))
268        }
269    }
270
271    /// Gets the weight field of a font description.
272    ///
273    /// See [`set_weight()`][Self::set_weight()].
274    ///
275    /// # Returns
276    ///
277    /// the weight field for the font description.
278    ///   Use [`set_fields()`][Self::set_fields()] to find
279    ///   out if the field was explicitly set or not.
280    #[doc(alias = "pango_font_description_get_weight")]
281    #[doc(alias = "get_weight")]
282    pub fn weight(&self) -> Weight {
283        unsafe {
284            from_glib(ffi::pango_font_description_get_weight(
285                self.to_glib_none().0,
286            ))
287        }
288    }
289
290    #[doc(alias = "pango_font_description_hash")]
291    fn hash(&self) -> u32 {
292        unsafe { ffi::pango_font_description_hash(self.to_glib_none().0) }
293    }
294
295    /// Merges the fields that are set in @desc_to_merge into the fields in
296    /// @self.
297    ///
298    /// If @replace_existing is [`false`], only fields in @self that
299    /// are not already set are affected. If [`true`], then fields that are
300    /// already set will be replaced as well.
301    ///
302    /// If @desc_to_merge is [`None`], this function performs nothing.
303    /// ## `desc_to_merge`
304    /// the [`FontDescription`][crate::FontDescription] to merge from,
305    ///   or [`None`]
306    /// ## `replace_existing`
307    /// if [`true`], replace fields in @self with the
308    ///   corresponding values from @desc_to_merge, even if they
309    ///   are already exist.
310    #[doc(alias = "pango_font_description_merge")]
311    pub fn merge(&mut self, desc_to_merge: Option<&FontDescription>, replace_existing: bool) {
312        unsafe {
313            ffi::pango_font_description_merge(
314                self.to_glib_none_mut().0,
315                desc_to_merge.to_glib_none().0,
316                replace_existing.into_glib(),
317            );
318        }
319    }
320
321    /// Sets the size field of a font description, in device units.
322    ///
323    /// This is mutually exclusive with [`set_size()`][Self::set_size()]
324    /// which sets the font size in points.
325    /// ## `size`
326    /// the new size, in Pango units. There are `PANGO_SCALE` Pango units
327    ///   in one device unit. For an output backend where a device unit is a pixel,
328    ///   a @size value of 10 * PANGO_SCALE gives a 10 pixel font.
329    #[doc(alias = "pango_font_description_set_absolute_size")]
330    pub fn set_absolute_size(&mut self, size: f64) {
331        unsafe {
332            ffi::pango_font_description_set_absolute_size(self.to_glib_none_mut().0, size);
333        }
334    }
335
336    /// Sets the family name field of a font description.
337    ///
338    /// The family
339    /// name represents a family of related font styles, and will
340    /// resolve to a particular [`FontFamily`][crate::FontFamily]. In some uses of
341    /// [`FontDescription`][crate::FontDescription], it is also possible to use a comma
342    /// separated list of family names for this field.
343    /// ## `family`
344    /// a string representing the family name.
345    #[doc(alias = "pango_font_description_set_family")]
346    pub fn set_family(&mut self, family: &str) {
347        unsafe {
348            ffi::pango_font_description_set_family(
349                self.to_glib_none_mut().0,
350                family.to_glib_none().0,
351            );
352        }
353    }
354
355    /// Sets the features field of a font description.
356    ///
357    /// OpenType font features allow to enable or disable certain optional
358    /// features of a font, such as tabular numbers.
359    ///
360    /// The format of the features string is comma-separated list of
361    /// feature assignments, with each assignment being one of these forms:
362    ///
363    ///     FEATURE=n
364    ///
365    /// where FEATURE must be a 4 character tag that identifies and OpenType
366    /// feature, and n an integer (depending on the feature, the allowed
367    /// values may be 0, 1 or bigger numbers). Unknown features are ignored.
368    ///
369    /// Note that font features set in this way are enabled for the entire text
370    /// that is using the font, which is not appropriate for all OpenType features.
371    /// The intended use case is to select character variations (features cv01 - c99),
372    /// style sets (ss01 - ss20) and the like.
373    ///
374    /// Pango does not currently have a way to find supported OpenType features
375    /// of a font. Both harfbuzz and freetype have API for this. See for example
376    /// [hb_ot_layout_table_get_feature_tags](https://harfbuzz.github.io/harfbuzz-hb-ot-layout.html#hb-ot-layout-table-get-feature-tags).
377    ///
378    /// Features that are not supported by the font are silently ignored.
379    /// ## `features`
380    /// a string representing the features
381    #[cfg(feature = "v1_56")]
382    #[cfg_attr(docsrs, doc(cfg(feature = "v1_56")))]
383    #[doc(alias = "pango_font_description_set_features")]
384    pub fn set_features(&mut self, features: Option<&str>) {
385        unsafe {
386            ffi::pango_font_description_set_features(
387                self.to_glib_none_mut().0,
388                features.to_glib_none().0,
389            );
390        }
391    }
392
393    /// Sets the gravity field of a font description.
394    ///
395    /// The gravity field
396    /// specifies how the glyphs should be rotated. If @gravity is
397    /// [`Gravity::Auto`][crate::Gravity::Auto], this actually unsets the gravity mask on
398    /// the font description.
399    ///
400    /// This function is seldom useful to the user. Gravity should normally
401    /// be set on a [`Context`][crate::Context].
402    /// ## `gravity`
403    /// the gravity for the font description.
404    #[doc(alias = "pango_font_description_set_gravity")]
405    pub fn set_gravity(&mut self, gravity: Gravity) {
406        unsafe {
407            ffi::pango_font_description_set_gravity(self.to_glib_none_mut().0, gravity.into_glib());
408        }
409    }
410
411    /// Sets the size field of a font description in fractional points.
412    ///
413    /// This is mutually exclusive with
414    /// [`set_absolute_size()`][Self::set_absolute_size()].
415    /// ## `size`
416    /// the size of the font in points, scaled by `PANGO_SCALE`.
417    ///   (That is, a @size value of 10 * PANGO_SCALE is a 10 point font.
418    ///   The conversion factor between points and device units depends on
419    ///   system configuration and the output device. For screen display, a
420    ///   logical DPI of 96 is common, in which case a 10 point font corresponds
421    ///   to a 10 * (96 / 72) = 13.3 pixel font.
422    ///   Use [`set_absolute_size()`][Self::set_absolute_size()] if you need
423    ///   a particular size in device units.
424    #[doc(alias = "pango_font_description_set_size")]
425    pub fn set_size(&mut self, size: i32) {
426        unsafe {
427            ffi::pango_font_description_set_size(self.to_glib_none_mut().0, size);
428        }
429    }
430
431    /// Sets the stretch field of a font description.
432    ///
433    /// The [`Stretch`][crate::Stretch] field specifies how narrow or
434    /// wide the font should be.
435    /// ## `stretch`
436    /// the stretch for the font description
437    #[doc(alias = "pango_font_description_set_stretch")]
438    pub fn set_stretch(&mut self, stretch: Stretch) {
439        unsafe {
440            ffi::pango_font_description_set_stretch(self.to_glib_none_mut().0, stretch.into_glib());
441        }
442    }
443
444    /// Sets the style field of a [`FontDescription`][crate::FontDescription].
445    ///
446    /// The [`Style`][crate::Style] enumeration describes whether the font is
447    /// slanted and the manner in which it is slanted; it can be either
448    /// [`Style::Normal`][crate::Style::Normal], [`Style::Italic`][crate::Style::Italic], or [`Style::Oblique`][crate::Style::Oblique].
449    ///
450    /// Most fonts will either have a italic style or an oblique style,
451    /// but not both, and font matching in Pango will match italic
452    /// specifications with oblique fonts and vice-versa if an exact
453    /// match is not found.
454    /// ## `style`
455    /// the style for the font description
456    #[doc(alias = "pango_font_description_set_style")]
457    pub fn set_style(&mut self, style: Style) {
458        unsafe {
459            ffi::pango_font_description_set_style(self.to_glib_none_mut().0, style.into_glib());
460        }
461    }
462
463    /// Sets the variant field of a font description.
464    ///
465    /// The [`Variant`][struct@crate::Variant] can either be [`Variant::Normal`][crate::Variant::Normal]
466    /// or [`Variant::SmallCaps`][crate::Variant::SmallCaps].
467    /// ## `variant`
468    /// the variant type for the font description.
469    #[doc(alias = "pango_font_description_set_variant")]
470    pub fn set_variant(&mut self, variant: Variant) {
471        unsafe {
472            ffi::pango_font_description_set_variant(self.to_glib_none_mut().0, variant.into_glib());
473        }
474    }
475
476    /// Sets the variations field of a font description.
477    ///
478    /// OpenType font variations allow to select a font instance by
479    /// specifying values for a number of axes, such as width or weight.
480    ///
481    /// The format of the variations string is
482    ///
483    ///     AXIS1=VALUE,AXIS2=VALUE...
484    ///
485    /// with each AXIS a 4 character tag that identifies a font axis,
486    /// and each VALUE a floating point number. Unknown axes are ignored,
487    /// and values are clamped to their allowed range.
488    ///
489    /// Pango does not currently have a way to find supported axes of
490    /// a font. Both harfbuzz and freetype have API for this. See
491    /// for example [hb_ot_var_get_axis_infos](https://harfbuzz.github.io/harfbuzz-hb-ot-var.html#hb-ot-var-get-axis-infos).
492    /// ## `variations`
493    /// a string representing the variations
494    #[cfg(feature = "v1_42")]
495    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
496    #[doc(alias = "pango_font_description_set_variations")]
497    pub fn set_variations(&mut self, variations: Option<&str>) {
498        unsafe {
499            ffi::pango_font_description_set_variations(
500                self.to_glib_none_mut().0,
501                variations.to_glib_none().0,
502            );
503        }
504    }
505
506    /// Sets the weight field of a font description.
507    ///
508    /// The weight field
509    /// specifies how bold or light the font should be. In addition
510    /// to the values of the [`Weight`][crate::Weight] enumeration, other
511    /// intermediate numeric values are possible.
512    /// ## `weight`
513    /// the weight for the font description.
514    #[doc(alias = "pango_font_description_set_weight")]
515    pub fn set_weight(&mut self, weight: Weight) {
516        unsafe {
517            ffi::pango_font_description_set_weight(self.to_glib_none_mut().0, weight.into_glib());
518        }
519    }
520
521    /// Creates a filename representation of a font description.
522    ///
523    /// The filename is identical to the result from calling
524    /// [`to_str()`][Self::to_str()], but with underscores
525    /// instead of characters that are untypical in filenames, and in
526    /// lower case only.
527    ///
528    /// # Returns
529    ///
530    /// a new string that must be freed with g_free().
531    #[doc(alias = "pango_font_description_to_filename")]
532    pub fn to_filename(&self) -> Option<glib::GString> {
533        unsafe {
534            from_glib_full(ffi::pango_font_description_to_filename(
535                self.to_glib_none().0,
536            ))
537        }
538    }
539
540    /// Creates a string representation of a font description.
541    ///
542    /// See [`from_string()`][Self::from_string()] for a description
543    /// of the format of the string representation. The family list in
544    /// the string description will only have a terminating comma if
545    /// the last word of the list is a valid style option.
546    ///
547    /// # Returns
548    ///
549    /// a new string that must be freed with g_free().
550    #[doc(alias = "pango_font_description_to_string")]
551    #[doc(alias = "to_string")]
552    pub fn to_str(&self) -> glib::GString {
553        unsafe { from_glib_full(ffi::pango_font_description_to_string(self.to_glib_none().0)) }
554    }
555
556    /// Unsets some of the fields in a [`FontDescription`][crate::FontDescription].
557    ///
558    /// The unset fields will get back to their default values.
559    /// ## `to_unset`
560    /// bitmask of fields in the @self to unset.
561    #[doc(alias = "pango_font_description_unset_fields")]
562    pub fn unset_fields(&mut self, to_unset: FontMask) {
563        unsafe {
564            ffi::pango_font_description_unset_fields(
565                self.to_glib_none_mut().0,
566                to_unset.into_glib(),
567            );
568        }
569    }
570
571    /// Creates a new font description from a string representation.
572    ///
573    /// The string must have the form
574    ///
575    ///     [FAMILY-LIST] [STYLE-OPTIONS] [SIZE] [VARIATIONS] [FEATURES]
576    ///
577    /// where FAMILY-LIST is a comma-separated list of families optionally
578    /// terminated by a comma, STYLE_OPTIONS is a whitespace-separated list
579    /// of words where each word describes one of style, variant, weight,
580    /// stretch, or gravity, and SIZE is a decimal number (size in points)
581    /// or optionally followed by the unit modifier "px" for absolute size.
582    ///
583    /// The following words are understood as styles:
584    /// "Normal", "Roman", "Oblique", "Italic".
585    ///
586    /// The following words are understood as variants:
587    /// "Small-Caps", "All-Small-Caps", "Petite-Caps", "All-Petite-Caps",
588    /// "Unicase", "Title-Caps".
589    ///
590    /// The following words are understood as weights:
591    /// "Thin", "Ultra-Light", "Extra-Light", "Light", "Semi-Light",
592    /// "Demi-Light", "Book", "Regular", "Medium", "Semi-Bold", "Demi-Bold",
593    /// "Bold", "Ultra-Bold", "Extra-Bold", "Heavy", "Black", "Ultra-Black",
594    /// "Extra-Black".
595    ///
596    /// The following words are understood as stretch values:
597    /// "Ultra-Condensed", "Extra-Condensed", "Condensed", "Semi-Condensed",
598    /// "Semi-Expanded", "Expanded", "Extra-Expanded", "Ultra-Expanded".
599    ///
600    /// The following words are understood as gravity values:
601    /// "Not-Rotated", "South", "Upside-Down", "North", "Rotated-Left",
602    /// "East", "Rotated-Right", "West".
603    ///
604    /// VARIATIONS is a comma-separated list of font variations
605    /// of the form @‍axis1=value,axis2=value,...
606    ///
607    /// FEATURES is a comma-separated list of font features of the form
608    /// \#‍feature1=value,feature2=value,...
609    ///
610    /// Any one of the options may be absent. If FAMILY-LIST is absent, then
611    /// the family_name field of the resulting font description will be
612    /// initialized to [`None`]. If STYLE-OPTIONS is missing, then all style
613    /// options will be set to the default values. If SIZE is missing, the
614    /// size in the resulting font description will be set to 0.
615    ///
616    /// A typical example:
617    ///
618    ///     Cantarell Italic Light 15 @‍wght=200 #‍tnum=1
619    /// ## `str`
620    /// string representation of a font description.
621    ///
622    /// # Returns
623    ///
624    /// a new [`FontDescription`][crate::FontDescription].
625    #[doc(alias = "pango_font_description_from_string")]
626    pub fn from_string(str: &str) -> FontDescription {
627        unsafe {
628            from_glib_full(ffi::pango_font_description_from_string(
629                str.to_glib_none().0,
630            ))
631        }
632    }
633}
634
635impl Default for FontDescription {
636    fn default() -> Self {
637        Self::new()
638    }
639}
640
641impl PartialEq for FontDescription {
642    #[inline]
643    fn eq(&self, other: &Self) -> bool {
644        self.equal(other)
645    }
646}
647
648impl Eq for FontDescription {}
649
650impl std::fmt::Display for FontDescription {
651    #[inline]
652    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
653        f.write_str(&self.to_str())
654    }
655}
656
657impl std::hash::Hash for FontDescription {
658    #[inline]
659    fn hash<H>(&self, state: &mut H)
660    where
661        H: std::hash::Hasher,
662    {
663        std::hash::Hash::hash(&self.hash(), state)
664    }
665}
666
667unsafe impl Send for FontDescription {}
668unsafe impl Sync for FontDescription {}