Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "Pastel::Text::AttributedString 3" | |
132 | .TH Pastel::Text::AttributedString 3 "2003-04-29" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Pastel::Text::AttributedString \- For drawing text with attributes. | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& $as = Pastel::Text::AttributedString->new(-text=>"Some text"); | |
139 | .Ve | |
140 | .PP | |
141 | .Vb 2 | |
142 | \& # create a font object | |
143 | \& $font = Pastel::Font->new(-family=>"Arial", -style=>"bold", -size=>14); | |
144 | .Ve | |
145 | .PP | |
146 | .Vb 4 | |
147 | \& # create a hash containing font | |
148 | \& $att{FONT} = $font; | |
149 | \& $att{X} = 100; | |
150 | \& $att{Y} = 200; | |
151 | .Ve | |
152 | .PP | |
153 | .Vb 2 | |
154 | \& $as1 = Pastel:: Text::AttributedString->new(-text=>"Some text", | |
155 | \& -attributes=> \e%att); | |
156 | .Ve | |
157 | .PP | |
158 | .Vb 1 | |
159 | \& my $g = Pastel::Graphics->new(); | |
160 | .Ve | |
161 | .PP | |
162 | .Vb 2 | |
163 | \& # draw both the string | |
164 | \& $g->draw_string($as, 10, 20); | |
165 | .Ve | |
166 | .PP | |
167 | .Vb 3 | |
168 | \& # no x and y coordinates. Remember, we created the hash containing | |
169 | \& # coordinates | |
170 | \& $g->draw_string($as1); | |
171 | .Ve | |
172 | .PP | |
173 | .Vb 2 | |
174 | \& # set some attributes to $as. | |
175 | \& $as->add_attribute("COLOR", Pastel::Color->red, 0, 3); | |
176 | .Ve | |
177 | .PP | |
178 | .Vb 2 | |
179 | \& # draw the sting now | |
180 | \& $g->draw_string($as, 200, 300); | |
181 | .Ve | |
182 | .SH "DESCRIPTION" | |
183 | .IX Header "DESCRIPTION" | |
184 | \&\s-1SVG\s0 \*(L"tspan\*(R" elements are supported by this module. Unlike | |
185 | AttributedString class in Java, you do not pass | |
186 | AttributedCharacterIterator to the graphics context. But pass the | |
187 | AttributedString class itself. | |
188 | .PP | |
189 | The following text attributes are defined and can be used with this module\- | |
190 | .PP | |
191 | .Vb 1 | |
192 | \& FONT A Pastel::Font object | |
193 | .Ve | |
194 | .PP | |
195 | .Vb 4 | |
196 | \& FAMILY A string describing the family name of the font. If the | |
197 | \& FONT attibute is already set then this attribute is ignored. | |
198 | \& Should not be a composite of more than one attributes. e.g. | |
199 | \& "Arial" is a valid attibute value but "Arial-Bold" is not. | |
200 | .Ve | |
201 | .PP | |
202 | .Vb 1 | |
203 | \& POSTURE REGULAR or OBLIQUE or ITALIC | |
204 | .Ve | |
205 | .PP | |
206 | .Vb 1 | |
207 | \& WEIGHT REGULAR or BOLD. Default REGULAR. | |
208 | .Ve | |
209 | .PP | |
210 | .Vb 1 | |
211 | \& SIZE Point size. | |
212 | .Ve | |
213 | .PP | |
214 | .Vb 1 | |
215 | \& COLOR Pastel::Color object. | |
216 | .Ve | |
217 | .PP | |
218 | .Vb 1 | |
219 | \& UNDERLINE ON | |
220 | .Ve | |
221 | .PP | |
222 | .Vb 1 | |
223 | \& STRIKETHROUGH ON | |
224 | .Ve | |
225 | .PP | |
226 | .Vb 1 | |
227 | \& ANCHOR START or MIDDLE or END | |
228 | .Ve | |
229 | .PP | |
230 | .Vb 1 | |
231 | \& STROKE_WIDTH Numeric value denoting stroke-width in pixels | |
232 | .Ve | |
233 | .PP | |
234 | .Vb 1 | |
235 | \& STROKE_COLOR Pastel::Color object | |
236 | .Ve | |
237 | .PP | |
238 | .Vb 1 | |
239 | \& ROTATE Numeric value indicating the rotation of the glyph | |
240 | .Ve | |
241 | .PP | |
242 | Note that X and Y coordinates are not valid attributes. | |
243 | .PP | |
244 | Each AttributedString class contains the \f(CW\*(C`root\*(C'\fR attribute, which is | |
245 | applied to the whole string. The are three ways to put this root | |
246 | attributes: (1) pass the attributes as hash in the construtor; (2) use | |
247 | the \f(CW\*(C`add_attribute()\*(C'\fR method with only the first two arguments; (3) | |
248 | use \f(CW\*(C`add_attribute()\*(C'\fR method with the first index 0 and the last | |
249 | index equals to the length of the whole string. | |
250 | .PP | |
251 | In addition to the \f(CW\*(C`root\*(C'\fR element the AttributedString contains | |
252 | several \f(CW"runs"\fR. Each run is represented by a single \f(CW\*(C`<tspan\*(C'\fR> element. | |
253 | .SH "CONSTRUCTOR" | |
254 | .IX Header "CONSTRUCTOR" | |
255 | .Sh "Pastel::Text::AttributedString\->new(\-text=>$string)" | |
256 | .IX Subsection "Pastel::Text::AttributedString->new(-text=>$string)" | |
257 | Creates and returns an AttributedString object with no attributes defined. | |
258 | .Sh "Pastel::Text::AttributedString\->new(\-text=>$string, \-attributes=>\e%att);" | |
259 | .IX Subsection "Pastel::Text::AttributedString->new(-text=>$string, -attributes=>%att);" | |
260 | Creates and returns an AttributedString object with attributes defined | |
261 | for the whole string.%att is a hash containing the attributes in key | |
262 | value pairs. | |
263 | .SH "METHODS" | |
264 | .IX Header "METHODS" | |
265 | .SH "PRIVATE METHODS" | |
266 | .IX Header "PRIVATE METHODS" | |
267 | .ie n .Sh "_create_new_run($key, $value\fP, \f(CW$start\fP, \f(CW$end)" | |
268 | .el .Sh "_create_new_run($key, \f(CW$value\fP, \f(CW$start\fP, \f(CW$end\fP)" | |
269 | .IX Subsection "_create_new_run($key, $value, $start, $end)" | |
270 | If there is no run present this method actually creates a new run. Should be called when \f(CW$self\fR\->{runcount} = 0. | |
271 | .PP | |
272 | .Vb 2 | |
273 | \& Returns : Nothing. | |
274 | \& Arguments: Same as add_attribute() | |
275 | .Ve | |
276 | .Sh "\fI_break_run()\fP" | |
277 | .IX Subsection "_break_run()" | |
278 | Describe your function here | |
279 | .PP | |
280 | .Vb 2 | |
281 | \& Returns : | |
282 | \& Arguments: | |
283 | .Ve | |
284 | .Sh "_valid_key($string)" | |
285 | .IX Subsection "_valid_key($string)" | |
286 | Validate the string whether it is a legal \f(CW\*(C`key\*(C'\fR or not. The function | |
287 | loops through the array in \f(CW\*(C`valid_keys\*(C'\fR attribute and returns true, | |
288 | if it is present or false it it is not. | |
289 | .PP | |
290 | .Vb 2 | |
291 | \& Returns : 1 if $string is a valid key or return C<undef>. | |
292 | \& Arguments: A string. | |
293 | .Ve | |
294 | .Sh "\fI_get_attributes_as_style()\fP" | |
295 | .IX Subsection "_get_attributes_as_style()" | |
296 | Describe your function here | |
297 | .PP | |
298 | .Vb 2 | |
299 | \& Returns : | |
300 | \& Arguments: | |
301 | .Ve | |
302 | .SH "CONTACT" | |
303 | .IX Header "CONTACT" | |
304 | Malay <curiouser@ccmb.res.in> |