Commit 1643d951 authored by bstell%netscape.com's avatar bstell%netscape.com
Browse files

bug 90736, r=ftang, sr=blizzard

for western documents find special chars ("smart quotes", bullet)
glyphs from adobe-fontspecific fonts before Japanese fonts or the
early transliterator
parent 26d91ba5
Loading
Loading
Loading
Loading
+69 −57
Original line number Diff line number Diff line
@@ -2907,11 +2907,12 @@ SetFontLangGroupInfo(nsFontCharSetMap* aCharSetMap)
  // get the atom for mFontLangGroup->mFontLangGroupName so we can
  // apply fontLangGroup operations to it
  // eg: search for related groups, check for scaling prefs
  if (!fontLangGroup->mFontLangGroupAtom) {
  const char *langGroup = fontLangGroup->mFontLangGroupName;
  if (!langGroup)
    langGroup = "";
  if (!fontLangGroup->mFontLangGroupAtom) {
    fontLangGroup->mFontLangGroupAtom = NS_NewAtom(langGroup);
  }

  // get the font scaling controls
  nsFontCharSetInfo *charSetInfo = aCharSetMap->mInfo;
@@ -2962,7 +2963,6 @@ SetFontLangGroupInfo(nsFontCharSetMap* aCharSetMap)
      charSetInfo->mBitmapUndersize = gBitmapUndersize;
  }
}
}

static void
GetFontNames(const char* aPattern, nsFontNodeArray* aNodes)
@@ -3706,23 +3706,35 @@ if (gAllowDoubleByteSpecialChars) {
    }
    if (mDocConverterType == SingleByteConvert) {
      // before we put in the transliterator to disable double byte special chars
      // make sure we search x-western to get the EURO sign
      // add the x-western font before the early transliterator
      // to get the EURO sign (hack)

      nsFontGTK* western_font = nsnull;
      if (mLangGroup != gWesternLocale)
        western_font = FindLangGroupPrefFont(gWesternLocale, aChar);

      // add the symbol font before the early transliterator
      // to get the bullet (hack)
      nsCAutoString ffre("*-symbol-adobe-fontspecific");
      nsFontGTK* symbol_font = TryNodes(ffre, 0x0030);

      // add the early transliterator
      // to avoid getting Japanese "special chars" such as smart
      // since they are very oversized compared to western fonts
      nsFontGTK* sub_font = FindSubstituteFont(aChar);
      NS_ASSERTION(sub_font, "failed to get a special chars substitute font");
      if (sub_font) {
        sub_font->mMap = gDoubleByteSpecialCharsMap;
        AddToLoadedFontsList(sub_font);
      }
      if (western_font) {
        NS_ASSERTION(western_font->SupportsChar(aChar), "font supposed to support this char");
      if (western_font && FONT_HAS_GLYPH(western_font->mMap, aChar)) {
        return western_font;
      }
      else if (sub_font) {
      else if (symbol_font && FONT_HAS_GLYPH(symbol_font->mMap, aChar)) {
        return symbol_font;
      }
      else if (sub_font && FONT_HAS_GLYPH(sub_font->mMap, aChar)) {
        FIND_FONT_PRINTF(("      transliterate special chars for single byte docs"));
        if (FONT_HAS_GLYPH(sub_font->mMap, aChar))
        return sub_font;
      }
    }