[Fontconfig] Caching Postscript names

Isaiah Beerbower public at ipaqah.com
Tue Jun 3 09:18:43 PDT 2008


Greetings,

First, I must apologize if this is a double post. When I first sent
this email I had not yet subscribed to the list, and I don't think it
arrived.

I am working on GNUstep's (http://www.gnustep.org/) font support. One
of GNUstep's goals is to implement the OpenStep specification
(http://www.gnustep.org/resources/OpenStepSpec.pdf.gz). Fontconfig is
already being used by GNUstep, however, in order to properly implement
the OpenStep standard  the Postscript name should be used to uniquely
reference a font. Right now GNUstep is using the full font name,
however, it would be better if the Postscript name was cached so that
it could be used instead. So my final question is: what are the pros
and cons to adding the Postscript name to the properties which
Fontconfig caches?

I've included a patch (below) which adds the functionality.

Thanks,
- Isaiah Beerbower



diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 425fc2d..10d5762 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -81,6 +81,7 @@ typedef int           FcBool;
 #define FC_PIXEL_SIZE      "pixelsize"         /* Double */
 #define FC_SPACING         "spacing"           /* Int */
 #define FC_FOUNDRY         "foundry"           /* String */
+#define FC_POSTSCRIPT_NAME         "postscriptname"            /* String */
 #define FC_ANTIALIAS       "antialias"         /* Bool (depends) */
 #define FC_HINTING         "hinting"           /* Bool (true) */
 #define FC_HINT_STYLE      "hintstyle"         /* Int */
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index a79308c..c041249 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -1121,6 +1121,7 @@ FcFreeTypeQueryFace (const FT_Face  face,
 #endif
    FcChar8        *complex;
    const FcChar8   *foundry = 0;
+    const FcChar8   *psname = 0;
    int                    spacing;
    TT_OS2         *os2;
 #if HAVE_FT_GET_PS_FONT_INFO
@@ -1370,6 +1371,13 @@ FcFreeTypeQueryFace (const FT_Face  face,
       ++nfamily;
    }

+       psname = (const FcChar8 *) FT_Get_Postscript_Name(face);
+       if (psname)
+       {
+    if (!FcPatternAddString (pat, FC_POSTSCRIPT_NAME, psname))
+       goto bail1;
+       }
+
    if (!FcPatternAddString (pat, FC_FILE, file))
       goto bail1;



--
www.ipaqah.com


More information about the Fontconfig mailing list