Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Added an autogeneration using gir.
Browse files Browse the repository at this point in the history
  • Loading branch information
RazrFalcon committed Feb 25, 2017
1 parent 1ca762d commit 3a070a5
Show file tree
Hide file tree
Showing 13 changed files with 631 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "gir"]
path = gir
url = https://github.com/gtk-rs/gir.git
[submodule "gir-files"]
path = gir-files
url = https://github.com/gtk-rs/gir-files.git
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ version = "0.3.2"
[dependencies.glib]
git = "https://github.com/gtk-rs/glib"
version = "0.1.1"

[dependencies.glib-sys]
git = "https://github.com/gtk-rs/sys"
version = "0.3.2"
19 changes: 19 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[options]
girs_dir = "gir-files"
library = "Pango"
version = "1.0"
target_path = "."
work_mode = "normal"
generate_safety_asserts = false
min_cfg_version = "1.30"

generate = [
"Pango.Context",
"Pango.Layout",
"Pango.Alignment",
"Pango.FontMap",
]

manual = [
"Pango.FontDescription",
]
1 change: 1 addition & 0 deletions gir
Submodule gir added at aacfc9
1 change: 1 addition & 0 deletions gir-files
Submodule gir-files added at 71d73f
121 changes: 121 additions & 0 deletions src/auto/context.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// This file was generated by gir (aacfc92) from gir-files (71d73f0)
// DO NOT EDIT

use FontDescription;
use FontMap;
use ffi;
use glib::translate::*;

glib_wrapper! {
pub struct Context(Object<ffi::PangoContext>);

match fn {
get_type => || ffi::pango_context_get_type(),
}
}

impl Context {
pub fn new() -> Context {
unsafe {
from_glib_full(ffi::pango_context_new())
}
}

#[cfg(feature = "v1_32_4")]
pub fn changed(&self) {
unsafe {
ffi::pango_context_changed(self.to_glib_none().0);
}
}

//pub fn get_base_dir(&self) -> /*Ignored*/Direction {
// unsafe { TODO: call ffi::pango_context_get_base_dir() }
//}

//pub fn get_base_gravity(&self) -> /*Ignored*/Gravity {
// unsafe { TODO: call ffi::pango_context_get_base_gravity() }
//}

pub fn get_font_description(&self) -> Option<FontDescription> {
unsafe {
from_glib_none(ffi::pango_context_get_font_description(self.to_glib_none().0))
}
}

pub fn get_font_map(&self) -> Option<FontMap> {
unsafe {
from_glib_none(ffi::pango_context_get_font_map(self.to_glib_none().0))
}
}

//pub fn get_gravity(&self) -> /*Ignored*/Gravity {
// unsafe { TODO: call ffi::pango_context_get_gravity() }
//}

//pub fn get_gravity_hint(&self) -> /*Ignored*/GravityHint {
// unsafe { TODO: call ffi::pango_context_get_gravity_hint() }
//}

//pub fn get_language(&self) -> /*Ignored*/Option<Language> {
// unsafe { TODO: call ffi::pango_context_get_language() }
//}

//pub fn get_matrix(&self) -> /*Ignored*/Option<Matrix> {
// unsafe { TODO: call ffi::pango_context_get_matrix() }
//}

//pub fn get_metrics(&self, desc: Option<&FontDescription>, language: /*Ignored*/Option<&mut Language>) -> /*Ignored*/Option<FontMetrics> {
// unsafe { TODO: call ffi::pango_context_get_metrics() }
//}

#[cfg(feature = "v1_32_4")]
pub fn get_serial(&self) -> u32 {
unsafe {
ffi::pango_context_get_serial(self.to_glib_none().0)
}
}

//pub fn list_families(&self, families: /*Unimplemented*/Vec<FontFamily>) -> i32 {
// unsafe { TODO: call ffi::pango_context_list_families() }
//}

//pub fn load_font(&self, desc: &FontDescription) -> /*Ignored*/Option<Font> {
// unsafe { TODO: call ffi::pango_context_load_font() }
//}

//pub fn load_fontset(&self, desc: &FontDescription, language: /*Ignored*/&mut Language) -> /*Ignored*/Option<Fontset> {
// unsafe { TODO: call ffi::pango_context_load_fontset() }
//}

//pub fn set_base_dir(&self, direction: /*Ignored*/Direction) {
// unsafe { TODO: call ffi::pango_context_set_base_dir() }
//}

//pub fn set_base_gravity(&self, gravity: /*Ignored*/Gravity) {
// unsafe { TODO: call ffi::pango_context_set_base_gravity() }
//}

pub fn set_font_description(&self, desc: &FontDescription) {
unsafe {
ffi::pango_context_set_font_description(self.to_glib_none().0, desc.to_glib_none().0);
}
}

pub fn set_font_map(&self, font_map: &FontMap) {
unsafe {
ffi::pango_context_set_font_map(self.to_glib_none().0, font_map.to_glib_none().0);
}
}

//pub fn set_gravity_hint(&self, hint: /*Ignored*/GravityHint) {
// unsafe { TODO: call ffi::pango_context_set_gravity_hint() }
//}

//pub fn set_language(&self, language: /*Ignored*/&mut Language) {
// unsafe { TODO: call ffi::pango_context_set_language() }
//}

//pub fn set_matrix(&self, matrix: /*Ignored*/Option<&Matrix>) {
// unsafe { TODO: call ffi::pango_context_set_matrix() }
//}
}
42 changes: 42 additions & 0 deletions src/auto/enums.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// This file was generated by gir (aacfc92) from gir-files (71d73f0)
// DO NOT EDIT

