Menu

Czech language fix

Profik123
2010-01-10
2012-12-04
  • Profik123

    Profik123 - 2010-01-10

    Because R&OS pdf class can use only win-1252 encoding (the closest to czech win-1250), we have problem with Czech chars ě, č, ř, ď ť, ů, ň. To fix this problem I wrote a little example:

            $diff = array(
                248 => 'rcaron',
                216 => 'Rcaron',
                
                236 => 'ecaron',
                204 => 'Ecaron',
                232 => 'ccaron',
                200 => 'Ccaron',
                239 => 'dcaron',
                207 => 'Dcaron',
                157 => 'tcaron',
                141 => 'Tcaron',
                242 => 'ncaron',
                210 => 'Ncaron',
                249 => 'uring',
                217 => 'Uring'
        );
    $cezpdf->selectFont('fonts/Helvetica-bold.afm',array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
    $text = iconv("UTF-8","Windows-1250","žluťoučký kůň")'; //text needs to be in win-150 encoding
    $cezpdf->addText($x,$y,$size,$text);
    

    And it's done!

    But there's one problem. When I use another font family like bold, chars goes wrong. I think it's because the diff variable is set up only for the basic font (Helvetice.afm), not for other font families. I didn't solve this. Is there anybody who knows how to fix this?

     
  • Profik123

    Profik123 - 2010-01-13

    I found another problem with accented characters. They appear right, but their width is calculated incorrectly, sometimes they're overlapping each other. Is there any way how to fix this behavior?

     

Log in to post a comment.