1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Take a look at the license at the top of the repository in the LICENSE file.

use std::fmt;

#[derive(Clone, Copy)]
#[repr(transparent)]
#[doc(alias = "cairo_text_cluster_t")]
pub struct TextCluster(ffi::cairo_text_cluster_t);

impl TextCluster {
    pub fn num_bytes(&self) -> i32 {
        self.0.num_bytes
    }

    pub fn num_glyphs(&self) -> i32 {
        self.0.num_glyphs
    }
}

impl fmt::Debug for TextCluster {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.debug_struct("TextCluster")
            .field("num_glyphs", &self.num_glyphs())
            .field("num_glyphs", &self.num_glyphs())
            .finish()
    }
}