nsPostScriptObj *psObj = (nsPostScriptObj*)aClosure; FILE *f = psObj->GetPrintFile();
nsPostScriptObj *psObj = ((PrefEnumClosure *)aClosure)->psObj; FILE *f = ((PrefEnumClosure *)aClosure)->handle;
static void PrefEnumCallback(const char *aName, void *aClosure){  nsPostScriptObj *psObj = (nsPostScriptObj*)aClosure;  FILE *f = psObj->GetPrintFile();  nsAutoString lang; lang.AssignWithConversion(aName);  if (strstr(aName, kNativeFontPrefix)) {    NS_ASSERTION(strlen(kNativeFontPrefix) == 28, "Wrong hard-coded size.");    lang.Cut(0, 28);  } else if (strstr(aName, kUnicodeFontPrefix)) {    NS_ASSERTION(strlen(kNativeFontPrefix) == 29, "Wrong hard-coded size.");    lang.Cut(0, 29);  }  nsStringKey key(lang);  PS_LangGroupInfo *linfo = (PS_LangGroupInfo *) gLangGroups->Get(&key);  if (linfo) {    /* already exist */    return;  }  /* define new language group */  nsXPIDLCString psnativefont;  nsXPIDLCString psnativecode;  nsXPIDLCString psunicodefont;  int psfontorder = 0;  PRBool use_prefsfile = PR_FALSE;  PRBool use_vendorfile = PR_FALSE;  //  // Try to get the info from the user's prefs file  //  nsCAutoString namepsnativefont(kNativeFontPrefix);  namepsnativefont.AppendWithConversion(lang);  gPrefs->CopyCharPref(namepsnativefont.get(), getter_Copies(psnativefont));  nsCAutoString namepsnativecode("print.postscript.nativecode.");  namepsnativecode.AppendWithConversion(lang);  gPrefs->CopyCharPref(namepsnativecode.get(), getter_Copies(psnativecode));  if (((psnativefont)&&(*psnativefont)) && ((psnativecode)&&(*psnativecode))) {    use_prefsfile = PR_TRUE;  } else {    psnativefont.Adopt(0);    psnativecode.Adopt(0);  }  //  // if not found look for info from the printer vendor  //  if (use_prefsfile != PR_TRUE) {    psObj->GetUnixPrinterSetting(namepsnativefont, getter_Copies(psnativefont));    psObj->GetUnixPrinterSetting(namepsnativecode, getter_Copies(psnativecode));    if ((psnativefont) && (psnativecode)) {      use_vendorfile = PR_TRUE;    } else {      psnativefont.Adopt(0);      psnativecode.Adopt(0);    }  }  if (!use_prefsfile && !use_vendorfile) {    GetUnixPrinterFallbackSetting(namepsnativefont, getter_Copies(psnativefont));    GetUnixPrinterFallbackSetting(namepsnativecode, getter_Copies(psnativecode));  }  /* psnativefont and psnativecode both should be set */  if (!psnativefont || !psnativecode) {    psnativefont.Adopt(0);    psnativecode.Adopt(0);  } else {    nsCAutoString namepsfontorder("print.postscript.fontorder.");    namepsfontorder.AppendWithConversion(lang);    if (use_prefsfile) {      gPrefs->GetIntPref(namepsfontorder.get(), &psfontorder);    }    else if (use_vendorfile) {      nsXPIDLCString psfontorder_str;      psObj->GetUnixPrinterSetting(namepsfontorder, getter_Copies(psfontorder_str));      if (psfontorder_str) {        psfontorder = atoi(psfontorder_str);      }    }  }  /* check UCS fonts */  nsCAutoString namepsunicodefont(kUnicodeFontPrefix);  namepsunicodefont.AppendWithConversion(lang);  if (use_prefsfile) {    gPrefs->CopyCharPref(namepsunicodefont.get(), getter_Copies(psunicodefont));  } else if (use_vendorfile) {    psObj->GetUnixPrinterSetting(namepsunicodefont, getter_Copies(psunicodefont));  }  nsresult res = NS_OK;  if (psnativefont || psunicodefont) {    linfo = new PS_LangGroupInfo;    linfo->mEncoder = nsnull;    linfo->mU2Ntable = nsnull;    if (psnativecode) {      nsAutoString str;      nsCOMPtr<nsICharsetConverterManager> ccMain =        do_GetService(kCharsetConverterManagerCID, &res);            if (NS_SUCCEEDED(res)) {        res = ccMain->GetUnicodeEncoder(psnativecode.get(), &linfo->mEncoder);      }    }    gLangGroups->Put(&key, (void *) linfo);    nsCAutoString langstrC; langstrC.AssignWithConversion(lang);    if (psnativefont && linfo->mEncoder) {      fprintf(f, "/Unicode2NativeDict%s 0 dict def\n", langstrC.get());    }    fprintf(f, "/%s_ls {\n", langstrC.get());    fprintf(f, "  /NativeFont /%s def\n",      (psnativefont && linfo->mEncoder) ? psnativefont.get() : "Courier");    fprintf(f, "  /UCS2Font /%s def\n",		  psunicodefont ? psunicodefont.get() : "Courier");    if (psnativefont && linfo->mEncoder) {      fprintf(f, "  /Unicode2NativeDict Unicode2NativeDict%s def\n",		    langstrC.get());    }    if (psfontorder) {      fprintf(f, "  /unicodeshow1 { real_unicodeshow_native } bind def\n");      fprintf(f, "  /unicodeshow2 { real_unicodeshow } bind def\n");    } else {      fprintf(f, "  /unicodeshow1 { real_unicodeshow } bind def\n");      fprintf(f, "  /unicodeshow2 { real_unicodeshow_native } bind def\n");    }    fprintf(f, "} bind def\n");    if (linfo->mEncoder) {      linfo->mEncoder->SetOutputErrorBehavior(		    linfo->mEncoder->kOnError_Replace, nsnull, '?');      linfo->mU2Ntable = new nsHashtable();    }  }}