This commit is contained in:
daa84
2017-08-24 17:41:20 +03:00
parent aad5dc2112
commit 17063d5216
5 changed files with 155 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
mod item;
pub mod item;
mod analysis;
use std::ptr;
@@ -11,17 +11,15 @@ use glib::translate::*;
pub fn pango_itemize(
context: &pango::Context,
text: &CStr,
start_index: usize,
length: usize,
attrs: &pango::AttrList,
text: &String,
attrs: &pango::AttrList
) -> Vec<item::Item> {
unsafe {
FromGlibPtrContainer::from_glib_container(pango_sys::pango_itemize(
context.to_glib_none().0,
text.as_ptr(),
start_index as i32,
length as i32,
text.as_ptr() as *const i8,
0,
text.len() as i32,
attrs.to_glib_none().0,
ptr::null_mut(),
))
@@ -29,15 +27,14 @@ pub fn pango_itemize(
}
pub fn pango_shape(
text: &CStr,
length: usize,
text: &String,
analysis: &analysis::Analysis,
glyphs: &mut pango::GlyphString,
) {
unsafe {
pango_sys::pango_shape(
text.as_ptr(),
length as i32,
text.as_ptr() as *const i8,
text.len() as i32,
analysis.to_glib_ptr(),
glyphs.to_glib_none_mut().0,
);