Skip to content

Commit 811cf71

Browse files
committed
Gracefully handle <use>ing elements inside <text> elements
1 parent dd60a2b commit 811cf71

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/prawn/svg/elements/text_component.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ def parse
99
raise SkipElementError, "<text> elements are not supported in clip paths"
1010
end
1111

12+
if state.text.nil?
13+
raise SkipElementError, "attempted to <use> an component inside a text element, this is not supported"
14+
end
15+
1216
state.text.x = (attributes['x'] || "").split(COMMA_WSP_REGEXP).collect { |n| x(n) }
1317
state.text.y = (attributes['y'] || "").split(COMMA_WSP_REGEXP).collect { |n| y(n) }
1418
state.text.dx = (attributes['dx'] || "").split(COMMA_WSP_REGEXP).collect { |n| x_pixels(n) }

0 commit comments

Comments
 (0)