neovim-gtk/src/sys/pango/mod.rs

44 lines
864 B
Rust
Raw Normal View History

2017-08-24 14:41:20 +00:00
pub mod item;
2017-08-20 18:09:57 +00:00
mod analysis;
use std::ptr;
use std::ffi::CStr;
use pango;
use pango_sys;
use glib::translate::*;
pub fn pango_itemize(
context: &pango::Context,
2017-08-24 14:41:20 +00:00
text: &String,
attrs: &pango::AttrList
) -> Vec<item::Item> {
unsafe {
FromGlibPtrContainer::from_glib_container(pango_sys::pango_itemize(
context.to_glib_none().0,
2017-08-24 14:41:20 +00:00
text.as_ptr() as *const i8,
0,
text.len() as i32,
attrs.to_glib_none().0,
ptr::null_mut(),
))
}
}
pub fn pango_shape(
2017-08-24 14:41:20 +00:00
text: &String,
2017-08-20 18:09:57 +00:00
analysis: &analysis::Analysis,
glyphs: &mut pango::GlyphString,
) {
unsafe {
pango_sys::pango_shape(
2017-08-24 14:41:20 +00:00
text.as_ptr() as *const i8,
text.len() as i32,
2017-08-20 18:09:57 +00:00
analysis.to_glib_ptr(),
glyphs.to_glib_none_mut().0,
);
}
}
2017-08-20 18:09:57 +00:00