Skip to content

Commit cc97e01

Browse files
authored
Merge pull request #1564 from sdroege/pango-layoutline-xranges
pango: Fix `LayoutLine::x_ranges()` bindings
2 parents 27de993 + 0028a7a commit cc97e01

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

pango/Gir.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ status = "generate"
383383
[[object.function]]
384384
name = "x_to_index"
385385
manual = true
386+
[[object.function]]
387+
name = "get_x_ranges"
388+
manual = true
386389

387390
[[object]]
388391
name = "Pango.Matrix"

pango/src/auto/layout_line.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,6 @@ impl LayoutLine {
9090
unsafe { ffi::pango_layout_line_get_start_index(self.to_glib_none().0) }
9191
}
9292

93-
#[doc(alias = "pango_layout_line_get_x_ranges")]
94-
#[doc(alias = "get_x_ranges")]
95-
pub fn x_ranges(&self, start_index: i32, end_index: i32) -> Vec<i32> {
96-
unsafe {
97-
let mut ranges = std::ptr::null_mut();
98-
let mut n_ranges = std::mem::MaybeUninit::uninit();
99-
ffi::pango_layout_line_get_x_ranges(
100-
self.to_glib_none().0,
101-
start_index,
102-
end_index,
103-
&mut ranges,
104-
n_ranges.as_mut_ptr(),
105-
);
106-
FromGlibContainer::from_glib_full_num(ranges, n_ranges.assume_init() as _)
107-
}
108-
}
109-
11093
#[doc(alias = "pango_layout_line_index_to_x")]
11194
pub fn index_to_x(&self, index_: i32, trailing: bool) -> i32 {
11295
unsafe {

pango/src/layout.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,21 @@ impl LayoutLine {
9090
is_inside,
9191
}
9292
}
93+
94+
#[doc(alias = "pango_layout_line_get_x_ranges")]
95+
#[doc(alias = "get_x_ranges")]
96+
pub fn x_ranges(&self, start_index: i32, end_index: i32) -> Vec<i32> {
97+
unsafe {
98+
let mut ranges = std::ptr::null_mut();
99+
let mut n_ranges = std::mem::MaybeUninit::uninit();
100+
ffi::pango_layout_line_get_x_ranges(
101+
self.to_glib_none().0,
102+
start_index,
103+
end_index,
104+
&mut ranges,
105+
n_ranges.as_mut_ptr(),
106+
);
107+
FromGlibContainer::from_glib_full_num(ranges, 2 * n_ranges.assume_init() as usize)
108+
}
109+
}
93110
}

0 commit comments

Comments
 (0)