Class: PDF::Writer::TagDisc

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



2707
2708
2709
# File 'lib/pdf/writer.rb', line 2707

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.



2702
2703
2704
# File 'lib/pdf/writer.rb', line 2702

def foreground
  @foreground
end

Class Method Details

.[](pdf, info) ⇒ Object



2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
# File 'lib/pdf/writer.rb', line 2708

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