I am getting this error message: PDFlibException: Option 'FontOutline' has odd number of values...
indeed, the option you apply is wrong.
You might find this well explained in the PDFlib 10.0.2 Tutorial, chapter 6.3.4:
![how to use FontOutline resource to find the font](https://cdn.statically.io/img/i.sstatic.net/OlxBLih1.png)
For a detailed introduction into the powerful PDFlib option list, please check out PDFlib 10.0.2 API reference, 1.1 "Option Lists".
So I expect when you use
$p->set_option("FontOutline={Times=".$fontdir."/times.ttf"});
$times_font = $p->load_font("Times", "unicode","");
$p->setfont( $times_font,$fontsize);
Or you specify $fontdir
as SearchPath and then simple use:
$p->set_option("SearchPath={{".$fontdir."} {/further/directory}");
$p->set_option("FontOutline={Times=times.ttf"});
$times_font = $p->load_font("Times", "unicode","");
$p->setfont( $times_font,$fontsize);
Please honor also, that you can specify the font (fontname or fonthandle and fontsize) also in the option list for fit_textline() of add/create_textflow().
This make it often much more easier, as always set the font with setfont()
About font embedding:
You can control the font embedding with the load_font() option embedding
. Since PDFlib 10 this the default is true
. When you use an outdated PDFlib version, you have to set embedding=true
as well when loading the font.