-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
223 lines (151 loc) · 6.63 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
cage
Table of Contents
─────────────────
1. Important note
2. Introduction
3. The wrapper
.. 1. Parameters
.. 2. Function name
.. 3. Other differences
4. Issues
.. 1. Missing function
5. BUGS
6. License
7. NO WARRANTY
[http://quickdocs.org/badge/cl-pslib.svg]
[http://quickdocs.org/badge/cl-pslib.svg]
<http://quickdocs.org/cl-pslib/>
1 Important note
════════════════
The 'ps' nickname for this package has been removed.
This means that if you are using this library you should replace all
occurences of the 'ps' package qualifier with 'cl-pslib'.
Examples
from:
┌────
│ (ps:get-value doc "boxheight")
└────
to:
┌────
│ (cl-pslib:get-value doc "boxheight")
└────
and from:
┌────
│ (defpackage :foo
│ (:use :ps))
└────
to:
┌────
│ (defpackage :foo
│ (:use :cl-pslib))
└────
Alternatively., if you are using ECL, ABCL, CCL or SBCL compiler you
can setup a package local nickname as showed [here].
[here]
<http://www.sbcl.org/manual/index.html#Package_002dLocal-Nicknames>
2 Introduction
══════════════
Cl-pslib is a (thin) wrapper around [pslib] a library for generating
PostScript files.
[pslib] <http://pslib.sourceforge.net/>
3 The wrapper
═════════════
Cl-pslib use CFFI and SWIG to interface with foreign (non lisp)
library and generate the low-level lisp wrapper respectively.
cl-pslib does not export the raw (CFFI) pslib API but use CLOS
instead.
A psdoc C struct pointer is wrapped in the class psdoc, most of the
functions to manipulate this pointer are wrapped in lisp methods
specialized for that class.
3.1 Parameters
──────────────
Pslib use a lot of parameters to configure its behavior.
Example:
┌────
│ (get-value doc "boxheight")
└────
I found this very unpractical so i tried to generate lisp constants to
match the corresponding string parameter
┌────
│ (get-value doc +value-key-boxheight+)
└────
3.2 Function name
─────────────────
As general rule the methods for the class psdoc are the same of the
ones of the pslib with the character "_" substituted by "-".
There are some exceptions listed below.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
native name lisp name
───────────────────────────────────────────────────────────────────────────────────────
`PS_set_border_color' `set-border-link-color'
`PS_set_border_dash' `set-border-link-dash'
`PS_set_border_style' `set-border-link-style'
`PS_open, PS_open_mem' `open-doc'
`PS_fill' `fill-path'
`PS_show and PS_show2' `show'
`PS_show_xy and PS_show_xy2' `show-xy'
`PS_string_geometry', `PS_stringwidth' and `PS_stringwidth2' `string-geometry'
`PS_symbol' `font-symbol'
`PS_symbol_name' `font-symbol-name'
`PS_symbol_width' `font-symbol-width'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3.3 Other differences
─────────────────────
• `setcolor' can accept a `cl-color' object as parameter;
• there is no '(ps_)boot' method; when an instance of `psdoc' is
created the `initialize-instance' of that class will call `ps_boot'
if needed. The same is true for '(ps_)new' method;
• `open-doc' method will pass the output of pslib (i.e.the PostScript
file) to a lisp callback function if the second argument of the
function is nil; by default the callback just copy the output in
`cl-pslib:*callback-string*'. This maybe can be useful for generate
a file in a web application.
There is another callback: `write-to-stream' that write the
postscript code to a stream (by default the stream is bound to
`*standard-output*')
┌────
│ (let* ((cl-pslib:*callback-stream* *standard-output*)
│ (doc (make-instance 'cl-pslib:psdoc
│ :writeproc (cffi:callback write-to-stream))))
│ ;; rest of the code here
│ )
│
└────
• the `string-geometry' method return an instance of `text-metrics'
class
4 Issues
════════
Note that the whole library is in an alpha stage, testing is still in
progress, please see [section below]
• to use the template features `begin-template' and `and-template' a
version >= 0.47 must be used.
[section below] See section 7
4.1 Missing function
────────────────────
The high-level API does not still remap this functions:
• `PS_free_glyph_list';
• `PS_get_buffer';
• `PS_glyph_list';
• `PS_new2';
• `PS_open_fp';
• `PS_hyphenate';
• `PS_list_parameters';
• `PS_list_resources';
• `PS_list_values';
• `PS_set_gstate';
• `PS_setdash' (use `set-polydash' instead).
5 BUGS
══════
Please file bug report on the [issue tracker]
[issue tracker] <https://notabug.org/cage/cl-pslib/issues>
6 License
═════════
This library is released under Lisp Lesser General Public license (see
COPYING.LESSER file)
Examples are released under GPL version 3 or later
7 NO WARRANTY
═════════════
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.