PhpSigep\Pdf\ImprovedFPDF::GetStringWidthXd PHP Méthode

GetStringWidthXd() public méthode

public GetStringWidthXd ( $s )
    public function GetStringWidthXd($s)
    {
        return $this->GetStringWidth($this->_($s));
    }

Usage Example

 private function labeledText(ImprovedFPDF $pdf, $label, $text, $maxW, $ln = 0, $multLines = false)
 {
     $pdf->saveState();
     $pdf->SetFont('', '');
     $wLabel = $pdf->GetStringWidthXd($label . '  ');
     $pdf->SetFont('', 'B');
     $xLabel = $pdf->x;
     $pdf->CellXp($wLabel, $label);
     $pdf->SetFont('', '');
     $maxTextW = $maxW - $wLabel;
     if ($multLines) {
         if (is_float($multLines) || is_int($multLines)) {
             $pdf->setLineHeightPadding($multLines);
         }
         $x = $pdf->x - $wLabel;
         $pdf->MultiCellXp($maxTextW, $text);
         if ($ln === 0) {
             $pdf->SetX($x + $maxTextW);
         } else {
             if ($ln == 1) {
                 $pdf->SetX($pdf->lMargin);
             } else {
                 if ($ln == 2) {
                     $pdf->SetX($x);
                 }
             }
         }
     } else {
         while ($text && $maxTextW < $pdf->GetStringWidth($text)) {
             $text = substr($text, 0, strlen($text) - 1);
         }
         $pdf->CellXp($maxTextW, $text, '', $ln);
         if ($ln == 2) {
             $pdf->x -= $wLabel;
         }
     }
     $lastX = $pdf->x;
     $lastY = $pdf->y;
     $pdf->restoreLastState();
     if ($ln === 0) {
         $pdf->SetX($xLabel + $maxW);
     } else {
         if ($ln === 1) {
             $pdf->SetXY($lastX, $lastY);
         } else {
             if ($ln === 2) {
                 $pdf->SetXY($lastX, $lastY);
             }
         }
     }
 }