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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use Font;
use Rectangle;
use ffi;
use glib::translate::*;
glib_wrapper! {
pub struct GlyphString(Boxed<ffi::PangoGlyphString>);
match fn {
copy => |ptr| ffi::pango_glyph_string_copy(mut_override(ptr)),
free => |ptr| ffi::pango_glyph_string_free(ptr),
}
}
impl GlyphString {
pub fn new() -> GlyphString {
unsafe {
from_glib_full(ffi::pango_glyph_string_new())
}
}
pub fn extents(&mut self, font: &Font) -> (Rectangle, Rectangle) {
unsafe {
let mut ink_rect = Rectangle::uninitialized();
let mut logical_rect = Rectangle::uninitialized();
ffi::pango_glyph_string_extents(self.to_glib_none_mut().0, font.to_glib_none().0, ink_rect.to_glib_none_mut().0, logical_rect.to_glib_none_mut().0);
(ink_rect, logical_rect)
}
}
pub fn extents_range(&mut self, start: i32, end: i32, font: &Font) -> (Rectangle, Rectangle) {
unsafe {
let mut ink_rect = Rectangle::uninitialized();
let mut logical_rect = Rectangle::uninitialized();
ffi::pango_glyph_string_extents_range(self.to_glib_none_mut().0, start, end, font.to_glib_none().0, ink_rect.to_glib_none_mut().0, logical_rect.to_glib_none_mut().0);
(ink_rect, logical_rect)
}
}
pub fn get_width(&mut self) -> i32 {
unsafe {
ffi::pango_glyph_string_get_width(self.to_glib_none_mut().0)
}
}
pub fn set_size(&mut self, new_len: i32) {
unsafe {
ffi::pango_glyph_string_set_size(self.to_glib_none_mut().0, new_len);
}
}
}