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
On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote:> 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.That seems fine, however note that this won''t let you search for fonts by postscript name. If you want to do that, you can modify the font matching code to look for postscript names in the pattern. -- keith.packard at intel.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080603/2732cc1c/attachment.pgp
On Tue, Jun 3, 2008 at 3:28 PM, Keith Packard <keithp at keithp.com> wrote:> On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote: > >> 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. > > That seems fine, however note that this won''t let you search for fonts > by postscript name. If you want to do that, you can modify the font > matching code to look for postscript names in the pattern. >Yes, I would want it to be searchable. I''ll send a new patch as soon as I have it ready. Thanks, - Isaiah Beerbower -- www.ipaqah.com
On 6/3/08, Isaiah Beerbower <public at ipaqah.com> wrote:> On Tue, Jun 3, 2008 at 3:28 PM, Keith Packard <keithp at keithp.com> wrote: >> On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote: >> >>> 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. >> >> That seems fine, however note that this won''t let you search for fonts >> by postscript name. If you want to do that, you can modify the font >> matching code to look for postscript names in the pattern. >> > > Yes, I would want it to be searchable. I''ll send a new patch as soon > as I have it ready. >And here it is (attached). Thanks, - Isaiah Beerbower -- www.ipaqah.com -------------- next part -------------- A non-text attachment was scrubbed... Name: postscript_name.diff Type: application/octet-stream Size: 8395 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080604/129df421/attachment.obj
On Wednesday 04 June 2008 15:05:55 Isaiah Beerbower wrote:> On 6/3/08, Isaiah Beerbower <public at ipaqah.com> wrote: > > On Tue, Jun 3, 2008 at 3:28 PM, Keith Packard <keithp at keithp.com> wrote: > >> On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote: > >>> 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. > >> > >> That seems fine, however note that this won''t let you search for fonts > >> by postscript name. If you want to do that, you can modify the font > >> matching code to look for postscript names in the pattern. > > > > Yes, I would want it to be searchable. I''ll send a new patch as soon > > as I have it ready. > > And here it is (attached).It does not work for me unless FC_POSTSCRIPT_NAME_OBJECT is added to the end of the list. Not sure why, fc-match prints nothing and FC_DEBUG=2 shows a garbled font pattern. Maybe some other list has to be updated as well? Anyway, the attached patch seems to work fine. -------------- next part -------------- A non-text attachment was scrubbed... Name: postscript_name2.diff Type: text/x-diff Size: 6504 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080605/c063ded6/attachment.diff
On Thu, Jun 5, 2008 at 2:34 PM, Evgeniy Stepanov <eugeni.stepanov at gmail.com> wrote:> On Wednesday 04 June 2008 15:05:55 Isaiah Beerbower wrote: >> On 6/3/08, Isaiah Beerbower <public at ipaqah.com> wrote: >> > On Tue, Jun 3, 2008 at 3:28 PM, Keith Packard <keithp at keithp.com> wrote: >> >> On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote: >> >>> 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. >> >> >> >> That seems fine, however note that this won''t let you search for fonts >> >> by postscript name. If you want to do that, you can modify the font >> >> matching code to look for postscript names in the pattern. >> > >> > Yes, I would want it to be searchable. I''ll send a new patch as soon >> > as I have it ready. >> >> And here it is (attached). > > It does not work for me unless FC_POSTSCRIPT_NAME_OBJECT is added to the end > of the list. Not sure why, fc-match prints nothing and FC_DEBUG=2 shows a > garbled font pattern. Maybe some other list has to be updated as well? > Anyway, the attached patch seems to work fine. >Is it possible that the change breaks compatibility with existing caches? It works fine on my machine. If this is the problem, I''m fine with the Postscript name being moved to the end of the list. I''ll take a look, though, and make sure I didn''t mis something. Thanks, - Isaiah Beerbower -- www.ipaqah.com
On Sunday 08 June 2008 16:03:39 Isaiah Beerbower wrote:> On Thu, Jun 5, 2008 at 2:34 PM, Evgeniy Stepanov > > <eugeni.stepanov at gmail.com> wrote: > > On Wednesday 04 June 2008 15:05:55 Isaiah Beerbower wrote: > >> On 6/3/08, Isaiah Beerbower <public at ipaqah.com> wrote: > >> > On Tue, Jun 3, 2008 at 3:28 PM, Keith Packard <keithp at keithp.com>wrote:> >> >> On Tue, 2008-06-03 at 12:18 -0400, Isaiah Beerbower wrote: > >> >>> 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. > >> >> > >> >> That seems fine, however note that this won''t let you search for > >> >> fonts by postscript name. If you want to do that, you can modify the > >> >> font matching code to look for postscript names in the pattern. > >> > > >> > Yes, I would want it to be searchable. I''ll send a new patch as soon > >> > as I have it ready. > >> > >> And here it is (attached). > > > > It does not work for me unless FC_POSTSCRIPT_NAME_OBJECT is added to the > > end of the list. Not sure why, fc-match prints nothing and FC_DEBUG=2 > > shows a garbled font pattern. Maybe some other list has to be updated as > > well? Anyway, the attached patch seems to work fine. > > Is it possible that the change breaks compatibility with existing > caches? It works fine on my machine.Yes, it was because of cache incompatibility. Why does the global cache path in fonts.conf come before the one in user home directory? This way fc-cache from user account does absolutely nothing, cache files from .fontconfig are not even opened if there is a file with the same name in system directory.> If this is the problem, I''m fine with the Postscript name being moved > to the end of the list. I''ll take a look, though, and make sure I > didn''t mis something.Sure, even if both patches are correct, it is better to keep cache file compatibility.
On Sun, 2008-06-08 at 22:24 +0400, Evgeniy Stepanov wrote:> Yes, it was because of cache incompatibility.There''s a version number in the cache file -- you can bump that and it should re-create/skip cache files with the wrong number.> Why does the global cache path in fonts.conf come before the one in user home > directory? This way fc-cache from user account does absolutely nothing, cache > files from .fontconfig are not even opened if there is a file with the same > name in system directory.They''re supposed to have precisely the same content, and it''s always better to share across multiple users as these files are mmapped, so sharing the file means sharing physical pages.> Sure, even if both patches are correct, it is better to keep cache file > compatibility.Any addition to the list of standard names must be accompanied by a cache version bump. -- keith.packard at intel.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080608/43c107a6/attachment.pgp
On Sun, Jun 8, 2008 at 11:04 PM, Keith Packard <keithp at keithp.com> wrote:> On Sun, 2008-06-08 at 22:24 +0400, Evgeniy Stepanov wrote: > >> Yes, it was because of cache incompatibility. > > There''s a version number in the cache file -- you can bump that and it > should re-create/skip cache files with the wrong number. > >> Why does the global cache path in fonts.conf come before the one in user home >> directory? This way fc-cache from user account does absolutely nothing, cache >> files from .fontconfig are not even opened if there is a file with the same >> name in system directory. > > They''re supposed to have precisely the same content, and it''s always > better to share across multiple users as these files are mmapped, so > sharing the file means sharing physical pages. > >> Sure, even if both patches are correct, it is better to keep cache file >> compatibility. > > Any addition to the list of standard names must be accompanied by a > cache version bump. >Would this be FC_CACHE_CONTENT_VERSION in fcint.h? -- www.ipaqah.com