/**
  * Common behaviour for rendering specified content on the pdf.
  *
  * @param pdf $pdf the pdf object
  * @param string $content the content to render
  */
 public function render_content($pdf, $content)
 {
     list($font, $attr) = $this->get_font();
     $pdf->setFont($font, $attr, $this->element->size);
     $fontcolour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $fontcolour);
     $pdf->SetTextColor($fontcolour['R'], $fontcolour['G'], $fontcolour['B']);
     $x = $this->element->posx;
     $y = $this->element->posy;
     $w = $this->element->width;
     $align = $this->element->align;
     $refpoint = $this->element->refpoint;
     $actualwidth = $pdf->GetStringWidth($content);
     if ($w and $w < $actualwidth) {
         $actualwidth = $w;
     }
     switch ($refpoint) {
         case CUSTOMCERT_REF_POINT_TOPRIGHT:
             $x = $this->element->posx - $actualwidth;
             if ($x < 0) {
                 $x = 0;
                 $w = $this->element->posx;
             } else {
                 $w = $actualwidth;
             }
             break;
         case CUSTOMCERT_REF_POINT_TOPCENTER:
             $x = $this->element->posx - $actualwidth / 2;
             if ($x < 0) {
                 $x = 0;
                 $w = $this->element->posx * 2;
             } else {
                 $w = $actualwidth;
             }
             break;
     }
     if ($w) {
         $w += 0.0001;
     }
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->writeHTMLCell($w, 0, $x, $y, $content, 0, 0, false, true, $align);
 }