Hello, Given a name, like "Bitstream Charter 16", is there any way to get the path to the actual font file out of that? I''ve got an editor with a font selection dialog in Gtk, and when printing text to pdf, it uses fop (http://xmlgraphics.apache.org/fop/), and fop again needs the path to the actual font, e.g. /usr/X11R6/lib/x11/fonts/CharisSILR.ttf, to properly display Unicode text. I''ve been trying to find out how to get that path, and looked through the fontconfig documentation, and get the impression that fontconfig, should be able to provide it, but the big question is: How??? Thanks a lot, Teus Benschop. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20051222/95d3d892/attachment.html
On Thu, 2005-12-22 at 17:01 +0200, Teus Benschop wrote:> Hello, > > Given a name, like "Bitstream Charter 16", is there any way to get the > path to the actual font file out of that?That''s the central thing that fontconfig does. Try: $ fc-match -v ''Charter''-16 -keith -------------- 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/20051222/9e3583c2/attachment.pgp
Thank you, Keith, that does the job perfectly. Teus. Keith Packard wrote:> On Thu, 2005-12-22 at 17:01 +0200, Teus Benschop wrote: > >> Hello, >> >> Given a name, like "Bitstream Charter 16", is there any way to get the >> path to the actual font file out of that? >> > > That''s the central thing that fontconfig does. Try: > > $ fc-match -v ''Charter''-16 > > -keith > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freedesktop.org/archives/fontconfig/attachments/20051223/015f804a/attachment.html
Keith Packard <keithp@keithp.com> ????????:> On Thu, 2005-12-22 at 17:01 +0200, Teus Benschop wrote: >> Hello, >> >> Given a name, like "Bitstream Charter 16", is there any way to get the >> path to the actual font file out of that? > > That''s the central thing that fontconfig does. Try: > > $ fc-match -v ''Charter''-16With the latest fontconfig 2.4 branch (CVS checkout from today), this command doesn''t list the full path anymore, only the base name: mfabian@magellan:~$ fc-match -v ''Nimbus Mono L''-16 | grep file file: "n022003l.pfb"(s) mfabian@magellan:~$ fc-list ''Nimbus Mono L'' file /usr/X11R6/lib/X11/fonts/n022024l.pfb: /usr/X11R6/lib/X11/fonts/n022023l.pfb: /usr/X11R6/lib/X11/fonts/n022004l.pfb: /usr/X11R6/lib/X11/fonts/n022003l.pfb: mfabian@magellan:~$ fc-match -V fontconfig version 2.3.93 mfabian@magellan:~$ rpm -q fontconfig fontconfig-2.3.93.20051222-0.1 mfabian@magellan:~$ Older versions of fontconfig listed the full path here: mike@kibou:~$ fc-match -v ''Nimbus Mono L''-16 | grep file file: "/usr/X11R6/lib/X11/fonts/URW/n022003l.pfb"(s) mike@kibou:~$ fc-list ''Nimbus Mono L'' file /usr/X11R6/lib/X11/fonts/URW/n022003l.pfb: /usr/X11R6/lib/X11/fonts/URW/n022004l.pfb: /usr/X11R6/lib/X11/fonts/URW/n022023l.pfb: /usr/X11R6/lib/X11/fonts/URW/n022024l.pfb: mike@kibou:~$ fc-match -V fontconfig version 2.2.99 mike@kibou:~$ rpm -q fontconfig fontconfig-2.2.99.20050218-8.1 mike@kibou:~$ Was that an intentional change or is this a bug? -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
On Fri, 2005-12-23 at 03:26 +0100, Mike FABIAN wrote:> With the latest fontconfig 2.4 branch (CVS checkout from today), > this command doesn''t list the full path anymore, only the base name: > > mfabian@magellan:~$ > > Older versions of fontconfig listed the full path here: >> Was that an intentional change or is this a bug?That would be a bug, but I thought it had been fixed. -keith -------------- 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/20051222/8ff17b96/attachment.pgp
Keith Packard <keithp@keithp.com> ????????:> On Fri, 2005-12-23 at 03:26 +0100, Mike FABIAN wrote: > >> With the latest fontconfig 2.4 branch (CVS checkout from today), >> this command doesn''t list the full path anymore, only the base name: >> >> mfabian@magellan:~$ >> >> Older versions of fontconfig listed the full path here: >> > >> Was that an intentional change or is this a bug? > > That would be a bug, but I thought it had been fixed.Apparently not because I tried with the latest CVS checkout. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
On Fri, 23 Dec 2005, Mike FABIAN wrote:> Was that an intentional change or is this a bug?That would be a bug. I''ll try to take a look at it, but it might take a while. There aren''t duplicate fonts by any chance? pat
Patrick Lam <plam@MIT.EDU> ????????:> On Fri, 23 Dec 2005, Mike FABIAN wrote: > >> Was that an intentional change or is this a bug? > > That would be a bug. I''ll try to take a look at it, but it might take > a while. > > There aren''t duplicate fonts by any chance?No, it seems to happen with any font I try. I certainly have only one copy of CODE2000.TTF for example: mfabian@magellan:~$ fc-match -v ''code2000''-16 | grep file file: "CODE2000.TTF"(s) mfabian@magellan:~$ fc-list code2000 file /usr/X11R6/lib/X11/fonts/truetype/CODE2000.TTF: mfabian@magellan:~$ By the way, what is the reason for the "__DUMMY__" in /* Please do not revoke any of these bindings. */ static const FcObjectType _FcBaseObjectTypes[] = { { "__DUMMY__", FcTypeVoid, }, { FC_FAMILY, FcTypeString, }, ... in fcname.c? I''m trying to find the reason for a crash in fontconfig triggered by rxvt-unicode. I couldn''t yet understand it but I have the suspicion that it is related to the introduction of "__DUMMY__". I found that this "__DUMMY__" is inserted into the pattern by fontconfig when the pattern is expanded: (gdb) p FcNameUnparse(new) $11 = ( FcChar8 *) 0x69a080 "Courier:maxglyphmemory=1048576:\\_\\_DUMMY\\_\\_=1048576:style=Regular:slant=0:weight=80:width=100:pixelsize=13:spacing=100:foundry=ibm:antialias=True:hintstyle=3:hinting=True:verticallayout=False:autohint=False:globaladvance=True:index=0:outline=True:scalable=True:dpi=112.059:rgba=5:scale=1:minspace=True:charset= |>^1!|>^1!P0oWQ |>]![|>^1!|>^1!!!!%#|75TI|>[LD|>V<gOq6Yc!!K?& !%J<G!!!)$ 9;*f! !!!.% !C3c.!(CUL!!!#& !!#0GML3F5B^T5s!!!!5tUGTV !!#3H !!!!nMW<gJ !%A5F!%J<G !!#6Ih~y(E(1+k7!!!%#!!!!Z !!#AL(P9Wa(2oHj|>T)!!!#0F !!!!# !!#DM !!!!(!!!LG !!+fv !!!%(!!+u{!!!!F :lang=aa|ast|ay|bi|br|ca|ch|cs|da|et|eu|fj|fo|fur|fy|gd|gl|gv|ho|hu|ia|id|ie|io|is|kl|lb|mg|mt|nb|nds|nn|no|oc|om|pl|rm|sk|sma|smj|so|sq|sv|sw|tn|tr|ts|vo|wa|wen|wo|xh|yap|zu:fontversion=0:fontformat=Type 1:embolden=False:embeddedbitmap=False" (gdb) This looks a bit weird already and I found that I could easily trigger a crash like by inserting __DUMMY__ into the pattern from the start: mfabian@magellan:~$ fc-match "foo:\\_\\_DUMMY\\_\\_=1" Segmentation fault (core dumped) mfabian@magellan:~$ I tentatively "fixed" this crash triggered by "fc-match" with the following patch: diff -ru fontconfig-2.3.93.20051222.orig/src/fcname.c fontconfig-2.3.93.20051222/src/fcname.c --- fontconfig-2.3.93.20051222.orig/src/fcname.c 2005-12-21 16:47:42.000000000 +0100 +++ fontconfig-2.3.93.20051222/src/fcname.c 2005-12-23 17:55:04.000000000 +0100 @@ -703,7 +703,7 @@ for (;;) { name = FcNameFindNext (name, ":,", save, &delim); - if (t) + if (t && strcmp(t->object, "__DUMMY__")) { v = FcNameConvert (t->type, save, &m); if (!FcPatternAdd (pat, t->object, v, FcTrue)) but this didn''t help for rxvt-unicode. When debugging rxvt-unicode, I found that shortly before crash the function const char * FcObjectPtrU (FcObjectPtr si) { const FcObjectTypeList *l; int i, j; if (si > 0) { if (si < biggest_known_ntypes) return biggest_known_types[si].object; j = 0; for (l = _FcObjectTypes; l; l = l->next) for (i = 0; i < l->ntypes; i++, j++) if (j == si) return l->types[i].object; } return _FcUserObjectNames[-si].object; } is called with si=45, then nothing can be found in the for loops within "if (si > 0)" and finally return _FcUserObjectNames[-si].object; is reached. An array index of -45 looks weird and it is not surprising that junk is returned and fontconfig crashes soon later. Maybe si=45 is already bigger than it should ever get? Could this be related to introducing the extra object __DUMMY__? -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> I''m trying to find the reason for a crash in fontconfig triggered > by rxvt-unicode. I couldn''t yet understand it but I have the suspicion > that it is related to the introduction of "__DUMMY__". I found > that this "__DUMMY__" is inserted into the pattern by fontconfig > when the pattern is expanded: > > (gdb) p FcNameUnparse(new) > $11 = ( > FcChar8 *) 0x69a080 "Courier:maxglyphmemory=1048576:\\_\\_DUMMY\\_\\_=1048576:style=Regular:slant=0:weight=80:width=100:pixelsize=13:spacing=100:foundry=ibm:antialias=True:hintstyle=3:hinting=True:verticallayout=False:autohint=False:globaladvance=True:index=0:outline=True:scalable=True:dpi=112.059:rgba=5:scale=1:minspace=True:charset= |>^1!|>^1!P0oWQ |>]![|>^1!|>^1!!!!%#|75TI|>[LD|>V<gOq6Yc!!K?& !%J<G!!!)$ 9;*f! !!!.% !C3c.!(CUL!!!#& !!#0GML3F5B^T5s!!!!5tUGTV !!#3H !!!!nMW<gJ !%A5F!%J<G !!#6Ih~y(E(1+k7!!!%#!!!!Z !!#AL(P9Wa(2oHj|>T)!!!#0F !!!!# !!#DM !!!!(!!!LG !!+fv !!!%(!!+u{!!!!F :lang=aa|ast|ay|bi|br|ca|ch|cs|da|et|eu|fj|fo|fur|fy|gd|gl|gv|ho|hu|ia|id|ie|io|is|kl|lb|mg|mt|nb|nds|nn|no|oc|om|pl|rm|sk|sma|smj|so|sq|sv|sw|tn|tr|ts|vo|wa|wen|wo|xh|yap|zu:fontversion=0:fontformat=Type 1:embolden=False:embeddedbitmap=False" > (gdb)Dirk M?ller <dmueller@suse.de> and me found the reason why this strange __DUMMY__ was inserted into the pattern. It is a problem in libXft. For details see http://bugzilla.novell.com/show_bug.cgi?id=141216 Comment #2 of this bug report contains a patch for libXft to fix the problem: https://bugzilla.novell.com/attachment.cgi?id=61879&action=view -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN <mfabian@suse.de> ????????:> Keith Packard <keithp@keithp.com> ????????: > >> On Fri, 2005-12-23 at 03:26 +0100, Mike FABIAN wrote: >> >>> With the latest fontconfig 2.4 branch (CVS checkout from today), >>> this command doesn''t list the full path anymore, only the base name: >>> >>> mfabian@magellan:~$ >>> >>> Older versions of fontconfig listed the full path here: >>> >> >>> Was that an intentional change or is this a bug? >> >> That would be a bug, but I thought it had been fixed. > > Apparently not because I tried with the latest CVS checkout.Still happens with the CVS from today (fontconfig 2.4 branch): mfabian@magellan:~$ fc-match -v "code2000" | grep file file: "CODE2000.TTF"(s) mfabian@magellan:~$ mfabian@magellan:~$ fc-list : family file | grep -i code2000 /usr/X11R6/lib/X11/fonts/CODE2000.TTF: Code2000 mfabian@magellan:~$ -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????