Donn wrote:> Is there any way to get the other meta info (like foundry and copyright) out > of an *arbitrary* font file? I wanted to call fc-match from within Python, > but from what I can see it only searches fonts that FC controls and that > means arbitrary fonts won''t work.Executing "ftinfo -a" on a file will give you that information, though I''m not sure it''s what you''re looking for, unless you use fontconfig to determine what the file is first. --Pat
Hello, The only practical Python Freetype module I have found is in the Python Imaging Library and that only lets me see the family name and style of a given font file. I can''t even tell how many sub-faces are in a file and must rely on a while (True) with error catching to break out! Is there any way to get the other meta info (like foundry and copyright) out of an *arbitrary* font file? I wanted to call fc-match from within Python, but from what I can see it only searches fonts that FC controls and that means arbitrary fonts won''t work. Just wondering if there is something standard, small on resources and widely installed and updated that I can rely on (via Python, popen or otherwise) to query fonts. If so, great. If not then I''ll get onto the PIL list and try to get them to beef-up the interface to FT2. Thanks, \d
> Executing "ftinfo -a" on a file will give you that information,Isn''t ftinfo pretty heavy on the Perl? It also only covers TTF files (I tested) and I''m trying to support Type1 too.> I''m not sure it''s what you''re looking for, unless you use fontconfig to > determine what the file is first.Well, my app Fonty Python, is all about herding arbitrary font files and then "installing" them by making links in ~/.fonts (and removing them by removing the links.) The idea has always been to introduce some element of font management to the scene - as well as the ability to view fonts that are not installed (i.e. under the control of fontconfig), just laying about in folders. So, I have the paths as part of the whole herding thing ;) \d
On Sat, 2007-12-22 at 19:43 +0200, Donn wrote:> Hello, > The only practical Python Freetype module I have found is in the Python > Imaging Library and that only lets me see the family name and style of a > given font file. I can''t even tell how many sub-faces are in a file and must > rely on a while (True) with error catching to break out! > > Is there any way to get the other meta info (like foundry and copyright) out > of an *arbitrary* font file? I wanted to call fc-match from within Python, > but from what I can see it only searches fonts that FC controls and that > means arbitrary fonts won''t work.FcPattern * FcFreeTypeQueryFace (const FT_Face face, const char *file, int id, FcBlanks *blanks); will scan an arbitrary file and let you use the other Fontconfig APIs to look at the results. Writing a short application that called this function and dumped out the results in whatever format you needed should be fairly simple. -- 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/20071222/2dd133ff/attachment.pgp
> FcFreeTypeQueryFace call? Not educated about using it with Python, but I > think it would give you a consistent interface to TT and Type1. Plus > work on Mac for font collections etc.Thanks, Keith mentioned it too. I have only a few days to update my app before I am too busy on other things to code for several months, so I am trying to KISS right now. I can''t get into C and so forth in that time. I''ll bear it in mind for the future, thanks. \d
Op zaterdag 22-12-2007 om 19:43 uur [tijdzone +0200], schreef Donn:> The only practical Python Freetype module I have found is in the > Python Imaging Library and that only lets me see the family name and > style of a given font file. I can''t even tell how many sub-faces are > in a file and must rely on a while (True) with error catching to break > out! > > Is there any way to get the other meta info (like foundry and > copyright) out of an *arbitrary* font file? I wanted to call fc-match > from within Python, but from what I can see it only searches fonts > that FC controls and that means arbitrary fonts won''t work. > > Just wondering if there is something standard, small on resources and > widely installed and updated that I can rely on (via Python, popen or > otherwise) to query fonts.Maybe TTX/FontTools (package name in Ubuntu is ''fonttools'') might be useful? (It''s not widely installed, but...) -- Jan Claeys
> > Just wondering if there is something standard, small on resources and > > widely installed and updated that I can rely on (via Python, popen or > > otherwise) to query fonts. > > Maybe TTX/FontTools (package name in Ubuntu is ''fonttools'') might be > useful? (It''s not widely installed, but...)Thanks Jan, I''ve tried that one. It''s not that small and brings Perl with it! But, it does do a good job. I guess, if it''s the only game in town, then I might have to go that way. I think I might be better served by finding some spare time and learning me some C :) \d