Class: PDF::Writer::TagDisc

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 disc bullet style.

Constant Summary collapse

DEFAULT_FOREGROUND =

The default disc bullet foreground.

Color::RGB::Black
DEFAULT_BACKGROUND =

The default disc bullet background.

Color::RGB::White

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.backgroundObject

The background color for <C:disc> bullets. Default is Color::RGB::White.

Set to nil to get the default color.



2676
2677
2678
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb', line 2676

def background
  @background
end

.foregroundObject

The foreground color for <C:disc> bullets. Default is Color::RGB::Black.

Set to nil to get the default color.



2671
2672
2673
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb', line 2671

def foreground
  @foreground
end

Class Method Details

.[](pdf, info) ⇒ Object



2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb', line 2677

def [](pdf, info)
  @foreground ||= DEFAULT_FOREGROUND
  @background ||= DEFAULT_BACKGROUND

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

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