# HaruDoc::getFont

(PECL haru:0.0.1)

HaruDoc::getFont — Get HaruFont instance

### Description

object HaruDoc::getFont ( string `$fontname` [, string `$encoding` ] )

Creates and returns HaruFont instance with the specified `fontname` and `encoding` .

### Parameters

`fontname`

  The name of the font. See Builtin Fonts for the list of builtin fonts. You can also use the name of a font loaded via HaruDoc::loadTTF(), HaruDoc::loadTTC() and HaruDoc::loadType1().

`encoding`

  The encoding to use. See Builtin Encodings for the list of supported encodings.

### Errors/Exceptions

Throws HaruException on error.

### See Also

- HaruPage::setFontAndSize()
- HaruPage::getCurrentFont()