[librsvg/librsvg-2.44] font_props: Take a ViewParams for our normalization functions, too



commit 204272bf3455d90e22de9d16d222fd436af14ad6
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Sep 3 15:39:50 2018 -0500

    font_props: Take a ViewParams for our normalization functions, too

 rsvg_internals/src/font_props.rs | 10 +++++-----
 rsvg_internals/src/text.rs       |  6 ++++--
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/rsvg_internals/src/font_props.rs b/rsvg_internals/src/font_props.rs
index dd9273b1..5560edce 100644
--- a/rsvg_internals/src/font_props.rs
+++ b/rsvg_internals/src/font_props.rs
@@ -1,6 +1,6 @@
 use cssparser::{BasicParseError, Parser, Token};
 
-use drawing_ctx::DrawingCtx;
+use drawing_ctx::ViewParams;
 use error::*;
 use length::{Length, LengthDir, LengthUnit, POINTS_PER_INCH};
 use parsers::{Parse, ParseError};
@@ -67,8 +67,8 @@ impl FontSizeSpec {
         FontSizeSpec::Value(new_size)
     }
 
-    pub fn normalize(&self, values: &ComputedValues, draw_ctx: &DrawingCtx) -> f64 {
-        self.value().normalize(values, &draw_ctx.get_view_params())
+    pub fn normalize(&self, values: &ComputedValues, params: &ViewParams) -> f64 {
+        self.value().normalize(values, params)
     }
 }
 
@@ -202,8 +202,8 @@ impl LetterSpacingSpec {
         LetterSpacingSpec::Value(spacing)
     }
 
-    pub fn normalize(&self, values: &ComputedValues, draw_ctx: &DrawingCtx) -> f64 {
-        self.value().normalize(values, &draw_ctx.get_view_params())
+    pub fn normalize(&self, values: &ComputedValues, params: &ViewParams) -> f64 {
+        self.value().normalize(values, params)
     }
 }
 
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 0a498b44..168255cc 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -527,8 +527,10 @@ fn create_pango_layout(
 
     font_desc.set_stretch(pango::Stretch::from(values.font_stretch));
 
+    let params = draw_ctx.get_view_params();
+
     font_desc.set_size(to_pango_units(
-        values.font_size.0.normalize(values, draw_ctx),
+        values.font_size.0.normalize(values, &params),
     ));
 
     let layout = pango::Layout::new(&pango_context);
@@ -538,7 +540,7 @@ fn create_pango_layout(
 
     attr_list.insert(
         pango::Attribute::new_letter_spacing(to_pango_units(
-            values.letter_spacing.0.normalize(values, draw_ctx),
+            values.letter_spacing.0.normalize(values, &params),
         )).unwrap(),
     );
 


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