[librsvg: 1/3] use cairopango instead of the sys bindings



commit 6760f0d9edef46e3cc87181d8ad13ef4a68381f9
Author: Julian Sparber <julian sparber net>
Date:   Thu Nov 22 11:35:55 2018 +0100

    use cairopango instead of the sys bindings

 rsvg_internals/src/drawing_ctx.rs | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index f34dfbf5..1bdc42ba 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -5,7 +5,6 @@ use glib::translate::*;
 use glib_sys;
 use libc;
 use pango::{self, ContextExt, FontMapExt, LayoutExt};
-use pango_cairo_sys;
 use pango_sys;
 use pangocairo;
 use std::cell::RefCell;
@@ -546,7 +545,7 @@ impl<'a> DrawingCtx<'a> {
         // cancel out Pango's scaling, but it's probably better to deal with Pango-isms
         // right here, instead of spreading them out through our Length normalization
         // code.
-        set_resolution(&context, 72.0);
+        pangocairo::functions::context_set_resolution(&context, 72.0);
 
         if self.is_testing {
             let mut options = cairo::FontOptions::new();
@@ -555,7 +554,7 @@ impl<'a> DrawingCtx<'a> {
             options.set_hint_style(cairo::enums::HintStyle::Full);
             options.set_hint_metrics(cairo::enums::HintMetrics::On);
 
-            set_font_options(&context, &options);
+            pangocairo::functions::context_set_font_options(&context, &options);
         }
 
         context
@@ -865,23 +864,6 @@ impl<'a> DrawingCtx<'a> {
     }
 }
 
-// remove this binding once pangocairo-rs has ContextExt::set_resolution()
-fn set_resolution(context: &pango::Context, dpi: f64) {
-    unsafe {
-        pango_cairo_sys::pango_cairo_context_set_resolution(context.to_glib_none().0, dpi);
-    }
-}
-
-// remove this binding once pangocairo-rs has ContextExt::set_font_options()
-fn set_font_options(context: &pango::Context, options: &cairo::FontOptions) {
-    unsafe {
-        pango_cairo_sys::pango_cairo_context_set_font_options(
-            context.to_glib_none().0,
-            options.to_glib_none().0,
-        );
-    }
-}
-
 // FIXME: should the pango crate provide this like PANGO_GRAVITY_IS_VERTICAL() ?
 fn gravity_is_vertical(gravity: pango::Gravity) -> bool {
     match gravity {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]