Class: PDF::Writer::TagBullet

Inherits:
Object
  • Object
show all
Defined in:
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.


2644
2645
2646
# File 'lib/pdf/writer.rb', line 2644

def color
  @color
end

Class Method Details

.[](pdf, info) ⇒ Object


2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
# File 'lib/pdf/writer.rb', line 2645

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