Re: Tutorial or guidance for using fontconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Staffan Gimåker wrote:> On Wednesday 07 January 2009 23:55:45 Behdad Esfahbod wrote:>> If you still decide to use fontconfig directly, I always reply to messages>> that are to the point.  True, there is no good guide to read.  But if you>> ask smart questions (like, "I have a family name, how do I find the best>> font file to use?"), you get smart answers.  If you ask stupid questions>> ("how do I use fontconfig?"), you probably don't get any answers.> > So, if I have a family name (say, Times), how *do I* find the best font file to > use (as in, the path to the font)?
Check the man pages for exact parameters and error handling, but somethinglike this:
  FcPattern *pat, *match;  FcResult result;  char *file;  int index;
  pat = FcPatternCreate ();  FcPatternAddString (pat, FC_FAMILY, "Times");  FcConfigSubstitute (NULL, pat, FcMatchPattern);  FcDefaultSubstitute (pat);  match = FcFontMatch (NULL, pat, &result);
  FcPatternGetString (match, FC_FILE, 0, (FcChar8 **) &file);  FcPatternGetInteger (match, FC_INDEX, 0, &index);
If you use FreeType, at this point you can do:
  FT_New_Face (ftlib, file, id, &face);
to get your face.  Then you can clean up:
  FcPatternDestroy (match);  FcPatternDestroy (pat);
> (We use OpenGL to render (polygonal) text in 3D so, AFAICT, going through > Pango seems a bit redundant for our usage.)
Going through Pango gets you internationalization.  That is, correct renderingof Arabic, Hebrew, Indic, Thai, etc etc etc.  There are a few projects usingPango with OpenGL.  Search the net.
Cheers,behdad
> Cheers,> Staffan_______________________________________________Fontconfig mailing listFontconfig@xxxxxxxxxxxxxxxxxxxxxxxxx://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux