2593: def [](pdf, info)
2594: @style ||= DEFAULT_STYLE.dup
2595:
2596: case info[:status]
2597: when :start, :start_line
2598: @links ||= {}
2599:
2600: @links[info[:cbid]] = {
2601: :x => info[:x],
2602: :y => info[:y],
2603: :angle => info[:angle],
2604: :descender => info[:descender],
2605: :height => info[:height],
2606: :uri => nil
2607: }
2608:
2609: pdf.save_state
2610: pdf.stroke_color @style[:color] if @style[:color]
2611: sz = info[:height] * @style[:factor]
2612: pdf.stroke_style! StrokeStyle.new(sz, @style[:line_style])
2613: when :end, :end_line
2614: start = @links[info[:cbid]]
2615: theta = PDF::Math.deg2rad(start[:angle] - 90.0)
2616: drop = start[:height] * @style[:factor] * 1.5
2617: drop_x = Math.cos(theta) * drop
2618: drop_y = -Math.sin(theta) * drop
2619: pdf.move_to(start[:x] - drop_x, start[:y] - drop_y)
2620: pdf.line_to(info[:x] - drop_x, info[:y] - drop_y).stroke
2621: pdf.restore_state
2622: end
2623: end