2657: def [](pdf, info)
2658: @style ||= DEFAULT_STYLE.dup
2659:
2660: case info[:status]
2661: when :start, :start_line
2662: @links ||= {}
2663:
2664: @links[info[:cbid]] = {
2665: :x => info[:x],
2666: :y => info[:y],
2667: :angle => info[:angle],
2668: :descender => info[:descender],
2669: :height => info[:height],
2670: :uri => nil
2671: }
2672:
2673: pdf.save_state
2674: pdf.stroke_color @style[:color] if @style[:color]
2675: sz = info[:height] * @style[:factor]
2676: pdf.stroke_style! StrokeStyle.new(sz, @style[:line_style])
2677: when :end, :end_line
2678: start = @links[info[:cbid]]
2679: theta = PDF::Math.deg2rad(start[:angle] - 90.0)
2680: drop = start[:height] * @style[:factor] * 1.5
2681: drop_x = Math.cos(theta) * drop
2682: drop_y = -Math.sin(theta) * drop
2683: pdf.move_to(start[:x] - drop_x, start[:y] - drop_y)
2684: pdf.line_to(info[:x] - drop_x, info[:y] - drop_y).stroke
2685: pdf.restore_state
2686: end
2687: end