pango_itemize/pango_shape implementation

This commit is contained in:
daa84
2017-08-18 18:35:33 +03:00
parent b2ae40982f
commit 063bd86fd7
6 changed files with 95 additions and 0 deletions

19
src/render/mod.rs Normal file
View File

@@ -0,0 +1,19 @@
use sys::pango::*;
use pango;
use cairo;
use pangocairo::CairoContextExt;
use std::ffi::CString;
pub fn render(ctx: &cairo::Context) {
let pango_context = ctx.create_pango_context();
let text = "TEST String".to_owned().into_bytes();
let len = text.len();
let text = CString::new(text).unwrap();
let attr_list = pango::AttrList::new();
let items = pango_itemize(&pango_context, &text, 0, len, &attr_list);
for item in items {
let mut glyphs = pango::GlyphString::new();
pango_shape(&text, len, item.analysis(), &mut glyphs);
}
}