[Fontconfig] What are the possible font family names? Why no "Helvetica" ?

John Ellson ellson at research.att.com
Mon Mar 17 12:45:34 EST 2003

OK, Progress.   I now have a working "fam2font" program which is short 
enough to post here:

#include <stdio.h>
#include <fontconfig/fontconfig.h>

int main (int argc, char *argv[]) {
  FcPattern *pattern = 0, *match = 0;
  FcChar8 *file = 0;

  if ((argc < 2) || !(FcInit())) return -1;
  pattern = FcPatternBuild(0,FC_FAMILY,FcTypeString,argv[1],0);
  if (!(match = FcFontMatch(0,pattern,0))) return -1;
  if (FcPatternGetString(match,FC_FILE,0,&file) != FcResultMatch) return -1;
  return 0;

Compile with:
    gcc -Wall fam2font.c -lfontconfig -o fam2font

Example usage:
    gnome-font-viewer `./fam2font fixed`
    gnome-font-viewer `./fam2font Times`

Those worked OK for me, but I was expecting to get a sans-serif font with:
    gnome-font-viewer `./fam2font Helvetica`
instead I got the same serif font as "Times"

What are the possible font family names?

Why is "Helvetica" not matched to a sans-serif font?

John Ellson

More information about the Fontconfig mailing list