找到dompdf\include下的text_frame_reflower.cls.PHP文件:
DOMPDF负责渲染文本的text_frame_reflower.cls.php文件,把以空格、分隔符为界的分割模式,修改为以一个utf-8字符为界的分隔模式。
将此代码:
- // ........text_frame_reflower.cls.php ........
- // split the text into words
- $words = preg_split('/([\s-]+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
- $wc = count($words);
- // ...............................................
换成:
- // ........text_frame_reflower.cls.php ........
- // split the text into words
- preg_match_all("/./u", $text, $array);
- $words = array(0);
- $wc = count($words);
- // ...............................................
// ........text_frame_reflower.cls.php 第50行........
// split the text into words
preg_match_all("/./u", $text, $array);
$words = array[0];
$wc = count($words);
// ...............................................