Class RGhost::Show
In: show.rb
Parent: RGhost::PsObject

Writes a text on the current row or point with align.

Methods

new   ps  

Included Modules

RGhost::RubyToPs

Constants

DEFAULT_OPTIONS = {:tag => :default_font, :align => :show_left}

Attributes

align  [RW] 
tag  [RW] 
text  [RW] 

Public Class methods

Options

  • :tag or :with - Use predefined tag
  • :color - Override color of the tag
  • :align - Align of the text

Examples

The vertical line is the current point. For align by point

 doc.moveto :x => 3, :y => 4
 doc.show "Foo Bar Baz", :align => :show_left      #default

 doc.moveto :x => 3, :y => 4
 doc.show "Foo Bar Baz", :align => :show_center

 doc.moveto :x => 3, :y => 4
 doc.show "Foo Bar Baz", :align => :show_right

For the the current row it‘s not necessary positioned using moveto. Like below

 doc.show "Foo Bar Baz", :align => :show_right

Now justification in page

 doc.show "Foo Bar Baz", :align => :page_left

 doc.show "Foo Bar Baz", :align => :page_center

 doc.show "Foo Bar Baz", :align => :page_right

Overrinding tag‘s color

 doc.show "Foo Bar Baz", :with => :my_italic, :align => :page_center, :color => :red

Many tags per row

  doc=Document.new
  doc.define_tags do
    tag :font1, :name => 'Helvetica', :size => 10, :color => '#F34811'
    tag :font2, :name => 'Times',     :size => 14, :color => '#A4297A'
    tag :font3, :name => 'TimesBold', :size => 18, :color => '#AA3903'
  end

  doc.show "foo bar baz ",  :with => :font1
  doc.show "qux quux ",     :with => :font2
  doc.show "corge ",        :with => :font3
  doc.show "grault garply ",:with => :font2
  doc.show "qux quux",      :with => :font1

Public Instance methods

[Validate]