Class: RGhost::FontMap
- Includes:
- RubyToPs
- Defined in:
- lib/rghost/font_map.rb
Overview
:nodoc:
Constant Summary
Constants included from RubyToPs
Instance Method Summary collapse
-
#initialize(options = {:font => "Helvetica", :size => 8}, &block) ⇒ FontMap
constructor
A new instance of FontMap.
- #new(name, options = {}) ⇒ Object
- #ps ⇒ Object
- #tag(name, options = {}) ⇒ Object
Methods included from RubyToPs
#array_to_stack, #hash_to_array, #pack_string, #ps_escape, #string_eval, #to_array, #to_bool, #to_string, #to_string_array
Methods inherited from PsObject
#<<, #call, #graphic_scope, #raw, #set, #to_s
Constructor Details
#initialize(options = {:font => "Helvetica", :size => 8}, &block) ⇒ FontMap
Returns a new instance of FontMap.
10 11 12 13 14 15 16 |
# File 'lib/rghost/font_map.rb', line 10 def initialize(={:font => "Helvetica", :size => 8},&block) #options[:name]=options[:font] @options= @fonts={} instance_eval(&block) if block end |
Instance Method Details
#new(name, options = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/rghost/font_map.rb', line 18 def new(name,={}) #options[:name]=options[:font] @fonts[name]= end |
#ps ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rghost/font_map.rb', line 28 def ps functions=[] fonts="" @fonts.each do |name,params| =@options if params[:from] [params[:from]].flatten.each do |font| functions << format_custom_font(font) end end functions << RGhost::Function.new("_#{name}") do raw RGhost::Font.new(.dup.merge(params)).ps raw( RGhost::Color.create(params[:color] || 0) ) end end functions.join end |
#tag(name, options = {}) ⇒ Object
23 24 25 |
# File 'lib/rghost/font_map.rb', line 23 def tag(name,={}) new(name,) end |