Commit ffaf8d5 1 parent e96e9a8 commit ffaf8d5 Copy full SHA for ffaf8d5
File tree 1 file changed +27
-28
lines changed
1 file changed +27
-28
lines changed Original file line number Diff line number Diff line change @@ -172,47 +172,46 @@ public function CheckPageBreak($h) {
172
172
* @param $txt The text
173
173
*/
174
174
public function NbLines ($ w , $ txt ) {
175
- $ cw =&$ this ->CurrentFont ['cw ' ];
176
- if ($ w ==0 ) {
177
- $ w =$ this ->w -$ this ->rMargin -$ this ->x ;
175
+ if ($ w ==0 ) {
176
+ $ w = $ this ->w -$ this ->rMargin -$ this ->x ;
178
177
}
179
- $ wmax=( $ w -2 *$ this ->cMargin )* 1000 / $ this -> FontSize ;
180
- $ s= str_replace ("\r" , '' , $ txt );
181
- $ nb= strlen ($ s );
182
- if ($ nb >0 && $ s [$ nb -1 ]=="\n" ) {
178
+ $ wmax = $ w -2 *$ this ->cMargin ;
179
+ $ s = str_replace ("\r" , '' , $ txt );
180
+ $ nb = strlen ($ s );
181
+ if ($ nb >0 && $ s [$ nb -1 ]=="\n" ) {
183
182
$ nb --;
184
183
}
185
- $ sep= -1 ;
186
- $ i= 0 ;
187
- $ j= 0 ;
188
- $ l= 0 ;
189
- $ nl= 1 ;
190
- while ($ i <$ nb ) {
191
- $ c= $ s [$ i ];
192
- if ($ c =="\n" ) {
184
+ $ sep = -1 ;
185
+ $ i = 0 ;
186
+ $ j = 0 ;
187
+ $ l = 0 ;
188
+ $ nl = 1 ;
189
+ while ($ i <$ nb ) {
190
+ $ c = $ s [$ i ];
191
+ if ($ c =="\n" ) {
193
192
$ i ++;
194
- $ sep= -1 ;
195
- $ j= $ i ;
196
- $ l= 0 ;
193
+ $ sep = -1 ;
194
+ $ j = $ i ;
195
+ $ l = 0 ;
197
196
$ nl ++;
198
197
continue ;
199
198
}
200
- if ($ c ==' ' ) {
201
- $ sep= $ i ;
199
+ if ($ c ==' ' ) {
200
+ $ sep = $ i ;
202
201
}
203
- $ l+= isset ( $ cw [ $ c ]) ? intval ( $ cw [ $ c ]) : 0 ;
204
- if ($ l >$ wmax ) {
205
- if ($ sep ==-1 ) {
206
- if ($ i ==$ j ) {
202
+ $ l += $ this -> GetStringWidth ( $ c ) ;
203
+ if ($ l >$ wmax ) {
204
+ if ($ sep ==-1 ) {
205
+ if ($ i ==$ j ) {
207
206
$ i ++;
208
207
}
209
208
}
210
209
else {
211
- $ i= $ sep +1 ;
210
+ $ i = $ sep +1 ;
212
211
}
213
- $ sep= -1 ;
214
- $ j= $ i ;
215
- $ l= 0 ;
212
+ $ sep = -1 ;
213
+ $ j = $ i ;
214
+ $ l = 0 ;
216
215
$ nl ++;
217
216
}
218
217
else {
You can’t perform that action at this time.
0 commit comments