• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2579
  • 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...
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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