コード例 #1
0
ファイル: ReportPdfText.php プロジェクト: tronsmit/webtrees
 /**
  * PDF Text renderer
  *
  * @param ReportTcpdf $renderer
  */
 public function render($renderer)
 {
     // Set up the style
     if ($renderer->getCurrentStyle() != $this->styleName) {
         $renderer->setCurrentStyle($this->styleName);
     }
     $temptext = str_replace("#PAGENUM#", $renderer->PageNo(), $this->text);
     // underline «title» part of Source item
     $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
     // Paint the text color or they might use inherited colors by the previous function
     $match = array();
     if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) {
         $r = hexdec($match[1]);
         $g = hexdec($match[2]);
         $b = hexdec($match[3]);
         $renderer->SetTextColor($r, $g, $b);
     } else {
         $renderer->SetTextColor(0, 0, 0);
     }
     $temptext = FunctionsRtl::spanLtrRtl($temptext, "BOTH");
     $temptext = str_replace(array('<br><span dir="rtl" >', '<br><span dir="ltr" >', '> ', ' <'), array('<span dir="rtl" ><br>', '<span dir="ltr" ><br>', '>&nbsp;', '&nbsp;<'), $temptext);
     $renderer->writeHTML($temptext, false, false, true, false, "");
     //change height - line break etc. - the form is mirror on rtl pages
     // Reset the text color to black or it will be inherited
     $renderer->SetTextColor(0, 0, 0);
 }