Skip to content

[BUG] The function pango::LayoutLine::x_ranges return a malformed value #1563

@GrounzerLiu

Description

@GrounzerLiu

Bug description

Pango.LayoutLine.get_x_ranges
The Pango documentation states that the length of the ranges is 2 * n_ranges.

    pub fn x_ranges(&self, start_index: i32, end_index: i32) -> Vec<i32> {
        unsafe {
            let mut ranges = std::ptr::null_mut();
            let mut n_ranges = std::mem::MaybeUninit::uninit();
            ffi::pango_layout_line_get_x_ranges(
                self.to_glib_none().0,
                start_index,
                end_index,
                &mut ranges,
                n_ranges.as_mut_ptr(),
            );
            FromGlibContainer::from_glib_full_num(ranges, n_ranges.assume_init() as _)
        }
    }

Here, FromGlibContainer::from_glib_full_num(ranges, n_ranges.assume_init() as _) should be FromGlibContainer::from_glib_full_num(ranges, (2 * n_ranges.assume_init()) as _).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions