[librsvg: 3/5] text: Only push a new chunk if the tspan has any of x or y attributes
- From: Federico Mena Quintero <federico src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [librsvg: 3/5] text: Only push a new chunk if the tspan has any of x or y attributes
 
- Date: Thu,  5 Nov 2020 02:11:20 +0000 (UTC)
 
commit 2ebd2ab1c9796e90d12d3c3a9cb9526488f47367
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 4 19:05:23 2020 -0600
    text: Only push a new chunk if the tspan has any of x or y attributes
 src/text.rs | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/text.rs b/src/text.rs
index 9af19fe8..9fc7ab7e 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -615,13 +615,12 @@ impl TSpan {
         let x = self.x.map(|l| l.normalize(&values, ¶ms));
         let y = self.y.map(|l| l.normalize(&values, ¶ms));
 
-        let span_dx = self.dx.map_or(0.0, |l| l.normalize(&values, ¶ms));
-        let span_dy = self.dy.map_or(0.0, |l| l.normalize(&values, ¶ms));
+        let span_dx = dx + self.dx.map_or(0.0, |l| l.normalize(&values, ¶ms));
+        let span_dy = dy + self.dy.map_or(0.0, |l| l.normalize(&values, ¶ms));
 
-        let dx = dx + span_dx;
-        let dy = dy + span_dy;
-
-        chunks.push(Chunk::new(values, x, y));
+        if x.is_some() || y.is_some() {
+            chunks.push(Chunk::new(values, x, y));
+        }
 
         children_to_chunks(
             chunks,
@@ -629,8 +628,8 @@ impl TSpan {
             acquired_nodes,
             cascaded,
             draw_ctx,
-            dx,
-            dy,
+            span_dx,
+            span_dy,
             depth,
         );
     }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]