| Class | PDF::Writer::TagDisc |
| In: |
lib/pdf/writer.rb
|
| Parent: | Object |
A callback function to support drawing of a disc bullet style.
| DEFAULT_FOREGROUND | = | Color::RGB::Black | The default disc bullet foreground. | |
| DEFAULT_BACKGROUND | = | Color::RGB::White | The default disc bullet background. |
| background | [RW] |
The background color for <C:disc> bullets. Default is
Color::RGB::White.
Set to nil to get the default color. |
| foreground | [RW] |
The foreground color for <C:disc> bullets. Default is
Color::RGB::Black.
Set to nil to get the default color. |
# File lib/pdf/writer.rb, line 2677
2677: def [](pdf, info)
2678: @foreground ||= DEFAULT_FOREGROUND
2679: @background ||= DEFAULT_BACKGROUND
2680:
2681: desc = info[:descender].abs
2682: xpos = info[:x] - (desc * 2.00)
2683: ypos = info[:y] + (desc * 1.05)
2684:
2685: ss = StrokeStyle.new(desc)
2686: ss.cap = :butt
2687: ss.join = :miter
2688: pdf.stroke_style! ss
2689: pdf.stroke_color @foreground
2690: pdf.circle_at(xpos, ypos, 1).stroke
2691: pdf.stroke_color @background
2692: pdf.circle_at(xpos, ypos, 0.5).stroke
2693: end