Fix systematic errors in pagination, sucursal warnings, and fatal count() errors across multiple modules

This commit is contained in:
2026-01-07 01:06:27 -06:00
parent aaa77e870e
commit 3a5afa82fe
354 changed files with 9022 additions and 15093 deletions

View File

@@ -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);