lunks_rghost 0.8.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rghost/border.rb +44 -0
- data/lib/rghost/callback.rb +58 -0
- data/lib/rghost/circle.rb +102 -0
- data/lib/rghost/color.rb +175 -0
- data/lib/rghost/constants.rb +626 -0
- data/lib/rghost/convert.rb +43 -0
- data/lib/rghost/cursor.rb +124 -0
- data/lib/rghost/dash.rb +59 -0
- data/lib/rghost/document.rb +546 -0
- data/lib/rghost/document_callback_facade.rb +64 -0
- data/lib/rghost/dsc_entry.rb +20 -0
- data/lib/rghost/dynamic_document_callback.rb +15 -0
- data/lib/rghost/eps.rb +31 -0
- data/lib/rghost/font.rb +48 -0
- data/lib/rghost/font_map.rb +54 -0
- data/lib/rghost/frame.rb +105 -0
- data/lib/rghost/function.rb +38 -0
- data/lib/rghost/gif.rb +41 -0
- data/lib/rghost/graphic.rb +26 -0
- data/lib/rghost/grid/base_grid.rb +228 -0
- data/lib/rghost/grid/callback_facade.rb +136 -0
- data/lib/rghost/grid/csv_grid.rb +51 -0
- data/lib/rghost/grid/dynamic_callback.rb +12 -0
- data/lib/rghost/grid/field_format.rb +43 -0
- data/lib/rghost/grid/grid.rb +15 -0
- data/lib/rghost/grid/header.rb +120 -0
- data/lib/rghost/grid/matrix.rb +10 -0
- data/lib/rghost/grid/rails_grid.rb +74 -0
- data/lib/rghost/grid/static_callback.rb +13 -0
- data/lib/rghost/grid/style/border_lines.rb +44 -0
- data/lib/rghost/grid/style/bottom_lines.rb +28 -0
- data/lib/rghost/grid/style/old_forms.rb +28 -0
- data/lib/rghost/grid/style/style.rb +8 -0
- data/lib/rghost/gs_alone.rb +25 -0
- data/lib/rghost/helpers.rb +13 -0
- data/lib/rghost/horizontal_line.rb +45 -0
- data/lib/rghost/how_to.rb +75 -0
- data/lib/rghost/image.rb +29 -0
- data/lib/rghost/jpeg.rb +39 -0
- data/lib/rghost/line.rb +89 -0
- data/lib/rghost/line_width.rb +28 -0
- data/lib/rghost/load.rb +43 -0
- data/lib/rghost/newpath.rb +19 -0
- data/lib/rghost/paper.rb +147 -0
- data/lib/rghost/parse_text.rb +53 -0
- data/lib/rghost/pdf_security.rb +36 -0
- data/lib/rghost/point.rb +23 -0
- data/lib/rghost/point_with_command.rb +17 -0
- data/lib/rghost/polygon.rb +75 -0
- data/lib/rghost/ps/AdobeExpert.enc +258 -0
- data/lib/rghost/ps/AdobeLatinEncoding.enc +258 -0
- data/lib/rghost/ps/Bengali.enc +386 -0
- data/lib/rghost/ps/CodePage1250.enc +258 -0
- data/lib/rghost/ps/CodePage1251.enc +258 -0
- data/lib/rghost/ps/CodePage1252.enc +258 -0
- data/lib/rghost/ps/CodePage1253.enc +258 -0
- data/lib/rghost/ps/CodePage1254.enc +258 -0
- data/lib/rghost/ps/CodePage1256.enc +258 -0
- data/lib/rghost/ps/CodePage1257.enc +258 -0
- data/lib/rghost/ps/CodePage1258.enc +258 -0
- data/lib/rghost/ps/CodePage874.enc +258 -0
- data/lib/rghost/ps/Fontmap +5 -0
- data/lib/rghost/ps/IsoLatin.enc +352 -0
- data/lib/rghost/ps/MacCentralEuropean.enc +258 -0
- data/lib/rghost/ps/MacCyrillice.desnc +258 -0
- data/lib/rghost/ps/MacGreek.enc +258 -0
- data/lib/rghost/ps/MacHebrew.enc +258 -0
- data/lib/rghost/ps/TeX-CorkEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-LGR-Greek.enc +258 -0
- data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +258 -0
- data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-XL2encoding.enc +258 -0
- data/lib/rghost/ps/TeXMathExtensionEncoding.enc +258 -0
- data/lib/rghost/ps/TeXMathItalicEncoding.enc +258 -0
- data/lib/rghost/ps/TeXMathSymbolEncoding.enc +258 -0
- data/lib/rghost/ps/US-ASCII.enc +258 -0
- data/lib/rghost/ps/UTF-8.enc +3 -0
- data/lib/rghost/ps/_cusor.ps +46 -0
- data/lib/rghost/ps/basic.ps +25 -0
- data/lib/rghost/ps/begin_document.ps +8 -0
- data/lib/rghost/ps/callbacks.ps +175 -0
- data/lib/rghost/ps/code128.font +344 -0
- data/lib/rghost/ps/code39.font +195 -0
- data/lib/rghost/ps/cursor.ps +106 -0
- data/lib/rghost/ps/datagrid.ps +55 -0
- data/lib/rghost/ps/developer.ps +237 -0
- data/lib/rghost/ps/ean.font +150 -0
- data/lib/rghost/ps/eps.ps +42 -0
- data/lib/rghost/ps/font.ps +38 -0
- data/lib/rghost/ps/frame.ps +16 -0
- data/lib/rghost/ps/gif.ps +150 -0
- data/lib/rghost/ps/horizontal_line.ps +4 -0
- data/lib/rghost/ps/i25.font +103 -0
- data/lib/rghost/ps/jpeg.ps +122 -0
- data/lib/rghost/ps/link.ps +22 -0
- data/lib/rghost/ps/paper.ps +8 -0
- data/lib/rghost/ps/rect_link.ps +17 -0
- data/lib/rghost/ps/rectangle.ps +5 -0
- data/lib/rghost/ps/rghost_default_template.eps +1532 -0
- data/lib/rghost/ps/row.ps +4 -0
- data/lib/rghost/ps/show.ps +21 -0
- data/lib/rghost/ps/table_callbacks.ps +96 -0
- data/lib/rghost/ps/text.ps +63 -0
- data/lib/rghost/ps/textarea.ps +11 -0
- data/lib/rghost/ps/type.ps +1 -0
- data/lib/rghost/ps/unit.ps +3 -0
- data/lib/rghost/ps/vertical_line.ps +12 -0
- data/lib/rghost/ps/virtual_pages.ps +55 -0
- data/lib/rghost/ps_facade.rb +253 -0
- data/lib/rghost/ps_object.rb +55 -0
- data/lib/rghost/rectangle_link.rb +65 -0
- data/lib/rghost/rgengine.so +0 -0
- data/lib/rghost/ruby_ghost_config.rb +252 -0
- data/lib/rghost/ruby_ghost_engine.rb +174 -0
- data/lib/rghost/ruby_ghost_version.rb +8 -0
- data/lib/rghost/ruby_to_ps.rb +78 -0
- data/lib/rghost/scale.rb +29 -0
- data/lib/rghost/shape_content.rb +23 -0
- data/lib/rghost/show.rb +88 -0
- data/lib/rghost/static_document_callback.rb +18 -0
- data/lib/rghost/text.rb +44 -0
- data/lib/rghost/text_in.rb +51 -0
- data/lib/rghost/text_link_in.rb +42 -0
- data/lib/rghost/textarea.rb +88 -0
- data/lib/rghost/units.rb +82 -0
- data/lib/rghost/variable.rb +12 -0
- data/lib/rghost/vertical_line.rb +37 -0
- data/lib/rghost/virtual_pages.rb +42 -0
- data/lib/rghost.rb +18 -0
- metadata +181 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
/show_center{ dup stringwidth pop 2 div neg 0 rmoveto show } def
|
2
|
+
/show_right{ dup stringwidth pop neg 0 rmoveto show } def
|
3
|
+
/show_left{ show }def
|
4
|
+
|
5
|
+
%%TODO: page_(center & left & right)
|
6
|
+
|
7
|
+
/page_center{
|
8
|
+
area_x 2 div margin /left get add current_row moveto
|
9
|
+
dup stringwidth pop 2 div neg 0 rmoveto show
|
10
|
+
} def
|
11
|
+
|
12
|
+
/page_right{
|
13
|
+
area_x margin /left get add current_row moveto
|
14
|
+
dup stringwidth pop neg 0 rmoveto show
|
15
|
+
} def
|
16
|
+
|
17
|
+
/page_left{
|
18
|
+
limit_left current_row moveto
|
19
|
+
%dup stringwidth pop neg 0 rmoveto
|
20
|
+
show
|
21
|
+
} def
|
@@ -0,0 +1,96 @@
|
|
1
|
+
%%TABLE
|
2
|
+
/before_table_create {} def
|
3
|
+
/after_table_create{} def
|
4
|
+
%%%%%%TABLE ROW---------------------
|
5
|
+
|
6
|
+
/row_odd_or_even {
|
7
|
+
current_table_row odd? {odd_row}{even_row} ifelse
|
8
|
+
}def
|
9
|
+
/before_row_create 3 dict def before_row_create begin
|
10
|
+
/proc { } bind def
|
11
|
+
/except [ ] def
|
12
|
+
/only [ ] def
|
13
|
+
end
|
14
|
+
|
15
|
+
/odd_row 3 dict def odd_row begin
|
16
|
+
/proc { } bind def
|
17
|
+
/except [ ] def
|
18
|
+
/only [ ] def
|
19
|
+
end
|
20
|
+
|
21
|
+
/even_row 3 dict def even_row begin
|
22
|
+
/proc { } bind def
|
23
|
+
/except [ ] def
|
24
|
+
/only [ ] def
|
25
|
+
end
|
26
|
+
|
27
|
+
%column
|
28
|
+
/col_odd_or_even {
|
29
|
+
col odd? {odd_column}{even_column} ifelse
|
30
|
+
}def
|
31
|
+
|
32
|
+
/before_column 3 dict def before_column begin
|
33
|
+
/proc { } bind def
|
34
|
+
/except [ ] def
|
35
|
+
/only [ ] def
|
36
|
+
end
|
37
|
+
|
38
|
+
/after_column 3 dict def after_column begin
|
39
|
+
/proc { } bind def
|
40
|
+
/except [ ] def
|
41
|
+
/only [ ] def
|
42
|
+
end
|
43
|
+
|
44
|
+
/odd_column 3 dict def odd_column begin
|
45
|
+
/proc { } bind def
|
46
|
+
/except [ ] def
|
47
|
+
/only [ ] def
|
48
|
+
end
|
49
|
+
|
50
|
+
/even_column 3 dict def even_column begin
|
51
|
+
/proc { } bind def
|
52
|
+
/except [ ] def
|
53
|
+
/only [ ] def
|
54
|
+
end
|
55
|
+
|
56
|
+
%%HEADER----------------------
|
57
|
+
/before_header_create {} def
|
58
|
+
/after_header_create {} def
|
59
|
+
|
60
|
+
/before_column_header 3 dict def before_column_header begin
|
61
|
+
/proc { } bind def
|
62
|
+
/except [ ] def
|
63
|
+
/only [ ] def
|
64
|
+
end
|
65
|
+
|
66
|
+
/after_column_header 3 dict def after_column_header begin
|
67
|
+
/proc { } bind def
|
68
|
+
/except [ ] def
|
69
|
+
/only [ ] def
|
70
|
+
end
|
71
|
+
|
72
|
+
%%ROW CALLBACKS
|
73
|
+
/callback_row{
|
74
|
+
dup dup
|
75
|
+
/except get length 0 ne { /except get current_table_row include? not}{
|
76
|
+
dup /only get length 0 ne { /only get current_table_row include?}{
|
77
|
+
pop true
|
78
|
+
}ifelse
|
79
|
+
}ifelse
|
80
|
+
{ /proc get exec }{
|
81
|
+
pop
|
82
|
+
}ifelse
|
83
|
+
} bind def
|
84
|
+
|
85
|
+
%%COLUMN CALLBACKS
|
86
|
+
/callback_col{
|
87
|
+
dup dup
|
88
|
+
/except get length 0 ne { /except get col include? not}{
|
89
|
+
dup /only get length 0 ne { /only get col include?}{
|
90
|
+
pop true
|
91
|
+
}ifelse
|
92
|
+
}ifelse
|
93
|
+
{ /proc get exec }{
|
94
|
+
pop
|
95
|
+
}ifelse
|
96
|
+
} bind def
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/:rh{ row_height } def
|
2
|
+
/append{
|
3
|
+
dup cvx exec 3 -1 roll _concat ( ) _concat def
|
4
|
+
} def
|
5
|
+
|
6
|
+
/_concat { exch dup length
|
7
|
+
2 index length add string
|
8
|
+
dup dup 4 2 roll copy length
|
9
|
+
4 -1 roll putinterval
|
10
|
+
} def
|
11
|
+
|
12
|
+
|
13
|
+
/:text{
|
14
|
+
/:space ( ) def
|
15
|
+
/:nw{ search false eq { /:last true def } if strlen :this_or_next }def
|
16
|
+
/:last false def
|
17
|
+
/:this_or_next{ X add limit_right le { show }{ nrdp show} ifelse :space show } def
|
18
|
+
} def
|
19
|
+
|
20
|
+
|
21
|
+
/:text_area {
|
22
|
+
/:nbw{ currentpoint :rh sub exch pop 0 exch moveto } def
|
23
|
+
/:space ( ) def
|
24
|
+
/:this_or_next{ X add :bw le { show }{ :nbw show } ifelse :space show } def
|
25
|
+
/:nw{ search false eq { /:last true def } if strlen :this_or_next }def
|
26
|
+
/:last false def
|
27
|
+
} def
|
28
|
+
|
29
|
+
/:text_proc{:space { :nw :last {exit} if } loop /:last false def } def
|
30
|
+
|
31
|
+
/:last false def
|
32
|
+
|
33
|
+
/:nbw{ 0 Y :rh sub moveto } def
|
34
|
+
|
35
|
+
/text_disp {
|
36
|
+
text_align /center eq {
|
37
|
+
:bw 2 div Y moveto
|
38
|
+
strlen 2 div neg 0 rmoveto show
|
39
|
+
%show
|
40
|
+
}{
|
41
|
+
:bw Y moveto
|
42
|
+
strlen neg 0 rmoveto show
|
43
|
+
|
44
|
+
}ifelse
|
45
|
+
} def
|
46
|
+
/:text_proc_cr {
|
47
|
+
/curstr () def
|
48
|
+
{
|
49
|
+
( ) search false eq /:last exch def
|
50
|
+
:last false eq {
|
51
|
+
exch pop curstr stringwidth pop ( ) stringwidth pop sub :bw le {
|
52
|
+
/curstr append
|
53
|
+
}{
|
54
|
+
curstr text_disp ( ) _concat /curstr exch def
|
55
|
+
:nbw
|
56
|
+
} ifelse
|
57
|
+
}{
|
58
|
+
/curstr append curstr text_disp :nbw
|
59
|
+
exit
|
60
|
+
} ifelse
|
61
|
+
} loop
|
62
|
+
/:last false def
|
63
|
+
}def
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/textarea_defaults {
|
2
|
+
/space ( ) def
|
3
|
+
/spacecount { 0 exch ( ) { search { pop 3 -1 roll 1 add 3 1 roll } { pop exit } ifelse } loop } def
|
4
|
+
/ssp { space search pop } def
|
5
|
+
/dsp { dup stringwidth pop } def
|
6
|
+
/cpp { currentpoint pop } def
|
7
|
+
/S { dup spacecount {ssp dsp cpp add rm gt { L s s }{ s s } ifelse } repeat pop } def
|
8
|
+
/n { show newline } def /s { show } def /L { newline} def
|
9
|
+
/centre { dup stringwidth pop 2 div rm 2 div exch sub lm add tm moveto } def
|
10
|
+
/c{ centre n} def
|
11
|
+
} def
|
@@ -0,0 +1 @@
|
|
1
|
+
%!
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
%vp = virtual_page
|
3
|
+
/current_vp 1 def
|
4
|
+
/has_vp? false def
|
5
|
+
/col_size 18 cm def
|
6
|
+
/vp_params [ [1 10] [1 20] [1 30]] def
|
7
|
+
/vp_count vp_params length def
|
8
|
+
/source_limit_left limit_left def
|
9
|
+
/source_limit_right limit_right def
|
10
|
+
/limit_right limit_left col_size add def
|
11
|
+
/col_margin 2 cm def
|
12
|
+
|
13
|
+
/next_page{
|
14
|
+
has_vp?{ (ok has virtual page, stopping) print
|
15
|
+
|
16
|
+
/row 1 def
|
17
|
+
/new_page? true def
|
18
|
+
|
19
|
+
current_vp 2 eq {
|
20
|
+
/current_vp 0 def
|
21
|
+
showpage
|
22
|
+
|
23
|
+
/limit_left source_limit_left def
|
24
|
+
/limit_right limit_left col_size add def
|
25
|
+
|
26
|
+
}{
|
27
|
+
/limit_left col_size col_margin add def
|
28
|
+
/limit_right limit_left col_size add def
|
29
|
+
} ifelse
|
30
|
+
/current_vp inc
|
31
|
+
/current_row limit_top row row_height mul sub def
|
32
|
+
|
33
|
+
new_current_row_point
|
34
|
+
default_point
|
35
|
+
|
36
|
+
|
37
|
+
}{
|
38
|
+
after_page_create callback
|
39
|
+
%(Page: ) print current_page 8 string cvs print (\n) print
|
40
|
+
|
41
|
+
showpage
|
42
|
+
/new_page? true def
|
43
|
+
|
44
|
+
/current_page inc
|
45
|
+
/current_row limit_top row row_height mul sub def
|
46
|
+
%before_page_create callback
|
47
|
+
%odd_or_even callback
|
48
|
+
current_page count_pages eq { last_page } if
|
49
|
+
new_current_row_point
|
50
|
+
default_point
|
51
|
+
before_page_create callback
|
52
|
+
odd_or_even callback
|
53
|
+
}ifelse
|
54
|
+
|
55
|
+
} def
|
@@ -0,0 +1,253 @@
|
|
1
|
+
[:ps_object, :dynamic_document_callback,:static_document_callback, :paper, :load,
|
2
|
+
:cursor,:show, :color, :graphic, :newpath, :line, :parse_text,:line_width, :textarea,
|
3
|
+
:variable, :eps, :jpeg, :gif, :text_in, :text_link_in, :ruby_ghost_engine, :convert,
|
4
|
+
:text, :dash, :border, :shape_content, :vertical_line, :horizontal_line,
|
5
|
+
:frame, :polygon, :circle, :how_to, :rectangle_link].each{|lib| require "rghost/#{lib}" }
|
6
|
+
|
7
|
+
|
8
|
+
#PsFacade is just a big facade involving an instance of most postscript objects.
|
9
|
+
class RGhost::PsFacade < RGhost::PsObject
|
10
|
+
attr_reader :rows
|
11
|
+
|
12
|
+
def initialize #(&block)
|
13
|
+
super(""){}
|
14
|
+
@rows=0
|
15
|
+
yield self if block_given?
|
16
|
+
#instance_eval(&block) if block
|
17
|
+
end
|
18
|
+
|
19
|
+
#A facade for the method Cursor.next_row
|
20
|
+
def next_row
|
21
|
+
@rows+=1
|
22
|
+
set RGhost::Cursor.next_row
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
#Close path of the graphic state
|
27
|
+
def closepath
|
28
|
+
call :closepath
|
29
|
+
end
|
30
|
+
|
31
|
+
#A facade for the method Cursor.next_page
|
32
|
+
def next_page
|
33
|
+
set RGhost::Cursor.next_page
|
34
|
+
end
|
35
|
+
|
36
|
+
#A facade for the class Graphic
|
37
|
+
def graphic(&block)
|
38
|
+
psfc=RGhost::PsFacade.new
|
39
|
+
yield psfc
|
40
|
+
raw :gsave
|
41
|
+
set psfc
|
42
|
+
raw :grestore
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
#A facade for the class NewPath
|
47
|
+
def newpath(&block)
|
48
|
+
psfc=RGhost::PsFacade.new
|
49
|
+
yield psfc
|
50
|
+
raw :newpath
|
51
|
+
set psfc
|
52
|
+
raw :closepath
|
53
|
+
#set RGhost::NewPath.new(&block)
|
54
|
+
end
|
55
|
+
|
56
|
+
#A facade for the method Cursor.showpage
|
57
|
+
def showpage
|
58
|
+
|
59
|
+
set RGhost::Cursor.showpage
|
60
|
+
|
61
|
+
end
|
62
|
+
#A facade for the class LineWidth
|
63
|
+
def line_width(value=nil)
|
64
|
+
set RGhost::LineWidth.new(value)
|
65
|
+
end
|
66
|
+
|
67
|
+
#A facade for the method Cursor.goto_row
|
68
|
+
def goto_row(row)
|
69
|
+
|
70
|
+
set RGhost::Cursor.goto_row(row)
|
71
|
+
end
|
72
|
+
|
73
|
+
#A facade for the method Cursor.jump_rows
|
74
|
+
def jump_rows(row)
|
75
|
+
@rows+=row
|
76
|
+
set RGhost::Cursor.jump_rows(row)
|
77
|
+
end
|
78
|
+
|
79
|
+
#A facade for the method Cursor.rotate
|
80
|
+
def rotate(angle)
|
81
|
+
set RGhost::Cursor.rotate(angle)
|
82
|
+
end
|
83
|
+
#A facade for the method Cursor.moveto
|
84
|
+
def moveto(point={})
|
85
|
+
set RGhost::Cursor.moveto(point)
|
86
|
+
end
|
87
|
+
|
88
|
+
#A facade for the method Cursor.rmoveto
|
89
|
+
def rmoveto(point={})
|
90
|
+
set RGhost::Cursor.rmoveto(point)
|
91
|
+
end
|
92
|
+
|
93
|
+
#A facade for the method Cursor.translate
|
94
|
+
def translate(point={})
|
95
|
+
set RGhost::Cursor.translate(point)
|
96
|
+
end
|
97
|
+
|
98
|
+
#A facade for the class DSCEntry
|
99
|
+
def dsc_entry(&block)
|
100
|
+
set RGhost::DSCEntry.new(&block)
|
101
|
+
end
|
102
|
+
|
103
|
+
#Use tag after defined in define_tags
|
104
|
+
def use_tag(tag_name)
|
105
|
+
raw "_#{tag_name}"
|
106
|
+
end
|
107
|
+
|
108
|
+
#A facade for the class Image.for
|
109
|
+
def image(path,options={})
|
110
|
+
set RGhost::Image.for(path,options)
|
111
|
+
end
|
112
|
+
|
113
|
+
#alias horizontal_line
|
114
|
+
def hl(valign=:middle,options={})
|
115
|
+
set RGhost::HorizontalLine.new(valign,options)
|
116
|
+
end
|
117
|
+
|
118
|
+
#A facade for the class HorizontalLine
|
119
|
+
def horizontal_line(valign=:middle,options={})
|
120
|
+
hl(valign,options)
|
121
|
+
end
|
122
|
+
|
123
|
+
#A facade for the method Frame.background_row
|
124
|
+
def background_row(options={})
|
125
|
+
set RGhost::Frame.background_row(options)
|
126
|
+
end
|
127
|
+
|
128
|
+
#A facade for the class Scale
|
129
|
+
def scale(sx,sy)
|
130
|
+
set RGhost::Scale.new(sx,sy)
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
#A facade for the method Scale.zoom
|
135
|
+
def zoom(percent)
|
136
|
+
set RGhost::Scale.zoom(percent)
|
137
|
+
end
|
138
|
+
|
139
|
+
#A facade for the class TextIn
|
140
|
+
def text_in(options={})
|
141
|
+
set RGhost::TextIn.new(options)
|
142
|
+
end
|
143
|
+
|
144
|
+
#A facade for the class TextLinkIn
|
145
|
+
def text_link(label,options={})
|
146
|
+
options[:label]=label
|
147
|
+
set RGhost::TextLinkIn.new(options)
|
148
|
+
end
|
149
|
+
|
150
|
+
#A facade for the class Text
|
151
|
+
def text(text,tag_parse=true)
|
152
|
+
set RGhost::Text.new(text.to_s,tag_parse)
|
153
|
+
end
|
154
|
+
|
155
|
+
#A facade for the class Show
|
156
|
+
def show(text,align={ :align=> :show_left })
|
157
|
+
set RGhost::Show.new(text.to_s,align)
|
158
|
+
end
|
159
|
+
|
160
|
+
def show_next_row(text,align={ :align=> :show_left })
|
161
|
+
next_row
|
162
|
+
show(text,align)
|
163
|
+
end
|
164
|
+
#Alias for show
|
165
|
+
def write(text,align={ :align=> :show_left })
|
166
|
+
show(text.to_s,align)
|
167
|
+
end
|
168
|
+
#Allows call template after it definition.
|
169
|
+
def use_template(name)
|
170
|
+
call "_#{name}"
|
171
|
+
end
|
172
|
+
|
173
|
+
#Call internal function by name
|
174
|
+
def use_function(name)
|
175
|
+
call "_#{name}"
|
176
|
+
end
|
177
|
+
|
178
|
+
#A facade for the class TextArea
|
179
|
+
def text_area(text,options={},tag_parse=true)
|
180
|
+
ta=RGhost::TextArea.new(text,options,tag_parse)
|
181
|
+
raw ta.ps
|
182
|
+
ta
|
183
|
+
end
|
184
|
+
|
185
|
+
#A facade for the class VerticalLine
|
186
|
+
def vertical_line(options={:start_in => :limit_left, :size => :area_y})
|
187
|
+
set RGhost::VerticalLine.new(options)
|
188
|
+
end
|
189
|
+
|
190
|
+
#A facade for the method VerticalLine.row
|
191
|
+
def vertical_line_row(border_options=RGhost::Border::DEFAULT_OPTIONS)
|
192
|
+
set RGhost::VerticalLine.row(border_options)
|
193
|
+
end
|
194
|
+
|
195
|
+
#Forces draw shapes
|
196
|
+
def stroke
|
197
|
+
|
198
|
+
call :stroke
|
199
|
+
end
|
200
|
+
|
201
|
+
#A facade for the method Line.lineto
|
202
|
+
def lineto(point={})
|
203
|
+
set RGhost::Line.make_command(:lineto,point)
|
204
|
+
end
|
205
|
+
|
206
|
+
#A facade for the method Line.rlineto
|
207
|
+
def rlineto(point={})
|
208
|
+
set RGhost::Line.make_command(:rlineto,point)
|
209
|
+
end
|
210
|
+
|
211
|
+
#A facade for the class Dash
|
212
|
+
def dash(options={})
|
213
|
+
set RGhost::Dash.new(options)
|
214
|
+
end
|
215
|
+
|
216
|
+
#A facade for the method Color.create
|
217
|
+
def color(options)
|
218
|
+
set RGhost::Color.create(options)
|
219
|
+
end
|
220
|
+
|
221
|
+
#A facade for the class Border
|
222
|
+
def border(options={})
|
223
|
+
set RGhost::Border.new(options)
|
224
|
+
end
|
225
|
+
|
226
|
+
#A facade for the class ShapeContent
|
227
|
+
def shape_content(options={})
|
228
|
+
set RGhost::ShapeContent.new(options)
|
229
|
+
end
|
230
|
+
|
231
|
+
#A facade for the class Frame
|
232
|
+
def frame(options)
|
233
|
+
set RGhost::Frame.new(options)
|
234
|
+
end
|
235
|
+
#A facade for the class Polygon
|
236
|
+
def polygon(options={},&block)
|
237
|
+
set RGhost::Polygon.new(options,&block)
|
238
|
+
end
|
239
|
+
|
240
|
+
#A facade for the class Circle
|
241
|
+
def circle(options={})
|
242
|
+
set RGhost::Circle.new(options)
|
243
|
+
end
|
244
|
+
|
245
|
+
#A facade for the class RectangleLink
|
246
|
+
def rectangle_link(options={})
|
247
|
+
set RGhost::RectangleLink.new(options)
|
248
|
+
end
|
249
|
+
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#Postscript wrapper class
|
2
|
+
class RGhost::PsObject
|
3
|
+
|
4
|
+
#Creates new instance of PsObject. Example
|
5
|
+
# PsObject.new("/my_proc { 33 45 2 10 sub mul div} bind def")
|
6
|
+
#Or by block code
|
7
|
+
# PsObject.new do
|
8
|
+
# set PsObject.new("(A test) show")
|
9
|
+
# raw "(Other Test in raw) show "
|
10
|
+
# end
|
11
|
+
def initialize(body="",&block)
|
12
|
+
@body=if body.is_a? RGhost::PsObject
|
13
|
+
body.ps
|
14
|
+
else
|
15
|
+
"#{body} "
|
16
|
+
end
|
17
|
+
|
18
|
+
instance_eval(&block) if block
|
19
|
+
|
20
|
+
end
|
21
|
+
#Alias for ps.
|
22
|
+
def to_s
|
23
|
+
ps
|
24
|
+
end
|
25
|
+
#Gets postscript code.
|
26
|
+
def ps
|
27
|
+
@body.to_s
|
28
|
+
end
|
29
|
+
#Pushes elements on the stack.
|
30
|
+
def raw(*value)
|
31
|
+
@body << "#{value.join(' ')} "
|
32
|
+
end
|
33
|
+
#Freezes graphic state
|
34
|
+
def graphic_scope
|
35
|
+
"beging #{self} endg "
|
36
|
+
end
|
37
|
+
#Sets PsObject into this object.
|
38
|
+
def set(value)
|
39
|
+
|
40
|
+
raise TypeError.new("can't convert #{value.class} into PsObject") unless value.is_a? RGhost::PsObject
|
41
|
+
@body << "#{value.ps} "
|
42
|
+
value
|
43
|
+
end
|
44
|
+
#Alias for set
|
45
|
+
def <<(value)
|
46
|
+
set value
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
#Call operator in the stack
|
51
|
+
def call(name)
|
52
|
+
set RGhost::PsObject.new(name)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#Creates one rectangle or one shape with rounded corners.
|
2
|
+
#===Options
|
3
|
+
#
|
4
|
+
#* <tt>:x and :y</tt> - Coordinates to position.
|
5
|
+
#* <tt>:corners</tt> - Value for rounded corners. Use 0 to straight angle.
|
6
|
+
#* <tt>:width and :height</tt> - Size of frame
|
7
|
+
#* <tt>:content</tt> - facade to ShapeContent with same parameters.
|
8
|
+
#* <tt>:border</tt> - facade to Border with same parameters.
|
9
|
+
#===Examples using facade frame method inside of Document
|
10
|
+
# d=Document.new
|
11
|
+
# d.frame :x => 3, :width => 7, :height => 5, :content => {:fill => false}
|
12
|
+
#
|
13
|
+
#link:images/frame01.png
|
14
|
+
# d=Document.new
|
15
|
+
# d.frame :x => 3, :width => 7, :height => 5, :content => {:color => '#35F6A3' }
|
16
|
+
#
|
17
|
+
#link:images/frame02.png
|
18
|
+
#
|
19
|
+
# d=Document.new
|
20
|
+
# d.frame :x => 3, :width => 7, :height => 5, :content => {:color => '#35F6A3' }, :border =>{:width => 5, :dash => [1,3,10]}
|
21
|
+
#
|
22
|
+
#link:images/frame03.png
|
23
|
+
#
|
24
|
+
# d=Document.new
|
25
|
+
# d.frame :x => 3, :width => 7, :height => 5, :content => {:color => '#35F6A3' }, :corners => 20
|
26
|
+
#
|
27
|
+
#link:images/frame04.png
|
28
|
+
#
|
29
|
+
# d=Document.new
|
30
|
+
# d.frame :x => 3, :width => 7, :height => 5, :content => {:color => :yellow }, :border => {:color => :red, :width => 4}, :corners => 20
|
31
|
+
#
|
32
|
+
#link:images/frame05.png
|
33
|
+
class RGhost::RectangleLink < RGhost::PsObject
|
34
|
+
include RGhost::RubyToPs
|
35
|
+
DEFAULT_OPTIONS={
|
36
|
+
:x => :limit_left,
|
37
|
+
:y => :current_row,
|
38
|
+
:width => 5,
|
39
|
+
:height => 3.5,
|
40
|
+
:url => "http://rghost.rubyforge.org",
|
41
|
+
:border_color => RGhost::Border::DEFAULT_OPTIONS[:color]
|
42
|
+
|
43
|
+
|
44
|
+
}
|
45
|
+
def initialize(options={})
|
46
|
+
|
47
|
+
@options = DEFAULT_OPTIONS.dup.merge(options)
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def ps
|
53
|
+
x=RGhost::Units::parse(@options[:x])
|
54
|
+
y=RGhost::Units::parse(@options[:y])
|
55
|
+
|
56
|
+
h=RGhost::Units::parse(@options[:height])
|
57
|
+
w=RGhost::Units::parse(@options[:width])
|
58
|
+
url=@options[:url]
|
59
|
+
scolor=RGhost::Color.create(@options[:border_color]).ps.gsub(/setrgbcolor/,'')
|
60
|
+
"/:rect_color [#{scolor}] def /:rect_x #{x} def /:rect_y #{y} def /:rect_w #{w} def /:rect_h #{h} def /:rect_uri #{to_string(url)} def :rect_link"
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
Binary file
|