Class Origami::PS::Text
In: sources/parser/ps.rb
Parent: Object

Methods

new   to_s  

Classes and Modules

Module Origami::PS::Text::Rendering

Constants

DEFAULT_SIZE = 12
DEFAULT_FONT = :F1
DEFAULT_LINESPACING = 20

Attributes

buffer  [RW] 
char_spacing  [RW] 
font  [RW] 
line_spacing  [RW] 
rendering  [RW] 
rise  [RW] 
scale  [RW] 
size  [RW] 
word_spacing  [RW] 
x  [RW] 
y  [RW] 

Public Class methods

[Source]

    # File sources/parser/ps.rb, line 49
49:       def initialize(text = "", attr = {})
50:       
51:         @x = attr.include?(:x) ? attr[:x] : 0
52:         @y = attr.include?(:y) ? attr[:y] : 0
53:         
54:         @font = attr.include?(:font) ? attr[:font] : DEFAULT_FONT
55:         @size = attr.include?(:size) ? attr[:size] : DEFAULT_SIZE
56:         
57:         @line_spacing = attr.include?(:line_spacing) ? attr[:line_spacing] : DEFAULT_LINESPACING
58:         
59:         @word_spacing = attr[:word_spacing]
60:         @char_spacing = attr[:char_spacing]
61:         @scale = attr[:scale]
62:         @rise = attr[:rise]
63:         @rendering = attr[:rendering]
64:         
65:         @buffer = text
66:         
67:       end

Public Instance methods

[Source]

    # File sources/parser/ps.rb, line 69
69:       def to_s
70:       
71:         lines = buffer.split("\n").map!{|line| line.to_o.to_s}
72:         
73:         text = lines.slice!(0) + " Tj " + lines.join(" ' ") 
74:         text << " ' " unless lines.empty?
75:       
76:         data = "BT\n#{@font.to_o} #{@size} Tf #{@x} #{@y} Td #{@line_spacing} TL\n"
77:         data << "#{@rendering} Tr " unless @rendering.nil?
78:         data << "#{@rise} Ts " unless @rise.nil?
79:         data << "#{@scale} Tz " unless @scale.nil?
80:         data << "#{@word_spacing} Tw " unless @word_spacing.nil?
81:         data << "#{@char_spacing} Tc " unless @char_spacing.nil?
82:         data << "#{text}\nET"
83:         
84:         data
85:       end

[Validate]