Forum


Replies: 1   Views: 1161
All memory exhausted when trying to embed specific truetype font
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 03-12-2020 - 10:15

Hello,

We have run the following code using your TTF font:

$docx->embedFont('simkai.ttf', 'simkai');

in our test servers (Linux, Windows and macOS) and it's being added correctly.

Please note that to embed fonts, TTF files need to be transformed to ODTTF format using HEX operations, so as your TTF is 12MB if your server returns a memory exhausted error you may need to increase it in the PHP config: https://haydenjames.io/understanding-php-memory_limit/.

We also recommend you to run the included samples (examples/LayoutAndGeneral/embedFont folder).

Regards.