101 |
101 |
while(i<nb)
|
102 |
102 |
c=s[i]
|
103 |
103 |
if(c<128)
|
104 |
|
l+=cw[c.chr]
|
|
104 |
l+=cw[c.chr] if cw[c.chr]
|
105 |
105 |
i+=1
|
106 |
106 |
else
|
107 |
107 |
l+=1000
|
... | ... | |
139 |
139 |
b2='LR'
|
140 |
140 |
else
|
141 |
141 |
b2=''
|
142 |
|
if(border.index('L').nil?)
|
143 |
|
b2+='L'
|
144 |
|
end
|
145 |
|
if(border.index('R').nil?)
|
146 |
|
b2+='R'
|
147 |
|
end
|
148 |
|
b=border.index('T').nil? ? b2+'T' : b2
|
|
142 |
b2='L' unless border.to_s.index('L').nil?
|
|
143 |
b2=b2+'R' unless border.to_s.index('R').nil?
|
|
144 |
b=(border.to_s.index('T')) ? (b2+'T') : b2
|
149 |
145 |
end
|
150 |
146 |
end
|
151 |
147 |
sep=-1
|
... | ... | |
158 |
154 |
c=s[i]
|
159 |
155 |
#Check if ASCII or MB
|
160 |
156 |
ascii=(c<128)
|
161 |
|
if(c=="\n")
|
|
157 |
if(c.chr=="\n")
|
162 |
158 |
#Explicit line break
|
163 |
159 |
Cell(w,h,s[j,i-j],b,2,align,fill)
|
164 |
160 |
i+=1
|
... | ... | |
174 |
170 |
if(!ascii)
|
175 |
171 |
sep=i
|
176 |
172 |
ls=l
|
177 |
|
elsif(c==' ')
|
|
173 |
elsif(c.chr==' ')
|
178 |
174 |
sep=i
|
179 |
175 |
ls=l
|
180 |
176 |
end
|
181 |
|
l+=ascii ? cw[c.chr] : 1000
|
|
177 |
l+=(ascii ? cw[c.chr] : 1000) || 0
|
182 |
178 |
if(l>wmax)
|
183 |
179 |
#Automatic line break
|
184 |
180 |
if(sep==-1 or i==j)
|
... | ... | |
188 |
184 |
Cell(w,h,s[j,i-j],b,2,align,fill)
|
189 |
185 |
else
|
190 |
186 |
Cell(w,h,s[j,sep-j],b,2,align,fill)
|
191 |
|
i=(s[sep]==' ') ? sep+1 : sep
|
|
187 |
i=(s[sep].chr==' ') ? sep+1 : sep
|
192 |
188 |
end
|
193 |
189 |
sep=-1
|
194 |
190 |
j=i
|
... | ... | |
202 |
198 |
end
|
203 |
199 |
end
|
204 |
200 |
#Last chunk
|
205 |
|
if(border and not border.index('B').nil?)
|
|
201 |
if(border and not border.to_s.index('B').nil?)
|
206 |
202 |
b+='B'
|
207 |
203 |
end
|
208 |
204 |
Cell(w,h,s[j,i-j],b,2,align,fill)
|
... | ... | |
234 |
230 |
c=s[i]
|
235 |
231 |
#Check if ASCII or MB
|
236 |
232 |
ascii=(c<128)
|
237 |
|
if(c=="\n")
|
|
233 |
if(c.chr=="\n")
|
238 |
234 |
#Explicit line break
|
239 |
235 |
Cell(w,h,s[j,i-j],0,2,'',0,link)
|
240 |
236 |
i+=1
|
... | ... | |
249 |
245 |
nl+=1
|
250 |
246 |
next
|
251 |
247 |
end
|
252 |
|
if(!ascii or c==' ')
|
|
248 |
if(!ascii or c.chr==' ')
|
253 |
249 |
sep=i
|
254 |
250 |
end
|
255 |
|
l+=ascii ? cw[c.chr] : 1000
|
|
251 |
l+=(ascii ? cw[c.chr] : 1000) || 0
|
256 |
252 |
if(l>wmax)
|
257 |
253 |
#Automatic line break
|
258 |
254 |
if(sep==-1 or i==j)
|
... | ... | |
272 |
268 |
Cell(w,h,s[j,i-j],0,2,'',0,link)
|
273 |
269 |
else
|
274 |
270 |
Cell(w,h,s[j,sep-j],0,2,'',0,link)
|
275 |
|
i=(s[sep]==' ') ? sep+1 : sep
|
|
271 |
i=(s[sep].chr==' ') ? sep+1 : sep
|
276 |
272 |
end
|
277 |
273 |
sep=-1
|
278 |
274 |
j=i
|