pangocairo-0.20.7/.cargo_vcs_info.json0000644000000001500000000000100132400ustar { "git": { "sha1": "1b119dc9e96dec43959e040c9def5da2bd4fa24b" }, "path_in_vcs": "pangocairo" }pangocairo-0.20.7/COPYRIGHT000064400000000000000000000012131046102023000133240ustar 00000000000000The gtk-rs Project is licensed under the MIT license, see the LICENSE file or . Copyrights in the gtk-rs Project project are retained by their contributors. No copyright assignment is required to contribute to the gtk-rs Project project. For full authorship information, see the version control history. This project provides interoperability with various GNOME libraries but doesn't distribute any parts of them. Distributing compiled libraries and executables that link to those libraries may be subject to terms of the GNU LGPL or other licenses. For more information check the license of each GNOME library. pangocairo-0.20.7/Cargo.toml0000644000000031670000000000100112510ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.70" name = "pangocairo" version = "0.20.7" authors = ["The gtk-rs Project Developers"] build = false exclude = ["gir-files/*"] autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Rust bindings for the PangoCairo library" homepage = "https://gtk-rs.org/" documentation = "https://gtk-rs.org/gtk-rs-core/stable/latest/docs/pangocairo/" readme = "README.md" keywords = [ "pango", "cairo", "gtk-rs", "gnome", ] license = "MIT" repository = "https://github.com/gtk-rs/gtk-rs-core" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [lib] name = "pangocairo" path = "src/lib.rs" [[test]] name = "check_gir" path = "tests/check_gir.rs" [[test]] name = "iterators" path = "tests/iterators.rs" [dependencies.cairo-rs] version = "0.20" [dependencies.glib] version = "0.20.3" [dependencies.libc] version = "0.2" [dependencies.pango] version = "0.20" [dependencies.pangocairo-sys] version = "0.20" [dev-dependencies.gir-format-check] version = "^0.1" pangocairo-0.20.7/Cargo.toml.orig000064400000000000000000000014261046102023000147260ustar 00000000000000[package] name = "pangocairo" documentation = "https://gtk-rs.org/gtk-rs-core/stable/latest/docs/pangocairo/" keywords = ["pango", "cairo", "gtk-rs", "gnome"] readme = "README.md" description = "Rust bindings for the PangoCairo library" authors.workspace = true edition.workspace = true exclude.workspace = true homepage.workspace = true license.workspace = true repository.workspace = true rust-version.workspace = true version.workspace = true [dependencies] pangocairo-sys.workspace = true libc.workspace = true glib.workspace = true pango.workspace = true cairo-rs.workspace = true [dev-dependencies] gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] pangocairo-0.20.7/Gir.toml000064400000000000000000000062271046102023000134610ustar 00000000000000[options] girs_directories = ["../gir-files"] library = "PangoCairo" version = "1.0" use_gi_docgen = true target_path = "." work_mode = "normal" generate_safety_asserts = false min_cfg_version = "1.40" single_version_file = true deprecate_by_min_version = true trust_return_value_nullability = true generate = [] manual = [ "cairo.Context", "cairo.FontOptions", "cairo.FontType", "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.Font" status = "generate" trait_name = "PangoCairoFontExt" [[object]] name = "PangoCairo.FontMap" status = "generate" trait_name = "PangoCairoFontMapExt" manual_traits = ["PangoCairoFontMapExtManual"] [[object.function]] # Needed because cairo types don't implement `.into_glib()`. name = "get_font_type" manual = true doc_trait_name = "PangoCairoFontMapExtManual" [[object.function]] # Needed because cairo types don't implement `.into_glib()`. name = "new_for_font_type" manual = true [[object.function]] # Needed because GIR generates `pango::FontMap` as return type # and not `pangocairo::FontMap`. name = "new" manual = true [[object.function]] # Needed because it must remain an associated method because # "self" is a `Option<&Self>`. name = "set_default" manual = true pangocairo-0.20.7/LICENSE000064400000000000000000000020001046102023000130310ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pangocairo-0.20.7/README.md000064400000000000000000000025501046102023000133150ustar 00000000000000# Rust PangoCairo bindings __Rust__ bindings and wrappers for [PangoCairo](https://docs.gtk.org/PangoCairo), part of [gtk-rs-core](https://github.com/gtk-rs/gtk-rs-core). PangoCairo __1.40__ is the lowest supported version for the underlying library. ## Minimum supported Rust version Currently, the minimum supported Rust version is `1.70.0`. ## Documentation * [Rust API - Stable](https://gtk-rs.org/gtk-rs-core/stable/latest/docs/pangocairo/) * [Rust API - Development](https://gtk-rs.org/gtk-rs-core/git/docs/pangocairo) * [GTK Installation instructions](https://www.gtk.org/docs/installations/) ## Using We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), as [demonstrated here](https://gtk-rs.org/#using). If you want to track the bleeding edge, use the git dependency instead: ```toml [dependencies] pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core.git", package = "pangocairo" } ``` Avoid mixing versioned and git crates like this: ```toml # This will not compile [dependencies] pangocairo = "0.13" pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core.git", package = "pangocairo" } ``` ### See Also * [cairo](https://crates.io/crates/cairo-rs) * [glib](https://crates.io/crates/glib) * [pango](https://crates.io/crates/pango) ## License __pangocairo__ is available under the MIT License, please refer to it. pangocairo-0.20.7/src/auto/font.rs000064400000000000000000000017341046102023000151140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "PangoCairoFont")] pub struct Font(Interface) @requires pango::Font; match fn { type_ => || ffi::pango_cairo_font_get_type(), } } impl Font { pub const NONE: Option<&'static Font> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PangoCairoFontExt: IsA + sealed::Sealed + 'static { #[doc(alias = "pango_cairo_font_get_scaled_font")] #[doc(alias = "get_scaled_font")] fn scaled_font(&self) -> Option { unsafe { from_glib_none(ffi::pango_cairo_font_get_scaled_font( self.as_ref().to_glib_none().0, )) } } } impl> PangoCairoFontExt for O {} pangocairo-0.20.7/src/auto/font_map.rs000064400000000000000000000026151046102023000157500ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "PangoCairoFontMap")] pub struct FontMap(Interface) @requires pango::FontMap; match fn { type_ => || ffi::pango_cairo_font_map_get_type(), } } impl FontMap { pub const NONE: Option<&'static FontMap> = None; #[doc(alias = "pango_cairo_font_map_get_default")] #[doc(alias = "get_default")] #[allow(clippy::should_implement_trait)] pub fn default() -> pango::FontMap { unsafe { from_glib_none(ffi::pango_cairo_font_map_get_default()) } } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PangoCairoFontMapExt: IsA + sealed::Sealed + 'static { #[doc(alias = "pango_cairo_font_map_get_resolution")] #[doc(alias = "get_resolution")] fn resolution(&self) -> f64 { unsafe { ffi::pango_cairo_font_map_get_resolution(self.as_ref().to_glib_none().0) } } #[doc(alias = "pango_cairo_font_map_set_resolution")] fn set_resolution(&self, dpi: f64) { unsafe { ffi::pango_cairo_font_map_set_resolution(self.as_ref().to_glib_none().0, dpi); } } } impl> PangoCairoFontMapExt for O {} pangocairo-0.20.7/src/auto/functions.rs000064400000000000000000000122641046102023000161560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; #[doc(alias = "pango_cairo_context_get_resolution")] pub fn context_get_resolution(context: &pango::Context) -> f64 { unsafe { ffi::pango_cairo_context_get_resolution(context.to_glib_none().0) } } //#[doc(alias = "pango_cairo_context_get_shape_renderer")] //pub fn context_get_shape_renderer(context: &pango::Context, data: /*Unimplemented*/Option) -> /*Unimplemented*/Fn(&cairo::Context, /*Ignored*/pango::AttrShape, bool) { // unsafe { TODO: call ffi:pango_cairo_context_get_shape_renderer() } //} #[doc(alias = "pango_cairo_context_set_font_options")] pub fn context_set_font_options(context: &pango::Context, options: Option<&cairo::FontOptions>) { unsafe { ffi::pango_cairo_context_set_font_options( context.to_glib_none().0, options.to_glib_none().0, ); } } #[doc(alias = "pango_cairo_context_set_resolution")] pub fn context_set_resolution(context: &pango::Context, dpi: f64) { unsafe { ffi::pango_cairo_context_set_resolution(context.to_glib_none().0, dpi); } } //#[doc(alias = "pango_cairo_context_set_shape_renderer")] //pub fn context_set_shape_renderer(context: &pango::Context, func: /*Unimplemented*/Fn(&cairo::Context, /*Ignored*/pango::AttrShape, bool), data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:pango_cairo_context_set_shape_renderer() } //} #[doc(alias = "pango_cairo_create_context")] pub fn create_context(cr: &cairo::Context) -> pango::Context { unsafe { from_glib_full(ffi::pango_cairo_create_context(mut_override( cr.to_glib_none().0, ))) } } #[doc(alias = "pango_cairo_create_layout")] pub fn create_layout(cr: &cairo::Context) -> pango::Layout { unsafe { from_glib_full(ffi::pango_cairo_create_layout(mut_override( cr.to_glib_none().0, ))) } } #[doc(alias = "pango_cairo_error_underline_path")] 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, ); } } #[doc(alias = "pango_cairo_glyph_string_path")] pub fn glyph_string_path( cr: &cairo::Context, font: &impl IsA, glyphs: &mut pango::GlyphString, ) { unsafe { ffi::pango_cairo_glyph_string_path( mut_override(cr.to_glib_none().0), font.as_ref().to_glib_none().0, glyphs.to_glib_none_mut().0, ); } } #[doc(alias = "pango_cairo_layout_line_path")] 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); } } #[doc(alias = "pango_cairo_layout_path")] 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); } } #[doc(alias = "pango_cairo_show_error_underline")] 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, ); } } #[doc(alias = "pango_cairo_show_glyph_item")] 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, ); } } #[doc(alias = "pango_cairo_show_glyph_string")] pub fn show_glyph_string( cr: &cairo::Context, font: &impl IsA, glyphs: &mut pango::GlyphString, ) { unsafe { ffi::pango_cairo_show_glyph_string( mut_override(cr.to_glib_none().0), font.as_ref().to_glib_none().0, glyphs.to_glib_none_mut().0, ); } } #[doc(alias = "pango_cairo_show_layout")] 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); } } #[doc(alias = "pango_cairo_show_layout_line")] 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); } } #[doc(alias = "pango_cairo_update_context")] 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, ); } } #[doc(alias = "pango_cairo_update_layout")] 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); } } pangocairo-0.20.7/src/auto/mod.rs000064400000000000000000000005631046102023000147240ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT mod font; pub use self::font::Font; mod font_map; pub use self::font_map::FontMap; pub(crate) mod functions; pub(crate) mod traits { pub use super::font::PangoCairoFontExt; pub use super::font_map::PangoCairoFontMapExt; } pangocairo-0.20.7/src/auto/versions.txt000064400000000000000000000002041046102023000162000ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ e06125dad46a) from gir-files (https://github.com/gtk-rs/gir-files @ 01066bc7d926) pangocairo-0.20.7/src/font_map.rs000064400000000000000000000025061046102023000147770ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::{prelude::*, translate::*}; use crate::{ffi, FontMap}; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PangoCairoFontMapExtManual: sealed::Sealed + IsA + 'static { #[doc(alias = "pango_cairo_font_map_get_font_type")] #[doc(alias = "get_font_type")] fn font_type(&self) -> cairo::FontType { unsafe { ffi::pango_cairo_font_map_get_font_type(self.as_ref().to_glib_none().0).into() } } } impl> PangoCairoFontMapExtManual for O {} impl FontMap { #[doc(alias = "pango_cairo_font_map_new_for_font_type")] #[doc(alias = "new_for_font_type")] pub fn for_font_type(fonttype: cairo::FontType) -> Option { unsafe { from_glib_full(ffi::pango_cairo_font_map_new_for_font_type(fonttype.into())) } } #[allow(clippy::new_ret_no_self)] #[doc(alias = "pango_cairo_font_map_new")] pub fn new() -> pango::FontMap { unsafe { from_glib_full(ffi::pango_cairo_font_map_new()) } } #[doc(alias = "pango_cairo_font_map_set_default")] pub fn set_default(font_map: Option<&Self>) { unsafe { ffi::pango_cairo_font_map_set_default(font_map.as_ref().to_glib_none().0); } } } pangocairo-0.20.7/src/lib.rs000064400000000000000000000005551046102023000137440ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #![cfg_attr(docsrs, feature(doc_cfg))] #![doc = include_str!("../README.md")] pub use cairo; pub use glib; pub use pango; pub use pango_cairo_sys as ffi; mod auto; pub use crate::auto::*; pub mod prelude; pub mod functions { pub use super::auto::functions::*; } mod font_map; pangocairo-0.20.7/src/prelude.rs000064400000000000000000000003551046102023000146340ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[doc(hidden)] pub use glib::prelude::*; #[doc(hidden)] pub use pango::prelude::*; pub use crate::{auto::traits::*, font_map::PangoCairoFontMapExtManual}; pangocairo-0.20.7/tests/check_gir.rs000064400000000000000000000003461046102023000154650ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); println!("{res}"); assert_eq!(res.nb_errors, 0); } pangocairo-0.20.7/tests/iterators.rs000064400000000000000000000021141046102023000155560ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::GStr; use pango::prelude::*; const TEXT: &GStr = glib::gstr!("AAAA BBBB CCCC DDDD EEEE FFFF gggg hhhh iiii jjjj kkkk llll"); #[test] fn glyph_item_iter() { let item = { let map = pangocairo::FontMap::default(); let pc = map.create_context(); let layout = pango::Layout::new(&pc); layout.set_width(256 * pango::SCALE); layout.set_height(256 * pango::SCALE); layout.set_text(TEXT); let mut layout_iter = layout.iter(); layout_iter.run().unwrap() }; let iter = pango::GlyphItemIter::new_start(&item, TEXT).unwrap(); assert_eq!(iter.glyph_item(), &item); assert_eq!(iter.text(), TEXT); for (i, (sg, si, sc, eg, ei, ec)) in iter.into_iter().enumerate() { let i = i as i32; // ensure these are all single-byte ASCII characters assert_eq!(sg, i); assert_eq!(si, i); assert_eq!(sc, i); assert_eq!(eg, i + 1); assert_eq!(ei, i + 1); assert_eq!(ec, i + 1); } }