Class: PDF::Writer::TagBullet

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb

Overview

A callback function to support drawing of a solid bullet style. Use with <C:bullet>.

Constant Summary collapse

DEFAULT_COLOR =

The default bullet color.

Color::RGB::Black

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.colorObject

Sets the style for <C:bullet> callback bullets that follow. Default is Color::RGB::Black.

Set this to nil to get the default colour.



2639
2640
2641
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb', line 2639

def color
  @color
end

Class Method Details

.[](pdf, info) ⇒ Object



2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb', line 2640

def [](pdf, info)
  @color ||= DEFAULT_COLOR

  desc  = info[:descender].abs
  xpos  = info[:x] - (desc * 2.00)
  ypos  = info[:y] + (desc * 1.05)

  pdf.save_state
  ss = StrokeStyle.new(desc)
  ss.cap  = :butt
  ss.join = :miter
  pdf.stroke_style! ss
  pdf.stroke_color @color
  pdf.circle_at(xpos, ypos, 1).stroke
  pdf.restore_state
end