Bug 57

Summary: Fontconfig should support kerning info for Type 1 fonts
Product: fontconfig Reporter: Tony Graham <tony.graham>
Component: libraryAssignee: Keith Packard <keithp>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: high CC: benjsc
Version: 2.1Keywords: NEEDINFO
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Tony Graham 2003-04-14 07:57:03 UTC
Kerning information for Type 1 fonts is contained in a separate file from the
outline information.

FreeType2 supports associating an AFM file with a Type 1 font using
FT_Attach_File(), but fontconfig currently doesn't provide the name of the AFM
file associated with a Type 1 font, so systems using FreeType2 and fontconfig
can't kern Type 1 fonts (unless the program using Fontconfig hunts for the AFM
file itself).

Fontconfig should find AFM files associated with Type 1 fonts and make the AFM
file name available to the application in the same way as the PostScript file
name is made available to the application.
Comment 1 Keith Packard 2003-04-14 09:17:51 UTC
Hmm.  If the .afm files are located in the same directory as the .pfb files,
things are easy.  But if they're in different directories, then the current
scheme of saving font information in each directory breaks down.  And, if
they're in the same directory, then it's likely you'll find them by replacing
the .pfa/.pfb extension with .afm.

Suggestions on how else to do this would be welcome; I've been thinking about it
a bit already.
Comment 2 Tony Graham 2003-04-15 01:32:01 UTC
.afm files tend to be in the same directory or in a child directory.

I don't expect fontconfig to search the system and match up .pfb and .afm files
in random locations.

For the PDFlib backend of PangoPDF, I do locate .afm files by replacing
.pfa/.pfb with .afm and testing for the existence of the .afm file.  Of course,
only the general idea is useful for fontconfig:

static void
maybe_set_afm (PDF *pdf_doc,
	       const gchar *fontname,
	       const gchar *non_afm_filename)
{
  GString *filename = g_string_new (non_afm_filename);
  int len = strlen (non_afm_filename);

  g_string_truncate (filename,
		     len-3);
  g_string_append (filename,
		   "afm");
  if (g_file_test (filename->str, G_FILE_TEST_EXISTS))
    {
      GString *parameter = g_string_new (NULL);

      g_string_printf (parameter,
		       "%s==%s",
		       fontname,
		       filename->str);

      PDF_set_parameter (pdf_doc,
			 "FontAFM",
			 parameter->str);

      g_string_free (parameter, TRUE);
    }
  g_string_free (filename, TRUE);
}
Comment 3 Daniel Stone 2007-03-26 06:35:59 UTC
reopening all RESOLVED/{LATER,REMIND} bugs.  now is later, and this is a reminder. ;)
Comment 4 Daniel Stone 2007-03-26 06:54:05 UTC
reopening all RESOLVED/{LATER,REMIND} bugs.  now is later, and this is a reminder. ;)
Comment 5 Benjamin Close 2008-01-11 07:14:30 UTC
Hi Keith, chasing old bugs, is this still an issue?
Comment 6 Keith Packard 2008-05-03 16:20:37 UTC
I'm going to punt this from fontconfig; applications are welcome to go looking for .afm files based on the font filename.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.