Skip to content

Commit 9877d70

Browse files
grothendeickmogest
authored andcommitted
Implement stroke-linejoin attribute
1 parent 9ced7dc commit 9877d70

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/prawn/svg/attributes/stroke.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Prawn::SVG::Attributes::Stroke
22
CAP_STYLE_TRANSLATIONS = {"butt" => :butt, "round" => :round, "square" => :projecting_square}
3+
JOIN_STYLE_TRANSLATIONS = {"miter" => :miter, "round" => :round, "bevel" => :bevel}
34

45
def parse_stroke_attributes_and_call
56
if width_string = properties.stroke_width
@@ -11,6 +12,10 @@ def parse_stroke_attributes_and_call
1112
if (linecap = properties.stroke_linecap) && linecap != 'inherit'
1213
add_call('cap_style', CAP_STYLE_TRANSLATIONS.fetch(linecap, :butt))
1314
end
15+
16+
if (linejoin = properties.stroke_linejoin) && linejoin != 'inherit'
17+
add_call('join_style', JOIN_STYLE_TRANSLATIONS.fetch(linejoin, :miter))
18+
end
1419

1520
if dasharray = properties.stroke_dasharray
1621
case dasharray

lib/prawn/svg/elements/path.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ def parse
5555
end
5656

5757
def apply
58-
add_call 'join_style', :bevel
59-
6058
apply_commands
6159
apply_markers
6260
end

lib/prawn/svg/properties.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Prawn::SVG::Properties
3434
"stroke" => Config.new("none", true, %w(inherit none currentColor)),
3535
"stroke-dasharray" => Config.new("none", true, %w(inherit none)),
3636
"stroke-linecap" => Config.new("butt", true, %w(inherit butt round square), true),
37+
"stroke-linejoin" => Config.new("miter", true, %w(inherit miter round bevel), true),
3738
"stroke-opacity" => Config.new("1", true),
3839
"stroke-width" => Config.new("1", true),
3940
"text-anchor" => Config.new("start", true, %w(inherit start middle end), true),

0 commit comments

Comments
 (0)