SourceForge Forum Archive This is an archive of the old dompdf sourceforge forums. Please donate. This gets a lot of traffic and bandwidth costs money. |
|
| Problem line break in context Go Back |
|
Problem line break in context Hi people i have a problem with line break... I have a text and when i generate the PDF the context don't have line break and the word be split wrong like that: O seminário, realizado pelo Instituto Euvaldo Lodi (IEL), em parceria com o Conselho Setorial d a Indústria Mineral da Federação das Indústrias do Estado do Paraná (Fiep), fez parte do ciclo de 13 ev entos realizados no mês de novembro sobre meio ambiente, micro e pequena indústria, setor mo veleiro e mineral. if you see the word "d line break a" after Conceslo setorial is wrong because that word "da" need be all in the other line not be splited. What i can do ? |
|
RE: Problem line break in context I had the same problem with each line containing non latin non punctuation charaters (such as em dash, en dash, degree symbol, etc.).
I wasn't able to trace the problem to its root, but the problem seems to occurs in text_frame_decorator.cls.php, in function split_text, around line 127.
Basically, the internal encoding of the DOMDocument loaded appears to be ISO-8859-1 in my case, but the nodes' content are UTF-8. The DOMText::splitText function seems to go fubar because of that.
I did solve my problem with the following hack. It's a hack because I did not find where exactly the problem originates, but I cancelled its effect in a later stage. Therefore, this is no bug fix.
I replaced this code (n text_frame_decorator.cls.php, in function split_text, around line 127) :
--
function split_text($offset) {
if ( $offset == 0 )
return;
$split = $this->_frame->get_node()->splitText($offset);
$deco = $this->copy($split);
--
by this:
--
function split_text($offset) {
if ( $offset == 0 )
return;
$text = $this->_frame->get_node()->nodeValue;
$split = $this->_frame->get_node()->splitText($offset);
$this->_frame->get_node()->nodeValue = mb_substr($text,0,$offset);
$split->nodeValue = mb_substr($text,$offset);
$deco = $this->copy($split);
--
Works for me, with all the weird characters I'm using.
Cheers,
Tommy.
|
|
RE: Problem line break in context Works for me, thanks :) |