Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import custom fonts #37

Open
badB00l opened this issue May 21, 2013 · 4 comments
Open

Unable to import custom fonts #37

badB00l opened this issue May 21, 2013 · 4 comments

Comments

@badB00l
Copy link

badB00l commented May 21, 2013

I was trying to import a custom font (Calibri) in this directory
app/Resources/PHPPdf/Resources/fonts/Calibri

so I create a custom fonts.xml in
app/Resources/PHPPdf/Resources/config/

and change my config.yml inserting these two optional lines, as explained in the guide

ps_pdf:
fonts_file: "%kernel.root_dir%/Resources/PHPPdf/Resources/config/fonts.xml"

but it isn't seen at all because when it load my just modified detail.pdf.twig an error occur

Font "/Applications/XAMPP/xamppfiles/htdocs/myProject/vendor/psliwa/php-pdf/lib/PHPPdf/Resources/fonts/Calibri/bold.ttf" not found.

It's still trying to find the font in the old directory. How can I solve this?

@psliwa
Copy link
Owner

psliwa commented May 22, 2013

What symfony2 version do you use?

@badB00l
Copy link
Author

badB00l commented May 22, 2013

i'm using 2.2.1. Thanks for your help

@psliwa
Copy link
Owner

psliwa commented May 23, 2013

%resources% pattern is replaced by path to Resources directory in PHPPdf library, so it works ok. In fonts.xml file you should user relative path, for example: "%resources%/../../../../../../app/Resources/PHPPdf/Resources/fonts/somefont.ttf". This solution is not elegant, but it should work.

@nixoschu
Copy link

nixoschu commented Jul 1, 2015

I know this is an issue from 2 years ago ...sry

I got the same problem and it was not a problem if the specified path.

The problem in my case seems to be that the Zend-Framework component loading/opening the fonts does not support all fonts

CorruptedFontException: Unable to read version 4 table -
in vendor/zendframework/zendpdf/library/ZendPdf/BinaryParser/Font/OpenType/AbstractOpenType.php at line 534 -

so i guess it's a limitation due to the class used which fonts can be included as "custom" font right ?

EDIT:
it seems be a problem with my ttf font, i tried antother one and that one worked
it was just irritating that the error was the same "could not load ... font"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants