On Sun, 24 Nov 2002 20:33:04 -0500, Owen Taylor wrote:

> Probably something wrong about how you are constructing the pattern.
> Fontconfig has the annoying habit of _always_ matching something,
> which, in case of error is often something unrelated to what you
> actually want. Can you provide a code snippet showing how you
> are constructing the pattern and using it to load the font?

Sure...

  std::cout << fontName << std::endl;
  
  initialPattern = FcNameParse(FcChar8String(fontName.begin(),
                                             fontName.end()).c_str());
  if (!initialPattern) { throw std::bad_alloc(); }
  
  //
  // Set the language.
  //
  if (!language.empty()) {
      FcPatternAddString(initialPattern, FC_LANG, language.c_str());
  }
  
  FcPatternPrint(initialPattern);
  FcChar8 * name = FcNameUnparse(initialPattern);
  std::cout << name << std::endl;
  free(name);
  
  FcResult result = FcResultMatch;
  matchedPattern = FcFontMatch(0, initialPattern, &result);
  if (result != FcResultMatch) { throw FontconfigError(result); }
  assert(matchedPattern);

  FcPatternPrint(matchedPattern);


-- 
Braden McDaniel                           e-mail: <[EMAIL PROTECTED]>
<http://endoframe.com>                    Jabber: <[EMAIL PROTECTED]>



_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts

Reply via email to