use ffi;
use glib_ffi;
use glib::error::ErrorDomain;
use glib::translate::*;

#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum Alignment {
Left,
Center,
Right,
#[doc(hidden)]
__Nonexhaustive(()),
}

#[doc(hidden)]
impl ToGlib for Alignment {
type GlibType = ffi::PangoAlignment;

fn to_glib(&self) -> ffi::PangoAlignment {
match *self {
Alignment::Left => ffi::PANGO_ALIGN_LEFT,
Alignment::Center => ffi::PANGO_ALIGN_CENTER,
Alignment::Right => ffi::PANGO_ALIGN_RIGHT,
Alignment::__Nonexhaustive(_) => panic!(),
}
}
}

#[doc(hidden)]
impl FromGlib<ffi::PangoAlignment> for Alignment {
fn from_glib(value: ffi::PangoAlignment) -> Self {
match value {
ffi::PANGO_ALIGN_LEFT => Alignment::Left,
ffi::PANGO_ALIGN_CENTER => Alignment::Center,
ffi::PANGO_ALIGN_RIGHT => Alignment::Right,
}
}
}

6 changes: 6 additions & 0 deletions src/auto/flags.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file was generated by gir (aacfc92) from gir-files (71d73f0)
// DO NOT EDIT

use ffi;
use glib::translate::*;

54 changes: 54 additions & 0 deletions src/auto/font_map.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// This file was generated by gir (aacfc92) from gir-files (71d73f0)
// DO NOT EDIT

use Context;
use ffi;
use glib::translate::*;

glib_wrapper! {
pub struct FontMap(Object<ffi::PangoFontMap>);

match fn {
get_type => || ffi::pango_font_map_get_type(),
}
}

impl FontMap {
#[cfg(feature = "v1_34")]
pub fn changed(&self) {
unsafe {
ffi::pango_font_map_changed(self.to_glib_none().0);
}
}

pub fn create_context(&self) -> Option<Context> {
unsafe {
from_glib_full(ffi::pango_font_map_create_context(self.to_glib_none().0))
}
}

#[cfg(feature = "v1_32_4")]
pub fn get_serial(&self) -> u32 {
unsafe {
ffi::pango_font_map_get_serial(self.to_glib_none().0)
}
}

pub fn get_shape_engine_type(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::pango_font_map_get_shape_engine_type(self.to_glib_none().0))
}
}

//pub fn list_families(&self, families: /*Unimplemented*/Vec<FontFamily>) -> i32 {
// unsafe { TODO: call ffi::pango_font_map_list_families() }
//}

//pub fn load_font(&self, context: &Context, desc: &FontDescription) -> /*Ignored*/Option<Font> {
// unsafe { TODO: call ffi::pango_font_map_load_font() }
//}

//pub fn load_fontset(&self, context: &Context, desc: &FontDescription, language: /*Ignored*/&mut Language) -> /*Ignored*/Option<Fontset> {
// unsafe { TODO: call ffi::pango_font_map_load_fontset() }
//}
}
Loading

0 comments on commit 3a070a5

Please sign in to comment.