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.



2670
2671
2672
# File 'lib/pdf/writer.rb', line 2670

def color
  @color
end

Class Method Details

.[](pdf, info) ⇒ Object



2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
# File 'lib/pdf/writer.rb', line 2671

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