Fix systematic errors in pagination, sucursal warnings, and fatal count() errors across multiple modules
This commit is contained in:
@@ -377,16 +377,18 @@ class Text_Frame_Reflower extends Frame_Reflower {
|
||||
// faster than doing a single-pass character by character scan. Heh,
|
||||
// yes I took the time to bench it ;)
|
||||
$words = array_flip(preg_split("/[\s-]+/u",$str, -1, PREG_SPLIT_DELIM_CAPTURE));
|
||||
array_walk($words, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.addslashes($font).'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($words, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
arsort($words);
|
||||
$min = reset($words);
|
||||
break;
|
||||
|
||||
case "pre":
|
||||
$lines = array_flip(preg_split("/\n/u", $str));
|
||||
array_walk($lines, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.addslashes($font).'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($lines, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
|
||||
arsort($lines);
|
||||
$min = reset($lines);
|
||||
@@ -413,8 +415,9 @@ class Text_Frame_Reflower extends Frame_Reflower {
|
||||
case "pre-wrap":
|
||||
// Find the longest word (i.e. minimum length)
|
||||
$lines = array_flip(preg_split("/\n/", $text));
|
||||
array_walk($lines, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.$font.'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($lines, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
arsort($lines);
|
||||
reset($lines);
|
||||
$str = key($lines);
|
||||
|
||||
Reference in New Issue
Block a user