dompdf对换行符断字的计算错误 [英] dompdf does wrong calculation for line breaks breaking words

查看:77
本文介绍了dompdf对换行符断字的计算错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是dompdf 0.5.2,但有一个问题,当一行上有一个重音符号时,下一行的第一个字符会移入其中,例如:

I'm using dompdf 0.5.2 and having the problem that when there is an accent on a line, the first character from the next line is moved into it, like:

This is a first line with áccent. T
his is a second line.

在第一行的末尾注意T,它属于第二行。它同时使用默认字体和自定义加载字体。还尝试了UTF-8和ISO-8859-1编码。

Notice the T at the end of the first line, it belongs to the second. It happens both with a default and a custom loaded font. Also tried with UTF-8 and ISO-8859-1 encodings.

推荐答案

有效的解决方案,取自此处将以下代码行添加到dompdf文件 include / text_frame_reflower中。第246行之后的cls.php

The solution that worked, taken from here, is adding the following line of code to the dompdf file include/text_frame_reflower.cls.php after line 246:

$split = mb_strlen(mb_substr($this->_frame->get_text(), 0, $split), 'UTF-8');

这篇关于dompdf对换行符断字的计算错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