lib/rsyntaxtree/svg_graph.rb in rsyntaxtree-0.7.7 vs lib/rsyntaxtree/svg_graph.rb in rsyntaxtree-0.8.0

- old
+ new

@@ -16,14 +16,15 @@ require "tempfile" require 'graph' class SVGGraph < Graph - def initialize(e_list, metrics, symmetrize, color, leafstyle, multibyte, fontstyle, font_size) + def initialize(e_list, metrics, symmetrize, color, leafstyle, multibyte, fontstyle, font, font_size) # Store class-specific parameters - @font = fontstyle == "sans" ? "sans-serif" : fontstyle + @fontstyle = fontstyle + @font = multibyte ? font_cjk : font @font_size = font_size super(e_list, metrics, symmetrize, color, leafstyle, multibyte, @font, @font_size) @line_styles = "<line style='stroke:black; stroke-width:1;' x1='X1' y1='Y1' x2='X2' y2='Y2' />\n" @@ -85,19 +86,16 @@ else main = parts[0].strip sub = "" end - if /\A\+(.+)\+\z/ =~ main + if /\A\=(.+)\=\z/ =~ main main = $1 main_decoration= "overline" elsif /\A\-(.+)\-\z/ =~ main main = $1 main_decoration= "underline" - elsif /\A\=(.+)\=\z/ =~ main - main = $1 - main_decoration= "line-through" else main_decoration= "" end if /\A\*\*\*(.+)\*\*\*\z/ =~ main @@ -122,18 +120,15 @@ # symbols for underline/overline removed temporarily main_width = img_get_txt_width(main, @font, @font_size) if sub != "" - if /\A\+(.+)\+\z/ =~ sub + if /\A\=(.+)\=\z/ =~ sub sub = $1 sub_decoration= "overline" elsif /\A\-(.+)\-\z/ =~ sub sub = $1 sub_decoration= "underline" - elsif /\A\=(.+)\=\z/ =~ sub - sub = $1 - sub_decoration= "line-through" else sub_decoration= "" end if /\A\*\*\*(.+)\*\*\*\z/ =~ sub