Add new font in dompdf

1,950 views
Skip to first unread message

syn a

unread,
Dec 16, 2013, 7:21:20 AM12/16/13
to dom...@googlegroups.com
Hi all,

I would like to share with you that I am using dompdf in wordpress.I want to add some new fonts on dompdf like riky,angelina,comic,impact etc.. I tried to add the font using the below command but no luck. I have the .ttf file of all of the mentioned font but when I tried to run the below command, system ask me to enter all 4 files files (normal,bold,italic and bolditalic) for each and every font.

load_font.php font-family n_file [b_file] [i_file] [bi_file]


I do not have all 4 files for each and evry font therefore what I do, I have renamed the same file by the name of bold,italic,bolditallic then run  the commnad.This time the command executed but in that case dompdf not reading that font.

I would apprecite if anyone can tell me how can I add the above mentioned font on dompdf and also please mention what I need to do if I do not have all 4 types of .ttf files (normal,bold,italic and bolditalic) for a font.

Please help me, it very urgent for me.

BrianS

unread,
Dec 17, 2013, 10:12:16 AM12/17/13
to dom...@googlegroups.com
Which version of dompdf are you using? You should be able to specify just the normal file if you do not have the others, e.g. load_font.php rky riky.ttf. Also, just to confirm, you're running from the command line, correct?

syn a

unread,
Dec 23, 2013, 6:17:20 AM12/23/13
to dom...@googlegroups.com
i am using the 0.5.0 DOMPDF version and  i have tried with normal files  by command line (load_font.php). Please help me as soon as possible.

BrianS

unread,
Dec 23, 2013, 10:39:35 AM12/23/13
to dom...@googlegroups.com
I'm still unsure why you would get the described error. However, with 0.5.x you need to compile ttf2ufm on your system and point to it in your configuration. Have you done this?

You may want to upgrade to 0.6.0 beta 3, there are many significant improvements. One of the biggest around fonts is the ability to encode your document in UTF8 and have it represented correctly in the PDF. In 0.5.1 you could use your own font, but still only display characters represented in the Windows ANSI character set. Also, font subsetting is available, meaning only the necessary portions of the font are included in the PDF resulting in a significantly smaller file size.

syn a

unread,
Dec 24, 2013, 2:28:05 AM12/24/13
to dom...@googlegroups.com
Hi Brian,

Thanks for message.

Further, we do not prefer to update the version as of now because our site is live and it may cause some issue. As you mentioned above is it possible to run this command on "load_font.php rky riky.ttf."  on this version ? if yes, then please let know, the names of the configuration files along with the required changes we have to do on the dompdf directory, when we execute this command. We would really appreciate your suggestion on this.

Look forward to your response.

BrianS

unread,
Dec 26, 2013, 11:23:59 AM12/26/13
to dom...@googlegroups.com
I understand about switching on a live server. We still recommend it, but understand that you're worried about breaking something that works.

With 0.5.x you first have to install or compile a copy of the ttf2afm program. This program creates the font metrics files (.AFM/.UFM) that dompdf uses when laying out text. The 0.5.x release doesn't support Unicode so you only need a version of this program that produces the .AFM metrics. How you obtain a copy of this program really depends on your system.

synapse India

unread,
Jan 30, 2014, 5:50:00 AM1/30/14
to dom...@googlegroups.com

Hi Brian,

The issue is, I do not have the access of shell so I could not install using shell command.

As you may realize this online tool URL - http://eclecticgeek.com/dompdf/load_font.php is useless, whenever I am trying to open it, is is showing "Unable to locate the ttf2afm / ttf2pt1 executable. ".

Please let me know any other solution where I can create font package for the dompdf.

I have also attached the ttf file for the font which I am looking for.

Waiting for your reply.

regards
Synapse
angelina.ttf
Reply all
Reply to author
Forward
0 new messages