Horde_Pdf_Writer::setFontSize PHP Method

setFontSize() public method

Defines the size of the current font.
See also: setFont()
public setFontSize ( float $size )
$size float The size (in points).
    public function setFontSize($size)
    {
        /* If the font size is already the current font size, just return. */
        if ($this->_font_size_pt == $size) {
            return;
        }
        /* Set the current font size, both in points and scaled to user
         * units. */
        $this->_font_size_pt = $size;
        $this->_font_size = $size / $this->_scale;
        /* Output font information if at least one page has been defined. */
        if ($this->_page > 0) {
            $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->_current_font['i'], $this->_font_size_pt));
        }
    }

Usage Example

コード例 #1
0
ファイル: WriterTest.php プロジェクト: jubinpatel/horde
 public function testHelloWorldCompressed()
 {
     $pdf = new Horde_Pdf_Writer(array('orientation' => 'P', 'format' => 'A4'));
     $pdf->setInfo('CreationDate', $this->fixtureCreationDate());
     $pdf->open();
     $pdf->setCompression(false);
     $pdf->addPage();
     $pdf->setFont('Courier', '', 8);
     $pdf->text(100, 100, 'First page');
     $pdf->setFontSize(20);
     $pdf->text(100, 200, 'HELLO WORLD!');
     $pdf->addPage();
     $pdf->setFont('Arial', 'BI', 12);
     $pdf->text(100, 100, 'Second page');
     $actual = $pdf->getOutput();
     $expected = $this->fixture('hello_world_compressed');
     $this->assertEquals($expected, $actual);
 }