nsAdoptingString value = nsContentUtils::GetStringPref(pref.get()); if (!value.IsEmpty()) {
rv = mPrefs->CopyUnicharPref(pref.get(), getter_Copies(value)); if (NS_SUCCEEDED(rv)) {
nsPresContext::GetFontPreferences(){  if (!mLangGroup)    return;  /* Fetch the font prefs to be used -- see bug 61883 for details.     Not all prefs are needed upfront. Some are fallback prefs intended     for the GFX font sub-system...  1) unit : assumed to be the same for all language groups -------------  font.size.unit = px | pt    XXX could be folded in the size... bug 90440  2) attributes for generic fonts --------------------------------------  font.default = serif | sans-serif - fallback generic font  font.name.[generic].[langGroup] = current user' selected font on the pref dialog  font.name-list.[generic].[langGroup] = fontname1, fontname2, ... [factory pre-built list]  font.size.[generic].[langGroup] = integer - settable by the user  font.size-adjust.[generic].[langGroup] = "float" - settable by the user  font.minimum-size.[langGroup] = integer - settable by the user  */  float p2t = ScaledPixelsToTwips();  mDefaultVariableFont.size = NSFloatPixelsToTwips((float)16, p2t);  mDefaultFixedFont.size = NSFloatPixelsToTwips((float)13, p2t);  const char *langGroup;  mLangGroup->GetUTF8String(&langGroup);  nsCAutoString pref;  // get the current applicable font-size unit  enum {eUnit_unknown = -1, eUnit_px, eUnit_pt};  PRInt32 unit = eUnit_px;  nsAdoptingCString cvalue =    nsContentUtils::GetCharPref("font.size.unit");  if (!cvalue.IsEmpty()) {    if (cvalue.Equals("px")) {      unit = eUnit_px;    }    else if (cvalue.Equals("pt")) {      unit = eUnit_pt;    }    else {      NS_WARNING("unexpected font-size unit -- expected: 'px' or 'pt'");      unit = eUnit_unknown;    }  }  // get font.minimum-size.[langGroup]  pref.Assign("font.minimum-size.");  pref.Append(langGroup);  PRInt32 size = nsContentUtils::GetIntPref(pref.get());  if (size > 0) {    if (unit == eUnit_px) {      mMinimumFontSize = NSFloatPixelsToTwips((float)size, p2t);    }    else if (unit == eUnit_pt) {      mMinimumFontSize = NSIntPointsToTwips(size);    }  }  // get attributes specific to each generic font  nsCAutoString generic_dot_langGroup;  for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) {    generic_dot_langGroup.Assign(kGenericFont[eType]);    generic_dot_langGroup.Append(langGroup);    nsFont* font;    switch (eType) {      case eDefaultFont_Variable:  font = &mDefaultVariableFont;  break;      case eDefaultFont_Fixed:     font = &mDefaultFixedFont;     break;      case eDefaultFont_Serif:     font = &mDefaultSerifFont;     break;      case eDefaultFont_SansSerif: font = &mDefaultSansSerifFont; break;      case eDefaultFont_Monospace: font = &mDefaultMonospaceFont; break;      case eDefaultFont_Cursive:   font = &mDefaultCursiveFont;   break;      case eDefaultFont_Fantasy:   font = &mDefaultFantasyFont;   break;      default: NS_ERROR("not reached - bogus to silence some compilers"); break;    }    // set the default variable font (the other fonts are seen as 'generic' fonts    // in GFX and will be queried there when hunting for alternative fonts)    if (eType == eDefaultFont_Variable) {      MAKE_FONT_PREF_KEY(pref, "font.name", generic_dot_langGroup);      nsAdoptingString value =        nsContentUtils::GetStringPref(pref.get());      if (!value.IsEmpty()) {        font->name.Assign(value);      }      else {        MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);        value = nsContentUtils::GetStringPref(pref.get());        if (!value.IsEmpty()) {          mDefaultVariableFont.name.Assign(value);        }      }     }    else {      if (eType == eDefaultFont_Monospace) {        // This takes care of the confusion whereby people often expect "monospace"         // to have the same default font-size as "-moz-fixed" (this tentative        // size may be overwritten with the specific value for "monospace" when        // "font.size.monospace.[langGroup]" is read -- see below)        font->size = mDefaultFixedFont.size;      }      else if (eType != eDefaultFont_Fixed) {        // all the other generic fonts are initialized with the size of the        // variable font, but their specific size can supersede later -- see below        font->size = mDefaultVariableFont.size;      }    }    // Bug 84398: for spec purists, a different font-size only applies to the    // .variable. and .fixed. fonts and the other fonts should get |font-size-adjust|.    // The problem is that only GfxWin has the support for |font-size-adjust|. So for    // parity, we enable the ability to set a different font-size on all platforms.    // get font.size.[generic].[langGroup]    // size=0 means 'Auto', i.e., generic fonts retain the size of the variable font    MAKE_FONT_PREF_KEY(pref, "font.size", generic_dot_langGroup);    size = nsContentUtils::GetIntPref(pref.get());    if (size > 0) {      if (unit == eUnit_px) {        font->size = NSFloatPixelsToTwips((float)size, p2t);      }      else if (unit == eUnit_pt) {        font->size = NSIntPointsToTwips(size);      }    }    // get font.size-adjust.[generic].[langGroup]    // XXX only applicable on GFX ports that handle |font-size-adjust|    MAKE_FONT_PREF_KEY(pref, "font.size-adjust", generic_dot_langGroup);    cvalue = nsContentUtils::GetCharPref(pref.get());    if (!cvalue.IsEmpty()) {      font->sizeAdjust = (float)atof(cvalue.get());    }#ifdef DEBUG_rbs    printf("%s Family-list:%s size:%d sizeAdjust:%.2f\n",           generic_dot_langGroup.get(),           NS_ConvertUCS2toUTF8(font->name).get(), font->size,           font->sizeAdjust);#endif  }}