I am using the following code to display a headline and a date next to each other using FPDF:
$this->SetFont('Helvetica', 'B', 30);
$this->Cell(120, 20, 'Rechnung 20130809-78');
$this->SetFont('Helvetica', '', 10);
$this->Cell(0, 20, '09. 08. 2013');
But the texts are not aligned properly:
How can I get it to work so that the baselines are on the same height?
I do not want a solution where I have to adjust the position of one of the elements manually. It has to work with every font-size I enter.
I already have tried to adjust the y-position automatically in my Cell-method, but the text is then not aligned at the baselines but at the bottom (where the g ends)!
public function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') {
$text = utf8_decode($txt);
$startX = $this->GetX();
$startY = $this->GetY();
$this->SetY($startY - $this->FontSize / 2);
$this->SetX($startX);
parent::Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
$endX = $this->GetX();
$endY = $this->GetY();
$this->SetY($startY);
$this->SetX($endX);
}
Is there any way to do what I intend to do? Please help me! The green lines in the image above should be at the same height.