Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2469
  • Last Modified:

How do I fix: Error: Font 'Arial Bold' with encoding 'winansi': Font file (AFM, PFM, TTF, OTF etc.) or host font not found

I keep getting this error when I load my program into linux (Ubuntu 8):
Error: Font 'Arial Bold' with encoding 'winansi': Font file (AFM, PFM, TTF, OTF etc.) or host font not found

I need to know:
1. What the path is that pdflib is looking in for these files.
2. Where I can get these files.
3. Anything else that resolves this issue.

  • 4
  • 2
2 Solutions
You'll need to specify the full path to the font file(s). The font file also needs to be in a folder accessible to PHP (open_basedir setting comes to mind.) So you may need to copy the font file to a sub-folder of your PHP application/site, verify access permissions and so on...

You should be able to download some of those fonts from the Internet, or install some font-related packages.
rae_raeAuthor Commented:
I pretty much knew all that already. I need to know:
What the path is (how to establish this) and where I can get the files (from what site). I can then install them, of course.
Check: /etc/fonts/fonts.conf
/home/<username>/.fonts (where <username> is your user name).

In Synaptic search for "font" or "ttf" or "true type", etc...
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

rae_raeAuthor Commented:
Thanks. I'll look into this when I get back into work.
rae_raeAuthor Commented:
When viming /etc/fonts/fonts.conf I get this:

Uder the Font directory list directive section.
Why does linux have so many font directories!? lol wth?

The fonts are all found under /usr/share/fonts/truetype/msttcorefonts/

My error: "'Arial Bold' with encoding 'winansi': Font file (AFM, PFM, TTF, OTF etc.) or host font not found" doesn't get fixed if I change my directive
from $bold_font = $pdf->load_font('Arial Bold', 'winansi', '');
to $bold_font = $pdf->load_font('Arial_Bold', 'winansi', '');

Neither does it correct if I change it
from $bold_font = $pdf->load_font('Arial Bold', 'winansi', '');
to $bold_font = $pdf->load_font('Arial', 'winansi', '');

This still is happening...and I still do not know why.
rae_raeAuthor Commented:
I figured it out. The fonts needed to be copied to the SearchPath directive location in the pdf set_parameter function.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now