Hi,
Having a look at the source code, I see some details which may be improved, in case of Bookmark and addTOC:
Line 21310 avoid testing if ($outline['l'] == 0) and set always Bold for the first level. As using Bookmark() we can set the style, so it's better to let people choose if they want or not the first level in Bold (I've delete the ".'B'" in my version, and thats' better.
On Bookmark call, add two parameters: fontname, fontsize. So line 12331 when filling the outline associative array, just add a "fn" and a "fs" index to save the font name and font size in the array.
After that, in addTOC just use the fontname and the fontsize, rather than performing the $fontsize - $outline['l'] which is in line 21313.
This will let people choose font, size and style for every bookmark with only a few change in the code.
Best regards and congrat for your work
Pierre-Louis
Here's the result, based on the last version of TCPDF available:
Take the tcpdf.php file
Line 12292 change the Bookmark call, adding two parameters: fontname and fontsize
Line 12331, add the two new parameters in the outline array:
Now, we'll change the addTOC function (which use outline array), located at line 21267. This function get the defaut font name and size at the beginning ($fontsize = $this->FontSizePt;$fontfamily = $this->FontFamily;). If our outline array don't have name or font size, we'll use these defaut values in order to maintain compatibiity.
So Line 21313, replace this bloc:
By this one:
A few lines after, you will find the font setting for the number and also the style.
That's all. Now you can build your Bookmarks with the fontname and size you want, doing call as:
Would be nice if Nicola put this into next version. :)
Thanks a lot
Last edit: pl-lamballais 2015-12-28