[librsvg/librsvg-2.50] text: Propagate dx/dy across nested <tspan>



commit c529089800a4b461a2c9dd8fd62a812ec0c457f2
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 3 19:45:30 2020 -0600

    text: Propagate dx/dy across nested <tspan>

 rsvg_internals/src/text.rs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 32223ea2..03f2be5d 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -293,6 +293,8 @@ fn children_to_chunks(
                         &cascaded,
                         draw_ctx,
                         chunks,
+                        dx,
+                        dy,
                         depth + 1,
                     );
                 }
@@ -603,6 +605,8 @@ impl TSpan {
         cascaded: &CascadedValues<'_>,
         draw_ctx: &mut DrawingCtx,
         chunks: &mut Vec<Chunk>,
+        dx: f64,
+        dy: f64,
         depth: usize,
     ) {
         let values = cascaded.get();
@@ -611,8 +615,11 @@ impl TSpan {
         let x = self.x.map(|l| l.normalize(&values, &params));
         let y = self.y.map(|l| l.normalize(&values, &params));
 
-        let dx = self.dx.map_or(0.0, |l| l.normalize(&values, &params));
-        let dy = self.dy.map_or(0.0, |l| l.normalize(&values, &params));
+        let span_dx = self.dx.map_or(0.0, |l| l.normalize(&values, &params));
+        let span_dy = self.dy.map_or(0.0, |l| l.normalize(&values, &params));
+
+        let dx = dx + span_dx;
+        let dy = dy + span_dy;
 
         chunks.push(Chunk::new(values, x, y));
 


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