AFMPATH environmental variable

I can confirm that if the font files are installed in the default

> location under the system python tree, it works. Setting AFMPATH also
> works in linux.

OK, so the font files exist and are readable. In order to figure out
where the problem is, I'll need you to add a couple of lines to
matplotlib/backends/backend_ps.py and tell me what the output is. In
the function _get_afm_filenames on line 413, add these print lines
before the return statement and let me know what they report

    print paths
    print fnames
    return fnames

John Hunter

John Hunter wrote:

> I can confirm that if the font files are installed in the default
> location under the system python tree, it works. Setting AFMPATH also
> works in linux.

OK, so the font files exist and are readable. In order to figure out
where the problem is, I'll need you to add a couple of lines to
matplotlib/backends/backend_ps.py and tell me what the output is. In
the function _get_afm_filenames on line 413, add these print lines
before the return statement and let me know what they report

    print paths
    print fnames
    return fnames

John Hunter

H:\00work\00cvs\matplotlib\matplotlib\examples>python subplot_demo.py -dPS
['E:\\Py23\\share\\matplotlib', 'E', '\\Py23e\\share\\matplotlib']

Error: Could not find any AFM files; please set AFMPATH to point to some readable adobe font metric files

Regards,
ST

···

--

LUK ShunTim wrote:

John Hunter wrote:

> I can confirm that if the font files are installed in the default
> location under the system python tree, it works. Setting AFMPATH also
> works in linux.

OK, so the font files exist and are readable. In order to figure out
where the problem is, I'll need you to add a couple of lines to
matplotlib/backends/backend_ps.py and tell me what the output is. In
the function _get_afm_filenames on line 413, add these print lines
before the return statement and let me know what they report

    print paths
    print fnames
    return fnames

John Hunter

H:\00work\00cvs\matplotlib\matplotlib\examples>python subplot_demo.py -dPS
['E:\\Py23\\share\\matplotlib', 'E', '\\Py23e\\share\\matplotlib']

Error: Could not find any AFM files; please set AFMPATH to point to some readable adobe font metric files

Regards,
ST
--

It appears that the following replacement of _get_afm_filenames
works. I'm a python learner so that may lead to other bugs. :slight_smile:

<quote>
     def _get_afm_filenames(self):
         paths = [os.path.join(distutils.sysconfig.PREFIX, 'share', 'matplotlib')]
         if os.environ.has_key('AFMPATH'):
             afmpath = os.environ['AFMPATH']
             ### if afmpath.find(';')>0: #win32 style
             ### paths.extend(afmpath.split(';'))
             ### elif afmpath.find(':')>0: # unix style
             ### paths.extend(afmpath.split(':'))
             ### else:
         paths.append(afmpath)
  fnames =
         fnames = [fname for fname in get_recursive_filelist(paths)
                   if fname.lower().find('.afm')>0 and
                      os.path.exists(fname)]
  ### start debug
  #print paths
      #print fnames
  ###raw_input("Hit enter to continue -->")
  ### end debug
         return fnames
</quote>

I'm going to sleep now. :slight_smile:

Good day,
ST

···

--