family_name = NS_LITERAL_CSTRING("arial");
family_name.AssignLiteral("arial");
FindFont(const nsString& aFamily, PRBool aGeneric, void *aData){  PRBool retval = PR_TRUE;    FindFontStruct* font_data = (FindFontStruct*) aData;  #ifdef DEBUG  printf("trying to instantiate font %s, generic=%d\n", NS_ConvertUCS2toUTF8(aFamily).get(),         aGeneric);#endif  nsCAutoString family_name;    if (aGeneric) {    PRUint8 id;    nsFont::GetGenericID(aFamily, &id);    switch (id) {      case kGenericFont_serif:        family_name = NS_LITERAL_CSTRING("times new roman");        break;      case kGenericFont_monospace:        family_name = NS_LITERAL_CSTRING("courier new");        break;      case kGenericFont_sans_serif:      default:        family_name = NS_LITERAL_CSTRING("arial");        break;    }  }  else {    family_name = NS_ConvertUCS2toUTF8(aFamily);    ToLowerCase(family_name);  }    nsCAutoString language;  PRUint16 slant = nsIFontCatalogService::kFCSlantRoman;  if (font_data->font.style && NS_FONT_STYLE_ITALIC)    slant = nsIFontCatalogService::kFCSlantItalic;      nsCOMPtr<nsIArray> arr;  nsSVGLibartFreetype::fontCatalog->GetFontCatalogEntries(family_name,                                                          language,                                                          font_data->font.weight,                                                          nsIFontCatalogService::kFCWeightAny,                                                          slant,                                                          nsIFontCatalogService::kFCSpacingAny,                                                          getter_AddRefs(arr));  PRUint32 count;  arr->GetLength(&count);#ifdef DEBUG  printf("FindFont(%s): number of fonts found: %d\n", family_name.get(), count);#endif  if (count>0) {    retval =  PR_FALSE; // break    // just take the first one for now:    arr->QueryElementAt(0, NS_GET_IID(nsITrueTypeFontCatalogEntry),                        getter_AddRefs(font_data->font_entry));  }  else {    // try alias if there is one:    const nsDependentString *alias = nsnull;    nsSVGLibartGlyphMetricsFT::sFontAliases.Get(NS_ConvertUTF8toUCS2(family_name),                                                &alias);    if (alias) {      // XXX this might cause a stack-overflow if there are cyclic      // aliases in sFontAliases      retval = FindFont(nsString(*alias), PR_FALSE, aData);          }  }    return retval;      }