2929 * @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
3030 * @link https://github.com/tecnickcom/tc-lib-pdf-font
3131 *
32+ * @phpstan-type TFileOptions array{
33+ * allowedHosts?: array<string>,
34+ * maxRemoteSize?: int,
35+ * curlopts?: array<int, bool|int|string>,
36+ * defaultCurlOpts?: array<int, bool|int|string>,
37+ * fixedCurlOpts?: array<int, bool|int|string>
38+ * }
39+ *
3240 * @phpstan-import-type TFontData from Load
3341 */
3442abstract class Buffer
@@ -70,6 +78,13 @@ abstract class Buffer
7078 */
7179 protected array $ file = [];
7280
81+ /**
82+ * Optional configuration forwarded to the file helper.
83+ *
84+ * @var TFileOptions|null
85+ */
86+ protected ?array $ fileOptions = null ;
87+
7388 /**
7489 * Initialize fonts buffer
7590 *
@@ -91,13 +106,16 @@ abstract class Buffer
91106 * intensive.
92107 * @param bool $unicode True if we are in Unicode mode, False otherwise.
93108 * @param bool $pdfa True if we are in PDF/A mode, False otherwise.
109+ * @param TFileOptions|null $fileOptions Optional configuration for the font file helper.
94110 */
95111 public function __construct (
96112 protected float $ kunit ,
97113 protected bool $ subset = false ,
98114 protected bool $ unicode = true ,
99- protected bool $ pdfa = false
115+ protected bool $ pdfa = false ,
116+ ?array $ fileOptions = null
100117 ) {
118+ $ this ->fileOptions = $ fileOptions ;
101119 }
102120
103121 /**
@@ -225,7 +243,7 @@ public function add(
225243 $ subset = $ this ->subset ;
226244 }
227245
228- $ fobj = new Font ($ font , $ style , $ ifile , $ subset , $ this ->unicode , $ this ->pdfa );
246+ $ fobj = new Font ($ font , $ style , $ ifile , $ subset , $ this ->unicode , $ this ->pdfa , true , $ this -> fileOptions );
229247 $ key = $ fobj ->getFontkey ();
230248
231249 if (isset ($ this ->font [$ key ])) {
0 commit comments