[tex-k] dvips: specified font path is ignored

Igor Liferenko igor.liferenko at gmail.com
Thu Apr 15 09:07:34 CEST 2021


Hi,

------------ Problem ---------------

The attached test.dvi has font, which is specified
via relative path:

    ./myfont

Save the attached myfont.tfm to current
directory and run:

    PKFONTS=/none TFMFONTS=/none dvips test

The output is:

    Can't open font metric file ./myfont.tfm

----------------- Cause of the problem ---------------

First, the following code is called:

   if (!pkopen(curfnt)) {
      tfmload(curfnt);
      return;
   }

As there is no pk-file, tfmload() is called.
tfmload() calls tfmopen(). In tfmopen() this
code is called:

    if ((tfmfile=search(d, name, READBIN))!=NULL)

Inside search(), kpse_find_file() returns NULL:

    found_name = kpse_find_file (file, format,
       format != vfpath && format != ofmpath);

where file = myfont.tfm and format = kpse_tfm_format

You see: there is no './' before 'myfont.tfm'

---------------- Solution ------------------

The idea is simple: just pass font area to the
Kpathsea library, and it will do all the magic.
After applying the attached patch, myfont.tfm is found,
as it should.

Regards,
Igor

P.S.

pkopen() works analogously:

In pkopen(), pksearch() is called. But before
calling it, font area is appended to font name:

     char *this_name = concat (d, n);
     pkfile = pksearch(this_name, READBIN, fd->dpi, &name_ret, &dpi_ret);
-------------- next part --------------
diff --git a/tfmload.c b/tfmload.c
index cd507d0..a988df4 100644
--- a/tfmload.c
+++ b/tfmload.c
@@ -56,7 +56,11 @@ tfmopen(register fontdesctype *fd)
 #else
       sprintf(name, "%s.ofm", n);
 #endif
-      if ((tfmfile=search(d, name, READBIN))!=NULL)
+     char *this_name = concat (fd->area, name);
+
+      tfmfile=search(d, this_name, READBIN);
+      free(this_name);
+      if (tfmfile != NULL)
          return;
    }
 #ifdef KPATHSEA
@@ -71,7 +75,10 @@ tfmopen(register fontdesctype *fd)
 #else
    sprintf(name, "%s.tfm", n);
 #endif
-   if ((tfmfile=search(d, name, READBIN))!=NULL)
+     char *this_name = concat (fd->area, name);
+     tfmfile=search(d, this_name, READBIN);
+     free(this_name);
+     if (tfmfile!=NULL)
       return;
    sprintf(errbuf, "Can't open font metric file %.500s%.500s",
           fd->area, name);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.dvi
Type: application/x-dvi
Size: 208 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-k/attachments/20210415/5587c721/attachment.dvi>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myfont.tfm
Type: application/octet-stream
Size: 64 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-k/attachments/20210415/5587c721/attachment.obj>


More information about the tex-k mailing list.