Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
pangocairo: Merge pull request #4 from GuillaumeGomez/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
GuillaumeGomez committed Oct 8, 2017
2 parents c98063a + 44f0d04 commit ec80693
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage = "http://gtk-rs.org/"
authors = ["The Gtk-rs Project Developers"]
keywords = ["pango", "cairo", "gtk-rs", "gnome"]
readme = "README.md"
version = "0.2.1"
version = "0.3.0"
description = "Rust bindings for the PangoCairo library"
repository = "https://github.com/gtk-rs/pangocairo"
license = "MIT"
Expand Down Expand Up @@ -38,7 +38,7 @@ version = "0.4.0"
git = "https://github.com/gtk-rs/cairo"

[dependencies.pangocairo-sys]
version = "0.4.1"
version = "0.5.0"
git = "https://github.com/gtk-rs/sys"

[dependencies.pango]
Expand Down
79 changes: 79 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,92 @@ generate = [
]

manual = [
"cairo.Context",
"cairo.FontType",
"cairo.FontOptions",
"cairo.ScaledFont",
"GLib.Error",
"Pango.Context",
"Pango.Font",
"Pango.FontMap",
"Pango.GlyphItem",
"Pango.GlyphString",
"Pango.Layout",
"Pango.LayoutLine",
]

[[object]]
name = "PangoCairo.*"
status = "generate"
[[object.function]]
name = "context_get_font_options"
ignore = true
[[object.function]]
name = "create_context"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "create_layout"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "error_underline_path"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "glyph_string_path"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "layout_line_path"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "layout_path"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "show_error_underline"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "show_glyph_item"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "show_glyph_string"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "show_layout"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "show_layout_line"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "update_context"
[[object.function.parameter]]
name = "cr"
const = true
[[object.function]]
name = "update_layout"
[[object.function.parameter]]
name = "cr"
const = true

[[object]]
name = "PangoCairo.FontMap"
status = "generate"
Expand Down
6 changes: 5 additions & 1 deletion src/auto/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use pango;
use pango_ffi;
use std::mem;
use std::ptr;

glib_wrapper! {
pub struct Font(Object<ffi::PangoCairoFont>);
pub struct Font(Object<ffi::PangoCairoFont>): [
pango::Font => pango_ffi::PangoFont,
];

match fn {
get_type => || ffi::pango_cairo_font_get_type(),
Expand Down
115 changes: 115 additions & 0 deletions src/auto/functions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// This file was generated by gir (0fe730d) from gir-files (469db10)
// DO NOT EDIT

use cairo;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use pango;


pub fn context_get_resolution(context: &pango::Context) -> f64 {
unsafe {
ffi::pango_cairo_context_get_resolution(context.to_glib_none().0)
}
}

//pub fn context_get_shape_renderer<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(context: &pango::Context, data: P) -> /*Unknown conversion*//*Unimplemented*/ShapeRendererFunc {
// unsafe { TODO: call ffi::pango_cairo_context_get_shape_renderer() }
//}

pub fn context_set_font_options<'a, P: Into<Option<&'a cairo::FontOptions>>>(context: &pango::Context, options: P) {
let options = options.into();
let options = options.to_glib_none();
unsafe {
ffi::pango_cairo_context_set_font_options(context.to_glib_none().0, options.0);
}
}

pub fn context_set_resolution(context: &pango::Context, dpi: f64) {
unsafe {
ffi::pango_cairo_context_set_resolution(context.to_glib_none().0, dpi);
}
}

//pub fn context_set_shape_renderer<'a, P: Into<Option<&'a /*Unimplemented*/ShapeRendererFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(context: &pango::Context, func: P, data: Q, dnotify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::pango_cairo_context_set_shape_renderer() }
//}

pub fn create_context(cr: &cairo::Context) -> Option<pango::Context> {
unsafe {
from_glib_full(ffi::pango_cairo_create_context(mut_override(cr.to_glib_none().0)))
}
}

pub fn create_layout(cr: &cairo::Context) -> Option<pango::Layout> {
unsafe {
from_glib_full(ffi::pango_cairo_create_layout(mut_override(cr.to_glib_none().0)))
}
}

pub fn error_underline_path(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
unsafe {
ffi::pango_cairo_error_underline_path(mut_override(cr.to_glib_none().0), x, y, width, height);
}
}

pub fn glyph_string_path<P: IsA<pango::Font>>(cr: &cairo::Context, font: &P, glyphs: &mut pango::GlyphString) {
unsafe {
ffi::pango_cairo_glyph_string_path(mut_override(cr.to_glib_none().0), font.to_glib_none().0, glyphs.to_glib_none_mut().0);
}
}

pub fn layout_line_path(cr: &cairo::Context, line: &pango::LayoutLine) {
unsafe {
ffi::pango_cairo_layout_line_path(mut_override(cr.to_glib_none().0), line.to_glib_none().0);
}
}

pub fn layout_path(cr: &cairo::Context, layout: &pango::Layout) {
unsafe {
ffi::pango_cairo_layout_path(mut_override(cr.to_glib_none().0), layout.to_glib_none().0);
}
}

pub fn show_error_underline(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
unsafe {
ffi::pango_cairo_show_error_underline(mut_override(cr.to_glib_none().0), x, y, width, height);
}
}

pub fn show_glyph_item(cr: &cairo::Context, text: &str, glyph_item: &mut pango::GlyphItem) {
unsafe {
ffi::pango_cairo_show_glyph_item(mut_override(cr.to_glib_none().0), text.to_glib_none().0, glyph_item.to_glib_none_mut().0);
}
}

pub fn show_glyph_string<P: IsA<pango::Font>>(cr: &cairo::Context, font: &P, glyphs: &mut pango::GlyphString) {
unsafe {
ffi::pango_cairo_show_glyph_string(mut_override(cr.to_glib_none().0), font.to_glib_none().0, glyphs.to_glib_none_mut().0);
}
}

pub fn show_layout(cr: &cairo::Context, layout: &pango::Layout) {
unsafe {
ffi::pango_cairo_show_layout(mut_override(cr.to_glib_none().0), layout.to_glib_none().0);
}
}

pub fn show_layout_line(cr: &cairo::Context, line: &pango::LayoutLine) {
unsafe {
ffi::pango_cairo_show_layout_line(mut_override(cr.to_glib_none().0), line.to_glib_none().0);
}
}

pub fn update_context(cr: &cairo::Context, context: &pango::Context) {
unsafe {
ffi::pango_cairo_update_context(mut_override(cr.to_glib_none().0), context.to_glib_none().0);
}
}

pub fn update_layout(cr: &cairo::Context, layout: &pango::Layout) {
unsafe {
ffi::pango_cairo_update_layout(mut_override(cr.to_glib_none().0), layout.to_glib_none().0);
}
}
2 changes: 2 additions & 0 deletions src/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ mod font_map;
pub use self::font_map::FontMap;
pub use self::font_map::FontMapExt;

pub mod functions;

#[doc(hidden)]
pub mod traits {
pub use super::FontExt;
Expand Down

0 comments on commit ec80693

Please sign in to comment.