Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
nsFontMetricsGTK.cpp File Reference
#include <sys/types.h>
#include "gfx-config.h"
#include "nscore.h"
#include "nsQuickSort.h"
#include "nsFontMetricsGTK.h"
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsILanguageAtomService.h"
#include "nsISaveAsCharset.h"
#include "nsIPref.h"
#include "nsCOMPtr.h"
#include "nsPrintfCString.h"
#include "nspr.h"
#include "nsHashtable.h"
#include "nsReadableUtils.h"
#include "nsAString.h"
#include "nsXPIDLString.h"
#include "nsFontDebug.h"
#include "nsCharTraits.h"
#include "nsXFontNormal.h"
#include "nsX11AlphaBlend.h"
#include "nsXFontAAScaledBitmap.h"
#include "nsUnicharUtils.h"
#include <regex.h>
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#include "dbyte_special_chars.ccmap"

Go to the source code of this file.

Classes

struct  nsFontCharSetInfo
struct  nsFontFamily
struct  nsFontFamilyName
struct  nsFontPropertyName
class  nsFontGTKNormal
class  nsFontGTKSubstitute
class  nsFontGTKUserDefined
struct  BreakGetTextDimensionsData
struct  EnumerateNodeInfo

Defines

#define ENABLE_X_FONT_BANNING   1
#define SAFE_CCMAP_HAS_CHAR_EXT(ccmap, c)   ((ccmap) && ((IS_SURROGATE(c) && (ccmap)==gDoubleByteSpecialCharsCCMap) ? PR_FALSE : (CCMAP_HAS_CHAR_EXT(ccmap,c))))
#define REG_OK   (0)
#define USER_DEFINED   "x-user-def"
#define FONT_MAX_FONT_SCALE   2
#define WIDEN_8_TO_16_BUF_SIZE   1024
#define NOT_FOUND_FONT_SIZE   1000*1000*1000
#define GET_WEIGHT_INDEX(index, weight)
#define FIND_FIELD(var)
#define SKIP_FIELD(var)
#define BOOL2STR(b)   ((b)?("true"):("false"))

Typedefs

typedef struct EnumerateNodeInfo EnumerateNodeInfo

Functions

static NS_DEFINE_CID (kCharSetManagerCID, NS_ICHARSETCONVERTERMANAGER_CID)
static NS_DEFINE_CID (kPrefCID, NS_PREF_CID)
static NS_DEFINE_CID (kSaveAsCharsetCID, NS_SAVEASCHARSET_CID)
static void SetCharsetLangGroup (nsFontCharSetInfo *aCharSetInfo)
static gint SingleByteConvert (nsFontCharSetInfo *aSelf, XFontStruct *aFont, const PRUnichar *aSrcBuf, PRInt32 aSrcLen, char *aDestBuf, PRInt32 aDestLen)
static gint DoubleByteConvert (nsFontCharSetInfo *aSelf, XFontStruct *aFont, const PRUnichar *aSrcBuf, PRInt32 aSrcLen, char *aDestBuf, PRInt32 aDestLen)
static gint ISO10646Convert (nsFontCharSetInfo *aSelf, XFontStruct *aFont, const PRUnichar *aSrcBuf, PRInt32 aSrcLen, char *aDestBuf, PRInt32 aDestLen)
static char * atomToName (nsIAtom *aAtom)
 DEFINE_CCMAP (gDoubleByteSpecialCharsCCMap,)
static PRBool FreeCharSetMap (nsHashKey *aKey, void *aData, void *aClosure)
static PRBool FreeFamily (nsHashKey *aKey, void *aData, void *aClosure)
static void FreeStretch (nsFontStretch *aStretch)
static void FreeWeight (nsFontWeight *aWeight)
static void FreeStyle (nsFontStyle *aStyle)
PRBool FreeNode (nsHashKey *aKey, void *aData, void *aClosure)
static PRBool FreeNodeArray (nsHashKey *aKey, void *aData, void *aClosure)
static void FreeGlobals (void)
static nsresult InitGlobals (nsIDeviceContext *aDevice)
gint Widen8To16AndMove (const gchar *char_p, gint char_len, XChar2b *xchar2b_p)
gint Widen8To16AndGetWidth (nsXFont *xFont, const gchar *text, gint text_length)
void Widen8To16AndDraw (GdkDrawable *drawable, nsXFont *xFont, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length)
static PRBool IsASCIIFontName (const nsString &aName)
static PRBool FontEnumCallback (const nsString &aFamily, PRBool aGeneric, void *aData)
static PRBool SetUpFontCharSetInfo (nsFontCharSetInfo *aSelf)
static PRUint16GetMapFor10646Font (XFontStruct *aFont)
static PRBool SetFontCharsetInfo (nsFontGTK *aFont, nsFontCharSetInfo *aCharSet, PRUint32 aChar)
static nsFontGTKSetupUserDefinedFont (nsFontGTK *aFont)
static PRBool PR_CALLBACK do_BreakGetTextDimensions (const nsFontSwitchGTK *aFontSwitch, const PRUnichar *aSubstring, PRUint32 aSubstringLength, void *aData)
static PR_BEGIN_EXTERN_C int CompareSizes (const void *aArg1, const void *aArg2, void *data)
static void SetFontLangGroupInfo (nsFontCharSetMap *aCharSetMap)
static nsFontStyleNodeGetStyle (nsFontNode *aNode, int aStyleIndex)
static nsFontWeightNodeGetWeight (nsFontStyle *aStyle, int aWeightIndex)
static nsFontStretchNodeGetStretch (nsFontWeight *aWeight, int aStretchIndex)
static PRBool NodeAddScalable (nsFontStretch *aStretch, PRBool aOutlineScaled, const char *aDashFoundry, const char *aFamily, const char *aWeight, const char *aSlant, const char *aWidth, const char *aStyle, const char *aSpacing, const char *aCharSet)
static PRBool NodeAddSize (nsFontStretch *aStretch, int aPixelSize, int aPointSize, float scaler, int aResX, int aResY, const char *aDashFoundry, const char *aFamily, const char *aWeight, const char *aSlant, const char *aWidth, const char *aStyle, const char *aSpacing, const char *aCharSet, nsFontCharSetInfo *aCharSetInfo)
static void GetFontNames (const char *aPattern, PRBool aAnyFoundry, PRBool aOnlyOutlineScaledFonts, nsFontNodeArray *aNodes)
static nsresult GetAllFontNames (void)
static nsFontFamilyFindFamily (nsCString *aName)
static void FFREToXLFDPattern (nsACString &aFFREName, nsACString &oPattern)
static void FFRESubstituteCharset (nsACString &aFFREName, const char *aReplacementCharset)
static void FFRESubstituteEncoding (nsACString &aFFREName, const char *aReplacementEncoding)
static void PrefEnumCallback (const char *aName, void *aClosure)
static PRIntn EnumerateNode (void *aElement, void *aData)
static PR_BEGIN_EXTERN_C int CompareFontNames (const void *aArg1, const void *aArg2, void *aClosure)
static PR_END_EXTERN_C nsresult EnumFonts (nsIAtom *aLangGroup, const char *aGeneric, PRUint32 *aCount, PRUnichar ***aResult)
nsFontCharSetMapGetCharSetMap (const char *aCharSetName)

Variables

static PRUint32 gFontDebug = 0 | NS_FONT_DEBUG_FONT_SCAN
static int gFontMetricsGTKCount = 0
static int gInitialized = 0
static PRBool gForceOutlineScaledFonts = PR_FALSE
static PRBool gAllowDoubleByteSpecialChars = PR_TRUE
static nsIPrefgPref = nsnull
static float gDevScale = 0.0f
static PRBool gScaleBitmapFontsWithDevScale = PR_FALSE
static nsICharsetConverterManagergCharSetManager = nsnull
static nsIUnicodeEncodergUserDefinedConverter = nsnull
static nsHashtable * gAliases = nsnull
static nsHashtable * gCharSetMaps = nsnull
static nsHashtable * gFamilies = nsnull
static nsHashtable * gFFRENodes = nsnull
static nsHashtable * gAFRENodes = nsnull
static nsHashtable * gCachedFFRESearches = nsnull
static nsHashtable * gSpecialCharSets = nsnull
static nsHashtable * gStretches = nsnull
static nsHashtable * gWeights = nsnull
nsISaveAsCharsetgFontSubConverter = nsnull
static nsFontNodeArraygGlobalList = nsnull
static nsIAtomgUnicode = nsnull
static nsIAtomgUserDefined = nsnull
static nsIAtomgZHTW = nsnull
static nsIAtomgZHHK = nsnull
static nsIAtomgZHTWHK = nsnull
static nsIAtomgUsersLocale = nsnull
static nsIAtomgWesternLocale = nsnull
static PRInt32 gOutlineScaleMinimum = 6
static PRBool gAABitmapScaleEnabled = PR_TRUE
static PRBool gAABitmapScaleAlways = PR_FALSE
static PRInt32 gAABitmapScaleMinimum = 6
static double gAABitmapOversize = 1.1
static double gAABitmapUndersize = 0.9
static PRInt32 gBitmapScaleMinimum = 10
static double gBitmapOversize = 1.2
static double gBitmapUndersize = 0.8
static regex_t * gFontRejectRegEx = nsnull
static regex_t * gFontAcceptRegEx = nsnull
static nsFontCharSetInfo Unknown = { nsnull }
static nsFontCharSetInfo Special = { nsnull }
static nsFontCharSetInfo USASCII
static nsFontCharSetInfo ISO88591
static nsFontCharSetInfo ISO88592
static nsFontCharSetInfo ISO88593
static nsFontCharSetInfo ISO88594
static nsFontCharSetInfo ISO88595
static nsFontCharSetInfo ISO88596
static nsFontCharSetInfo ISO885968x
static nsFontCharSetInfo ISO8859616
static nsFontCharSetInfo IBM1046
static nsFontCharSetInfo ISO88597
static nsFontCharSetInfo ISO88598
static nsFontCharSetInfo ISO88599
static nsFontCharSetInfo ISO885913
static nsFontCharSetInfo ISO885915
static nsFontCharSetInfo JISX0201
static nsFontCharSetInfo KOI8R
static nsFontCharSetInfo KOI8U
static nsFontCharSetInfo TIS6202
static nsFontCharSetInfo TIS620
static nsFontCharSetInfo ISO885911
static nsFontCharSetInfo Big5
static nsFontCharSetInfo Big5TWHK
static nsFontCharSetInfo CNS116431
static nsFontCharSetInfo CNS116432
static nsFontCharSetInfo CNS116433
static nsFontCharSetInfo CNS116434
static nsFontCharSetInfo CNS116435
static nsFontCharSetInfo CNS116436
static nsFontCharSetInfo CNS116437
static nsFontCharSetInfo GB2312
static nsFontCharSetInfo GB18030_0
static nsFontCharSetInfo GB18030_1
static nsFontCharSetInfo GBK
static nsFontCharSetInfo HKSCS
static nsFontCharSetInfo JISX0208
static nsFontCharSetInfo JISX0212
static nsFontCharSetInfo KSC5601
static nsFontCharSetInfo X11Johab
static nsFontCharSetInfo JohabNoAscii
static nsFontCharSetInfo JamoTTF
static nsFontCharSetInfo TamilTTF
static nsFontCharSetInfo CP1250
static nsFontCharSetInfo CP1251
static nsFontCharSetInfo CP1252
static nsFontCharSetInfo CP1253
static nsFontCharSetInfo CP1257
static nsFontCharSetInfo ISO106461
static nsFontCharSetInfo AdobeSymbol
static nsFontCharSetInfo AdobeEuro
static nsFontLangGroup FLG_WESTERN = { "x-western", nsnull }
static nsFontLangGroup FLG_RUSSIAN = { "x-cyrillic", nsnull }
static nsFontLangGroup FLG_BALTIC = { "x-baltic", nsnull }
static nsFontLangGroup FLG_CE = { "x-central-euro",nsnull }
static nsFontLangGroup FLG_GREEK = { "el", nsnull }
static nsFontLangGroup FLG_TURKISH = { "tr", nsnull }
static nsFontLangGroup FLG_HEBREW = { "he", nsnull }
static nsFontLangGroup FLG_ARABIC = { "ar", nsnull }
static nsFontLangGroup FLG_THAI = { "th", nsnull }
static nsFontLangGroup FLG_ZHCN = { "zh-CN", nsnull }
static nsFontLangGroup FLG_ZHTW = { "zh-TW", nsnull }
static nsFontLangGroup FLG_ZHHK = { "zh-HK", nsnull }
static nsFontLangGroup FLG_ZHTWHK = { "x-zh-TWHK", nsnull }
static nsFontLangGroup FLG_JA = { "ja", nsnull }
static nsFontLangGroup FLG_KO = { "ko", nsnull }
static nsFontLangGroup FLG_TAMIL = { "x-tamil", nsnull }
static nsFontLangGroup FLG_NONE = { nsnull, nsnull }
static nsFontCharSetMap gCharSetMap []
static nsFontFamilyName gFamilyNameTable []
static nsFontCharSetMap gNoneCharSetMap [] = { { nsnull }, }
static nsFontCharSetMap gSpecialCharSetMap []
static nsFontPropertyName gStretchNames []
static nsFontPropertyName gWeightNames []
static PRUint16gUserDefinedCCMap = nsnull
static PRUint16gEmptyCCMap = nsnull

Class Documentation

struct nsFontCharSetInfo

Definition at line 116 of file nsFontMetricsGTK.cpp.

Collaboration diagram for nsFontCharSetInfo:
Class Members
nsFontCharSetConverter Convert
double mAABitmapOversize
PRBool mAABitmapScaleAlways
PRInt32 mAABitmapScaleMin
double mAABitmapUndersize
double mBitmapOversize
PRInt32 mBitmapScaleMin
double mBitmapUndersize
PRUint16 * mCCMap
const char * mCharSet
nsIUnicodeEncoder * mConverter
PRBool mInitedSizeInfo
nsIAtom * mLangGroup
PRInt32 mOutlineScaleMin
PRUint8 mSpecialUnderline
struct nsFontFamily

Definition at line 139 of file nsFontMetricsGTK.cpp.

Collaboration diagram for nsFontFamily:
Class Members
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
PLHashTable *
mCharSets
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsFontNodeArray
mNodes
struct nsFontFamilyName

Definition at line 146 of file nsFontMetricsGTK.cpp.

Class Members
const char * mName
char * mName
char * mWinName
const char * mXName
struct nsFontPropertyName

Definition at line 152 of file nsFontMetricsGTK.cpp.

Collaboration diagram for nsFontPropertyName:
Class Members
const char * mName
int mValue
struct nsFontSearch

Definition at line 2575 of file nsFontMetricsGTK.cpp.

Collaboration diagram for nsFontSearch:
Class Members
PRUint32 mChar
PRUnichar mChar
nsFontGTK * mFont
nsFontXlib * mFont
nsFontMetricsGTK * mMetrics
nsFontMetricsXlib * mMetrics
struct BreakGetTextDimensionsData

Definition at line 4322 of file nsFontMetricsGTK.cpp.

Collaboration diagram for BreakGetTextDimensionsData:
Class Members
PRInt32 mAvailWidth
nscoord mAveCharWidth
PRInt32 * mBreaks
HDC mDC
PRInt32 mEstimatedNumChars
nsFontOS2 * mFont
HFONT mFont
nsVoidArray * mFonts
PRInt32 mNumBreaks
PRInt32 mNumCharsFit
nsVoidArray * mOffsets
float mP2T
PRInt32 mPrevBreakState_BreakIndex
nscoord mPrevBreakState_Width
HPS mPS
nscoord mSpaceWidth
nsDrawingSurfaceOS2 * mSurface
nscoord mWidth
struct EnumerateNodeInfo

Definition at line 6609 of file nsFontMetricsGTK.cpp.

Collaboration diagram for EnumerateNodeInfo:
Class Members
PRUnichar ** mArray
nsFontMetricsXlibContext * mFontMetricsContext
int mIndex
nsIAtom * mLangGroup

Define Documentation

#define BOOL2STR (   b)    ((b)?("true"):("false"))

Definition at line 44 of file nsFontMetricsGTK.cpp.

#define FIND_FIELD (   var)
Value:
char* var = p;                  \
  while ((*p) && ((*p) != '-')) { \
    p++;                          \
  }                               \
  if (*p) {                       \
    *p++ = 0;                     \
  }                               \
  else {                          \
    continue;                     \
  }

Definition at line 100 of file nsFontMetricsGTK.cpp.

#define GET_WEIGHT_INDEX (   index,
  weight 
)
Value:
do {                                  \
    (index) = WEIGHT_INDEX(weight);     \
    if ((index) < 0) {                  \
      (index) = 0;                      \
    }                                   \
    else if ((index) > 8) {             \
      (index) = 8;                      \
    }                                   \
  } while (0)

Definition at line 5037 of file nsFontMetricsGTK.cpp.

#define NOT_FOUND_FONT_SIZE   1000*1000*1000

Definition at line 3335 of file nsFontMetricsGTK.cpp.

#define REG_OK   (0)

Definition at line 89 of file nsFontMetricsGTK.cpp.

#define SAFE_CCMAP_HAS_CHAR_EXT (   ccmap,
  c 
)    ((ccmap) && ((IS_SURROGATE(c) && (ccmap)==gDoubleByteSpecialCharsCCMap) ? PR_FALSE : (CCMAP_HAS_CHAR_EXT(ccmap,c))))

Definition at line 80 of file nsFontMetricsGTK.cpp.

#define SKIP_FIELD (   var)
Value:
while ((*p) && ((*p) != '-')) { \
    p++;                          \
  }                               \
  if (*p) {                       \
    p++;                          \
  }                               \
  else {                          \
    continue;                     \
  }
#define USER_DEFINED   "x-user-def"

Definition at line 94 of file nsFontMetricsGTK.cpp.

Definition at line 1399 of file nsFontMetricsGTK.cpp.


Typedef Documentation


Function Documentation

static char* atomToName ( nsIAtom aAtom) [static]

Definition at line 860 of file nsFontMetricsGTK.cpp.

{
  const char *namePRU;
  aAtom->GetUTF8String(&namePRU);
  return ToNewCString(nsDependentCString(namePRU));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PR_BEGIN_EXTERN_C int CompareFontNames ( const void aArg1,
const void aArg2,
void aClosure 
) [static]

Definition at line 6669 of file nsFontMetricsGTK.cpp.

{
  const PRUnichar* str1 = *((const PRUnichar**) aArg1);
  const PRUnichar* str2 = *((const PRUnichar**) aArg2);

  // XXX add nsICollation stuff

  return nsCRT::strcmp(str1, str2);
}

Here is the caller graph for this function:

static PR_BEGIN_EXTERN_C int CompareSizes ( const void aArg1,
const void aArg2,
void data 
) [static]

Definition at line 4821 of file nsFontMetricsGTK.cpp.

{
  return (*((nsFontGTK**) aArg1))->mSize - (*((nsFontGTK**) aArg2))->mSize;
}

Here is the caller graph for this function:

DEFINE_CCMAP ( gDoubleByteSpecialCharsCCMap  )
static PRBool PR_CALLBACK do_BreakGetTextDimensions ( const nsFontSwitchGTK aFontSwitch,
const PRUnichar aSubstring,
PRUint32  aSubstringLength,
void aData 
) [static]

Definition at line 4347 of file nsFontMetricsGTK.cpp.

{
  nsFontGTK* fontGTK = aFontSwitch->mFontGTK;

  // Make sure the font is selected
  BreakGetTextDimensionsData* data = (BreakGetTextDimensionsData*)aData;

  // Our current state relative to the _full_ string...
  // This allows emulation of the previous code...
  const PRUnichar* pstr = (const PRUnichar*)data->mOffsets->ElementAt(0);
  PRInt32 numCharsFit = data->mNumCharsFit;
  nscoord width = data->mWidth;
  PRInt32 start = (PRInt32)(aSubstring - pstr);
  PRInt32 end = start + aSubstringLength;
  PRBool allDone = PR_FALSE;

  while (start < end) {
    // Estimate how many characters will fit. Do that by dividing the
    // available space by the average character width
    PRInt32 estimatedNumChars = data->mEstimatedNumChars;
    if (!estimatedNumChars && data->mAveCharWidth > 0) {
      estimatedNumChars = (data->mAvailWidth - width) / data->mAveCharWidth;
    }
    // Make sure the estimated number of characters is at least 1
    if (estimatedNumChars < 1) {
      estimatedNumChars = 1;
    }

    // Find the nearest break offset
    PRInt32 estimatedBreakOffset = start + estimatedNumChars;
    PRInt32 breakIndex = -1; // not yet computed
    PRBool  inMiddleOfSegment = PR_FALSE;
    nscoord numChars;

    // Avoid scanning the break array in the case where we think all
    // the text should fit
    if (end <= estimatedBreakOffset) {
      // Everything should fit
      numChars = end - start;
    }
    else {
      // Find the nearest place to break that is less than or equal to
      // the estimated break offset
      breakIndex = data->mPrevBreakState_BreakIndex;
      while (breakIndex + 1 < data->mNumBreaks &&
             data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
        ++breakIndex;
      }

      if (breakIndex == -1)
        breakIndex = 0;

      // We found a place to break that is before the estimated break
      // offset. Where we break depends on whether the text crosses a
      // segment boundary
      if (start < data->mBreaks[breakIndex]) {
        // The text crosses at least one segment boundary so measure to the
        // break point just before the estimated break offset
        numChars = PR_MIN(data->mBreaks[breakIndex], end) - start;
      } 
      else {
        // See whether there is another segment boundary between this one
        // and the end of the text
        if ((breakIndex < (data->mNumBreaks - 1)) && (data->mBreaks[breakIndex] < end)) {
          ++breakIndex;
          numChars = PR_MIN(data->mBreaks[breakIndex], end) - start;
        }
        else {
          NS_ASSERTION(end != data->mBreaks[breakIndex], "don't expect to be at segment boundary");

          // The text is all within the same segment
          numChars = end - start;

          // Remember we're in the middle of a segment and not between
          // two segments
          inMiddleOfSegment = PR_TRUE;
        }
      }
    }

    // Measure the text
    nscoord twWidth, pxWidth;
    if ((1 == numChars) && (pstr[start] == ' ')) {
      twWidth = data->mSpaceWidth;
    }
    else {
      pxWidth = fontGTK->GetWidth(&pstr[start], numChars);
      twWidth = NSToCoordRound(float(pxWidth) * data->mP2T);
    }

    // See if the text fits
    PRBool textFits = (twWidth + width) <= data->mAvailWidth;

    // If the text fits then update the width and the number of
    // characters that fit
    if (textFits) {
      numCharsFit += numChars;
      width += twWidth;

      // If we computed the break index and we're not in the middle
      // of a segment then this is a spot that we can back up to if
      // we need to, so remember this state
      if ((breakIndex != -1) && !inMiddleOfSegment) {
        data->mPrevBreakState_BreakIndex = breakIndex;
        data->mPrevBreakState_Width = width;
      }
    }
    else {
      // The text didn't fit. If we're out of room then we're all done
      allDone = PR_TRUE;

      // See if we can just back up to the previous saved state and not
      // have to measure any text
      if (data->mPrevBreakState_BreakIndex != -1) {
        PRBool canBackup;

        // If we're in the middle of a word then the break index
        // must be the same if we can use it. If we're at a segment
        // boundary, then if the saved state is for the previous
        // break index then we can use it
        if (inMiddleOfSegment) {
          canBackup = data->mPrevBreakState_BreakIndex == breakIndex;
        } else {
          canBackup = data->mPrevBreakState_BreakIndex == (breakIndex - 1);
        }

        if (canBackup) {
          numCharsFit = data->mBreaks[data->mPrevBreakState_BreakIndex];
          width = data->mPrevBreakState_Width;
          break;
        }
      }

      // We can't just revert to the previous break state. Find the break
      // index just before the end of the text
      end = start + numChars;
      breakIndex = 0;
      if (data->mBreaks[breakIndex] < end) {
        while ((breakIndex + 1 < data->mNumBreaks) && (data->mBreaks[breakIndex + 1] < end)) {
          ++breakIndex;
        }
      }

      if ((0 == breakIndex) && (end <= data->mBreaks[0])) {
        // There's no place to back up to, so even though the text doesn't fit
        // return it anyway
        numCharsFit += numChars;
        width += twWidth;

        // Edge case of one word: it could be that we just measured a fragment of the
        // first word and its remainder involves other fonts, so we want to keep going
        // until we at least measure the entire first word
        if (numCharsFit < data->mBreaks[0]) {
          allDone = PR_FALSE;         
          // From now on we don't care anymore what is the _real_ estimated
          // number of characters that fits. Rather, we have no where to break
          // and have to measure one word fully, but the real estimate is less
          // than that one word. However, since the other bits of code rely on
          // what is in "data->mEstimatedNumChars", we want to override
          // "data->mEstimatedNumChars" and pass in what _has_ to be measured
          // so that it is transparent to the other bits that depend on it.
          data->mEstimatedNumChars = data->mBreaks[0] - numCharsFit;
          start += numChars;
        }

        break;
      }

      // Repeatedly back up until we get to where the text fits or we're
      // all the way back to the first word
      width += twWidth;
      while ((breakIndex >= 0) && (width > data->mAvailWidth)) {
        start = data->mBreaks[breakIndex];
        numChars = end - start;
        numCharsFit = start;
        if ((1 == numChars) && (pstr[start] == ' ')) {
          width -= data->mSpaceWidth;
        }
        else if (pstr + start >= aSubstring) {
          // The entire fragment to chop is within the current font.
          pxWidth = fontGTK->GetWidth(&pstr[start], numChars);
          width -= NSToCoordRound(float(pxWidth) * data->mP2T);
        }
        else {
          // The fragment that we want to chop extends back into previous fonts.
          // We need to reverse into previous fonts. Fortunately,
          // data->mFonts[] and data->mOffsets[] tell us which fonts are used
          // and when. 
          end = data->mNumCharsFit; // same as aSubstring - pstr
          data->mNumCharsFit = numCharsFit; // has got shorter...
          PRInt32 k = data->mFonts->Count() - 1;
          for ( ; k >= 0 && start < end; --k, end -= numChars) {
            fontGTK = (nsFontGTK*)data->mFonts->ElementAt(k);
            const PRUnichar* ps = (const PRUnichar*)data->mOffsets->ElementAt(k);
            if (ps < pstr + start)
              ps = pstr + start;

            numChars = pstr + end - ps;
            NS_ASSERTION(numChars > 0, "empty string");

            pxWidth = fontGTK->GetWidth(ps, numChars);
            data->mWidth -= NSToCoordRound(float(pxWidth) * data->mP2T);

            // By construction, mFonts[k] is the last font, and
            // mOffsets[k+1] is the last offset.
            data->mFonts->RemoveElementAt(k);
            data->mOffsets->RemoveElementAt(k+1);
          }

          // We are done, update the data now because we won't do it later.
          // The |if (data->mNumCharsFit != numCharsFit)| won't apply below
          data->mFonts->AppendElement(fontGTK);
          data->mOffsets->AppendElement((void*)&pstr[numCharsFit]);
          break;
        }

        --breakIndex;
        end = start;
      }
    }

    start += numChars;
  }

#ifdef DEBUG_rbs
  NS_ASSERTION(allDone || start == end, "internal error");
  NS_ASSERTION(allDone || data->mNumCharsFit != numCharsFit, "internal error");
#endif /* DEBUG_rbs */

  if (data->mNumCharsFit != numCharsFit) {
    // some text was actually retained
    data->mWidth = width;
    data->mNumCharsFit = numCharsFit;
    data->mFonts->AppendElement(fontGTK);
    data->mOffsets->AppendElement((void*)&pstr[numCharsFit]);
  }

  if (allDone) {
    // stop now
    return PR_FALSE;
  }

  return PR_TRUE; // don't stop if we still need to measure more characters
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint DoubleByteConvert ( nsFontCharSetInfo aSelf,
XFontStruct *  aFont,
const PRUnichar aSrcBuf,
PRInt32  aSrcLen,
char *  aDestBuf,
PRInt32  aDestLen 
) [static]

Definition at line 2355 of file nsFontMetricsGTK.cpp.

{
  gint count;
  if (aSelf->mConverter) {
    aSelf->mConverter->Convert(aSrcBuf, &aSrcLen, aDestBuf, &aDestLen);
    count = aDestLen;
    if (count > 0) {
      if ((aDestBuf[0] & 0x80) && (!(aFont->max_byte1 & 0x80))) {
        for (PRInt32 i = 0; i < aDestLen; i++) {
          aDestBuf[i] &= 0x7F;
        }
      }
      // We're using a GL encoder (KSC5601 or GB2312) but the font is a GR font.
      // (ksc5601.1987-1 or gb2312.1980-1)
      else if ((!(aDestBuf[0] & 0x80)) && (aFont->min_byte1 & 0x80)) {
        for (PRInt32 i = 0; i < aDestLen; i++) {
          aDestBuf[i] |= 0x80;
        }
      }
    }
  }
  else {
    count = 0;
  }

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRIntn EnumerateNode ( void aElement,
void aData 
) [static]

Definition at line 6617 of file nsFontMetricsGTK.cpp.

{
  nsFontNode* node = (nsFontNode*) aElement;
  EnumerateNodeInfo* info = (EnumerateNodeInfo*) aData;
  if (info->mLangGroup != gUserDefined) {
    if (node->mCharSetInfo == &Unknown) {
      return PR_TRUE; // continue
    }
    else if (info->mLangGroup != gUnicode) {
      // if font's langGroup is different from requested langGroup, continue.
      // An exception is that font's langGroup ZHTWHK is regarded as matching
      // both ZHTW and ZHHK (Freetype2 and Solaris).
      if (node->mCharSetInfo->mLangGroup != info->mLangGroup &&
         (node->mCharSetInfo->mLangGroup != gZHTWHK || 
         (info->mLangGroup != gZHHK && info->mLangGroup != gZHTW))) {
        return PR_TRUE; // continue
      }
    }
    // else {
    //   if (lang == add-style-field) {
    //     consider it part of the lang group
    //   }
    //   else if (a Unicode font reports its lang group) {
    //     consider it part of the lang group
    //   }
    //   else if (lang's ranges in list of ranges) {
    //     consider it part of the lang group
    //     // Note: at present we have no way to do this test but we 
    //     // could in the future and this would be the place to enable
    //     // to make the font show up in the preferences dialog
    //   }
    // }

  }
  PRUnichar** array = info->mArray;
  int j = info->mIndex;
  PRUnichar* str = ToNewUnicode(node->mName);
  if (!str) {
    for (j = j - 1; j >= 0; j--) {
      nsMemory::Free(array[j]);
    }
    info->mIndex = 0;
    return PR_FALSE; // stop
  }
  array[j] = str;
  info->mIndex++;

  return PR_TRUE; // continue
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PR_END_EXTERN_C nsresult EnumFonts ( nsIAtom aLangGroup,
const char *  aGeneric,
PRUint32 aCount,
PRUnichar ***  aResult 
) [static]

Definition at line 6681 of file nsFontMetricsGTK.cpp.

{
  nsresult res = GetAllFontNames();
  if (NS_FAILED(res)) {
    return res;
  }

  PRUnichar** array =
    (PRUnichar**) nsMemory::Alloc(gGlobalList->Count() * sizeof(PRUnichar*));
  if (!array) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  EnumerateNodeInfo info = { array, 0, aLangGroup };
  if (!gGlobalList->EnumerateForwards(EnumerateNode, &info)) {
    nsMemory::Free(array);
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_QuickSort(array, info.mIndex, sizeof(PRUnichar*), CompareFontNames,
               nsnull);

  *aCount = info.mIndex;
  if (*aCount) {
    *aResult = array;
  }
  else {
    nsMemory::Free(array);
  }

  return NS_OK;
}

Here is the call graph for this function:

static void FFRESubstituteCharset ( nsACString &  aFFREName,
const char *  aReplacementCharset 
) [static]

Definition at line 5905 of file nsFontMetricsGTK.cpp.

{
  PRInt32 charsetHyphen = aFFREName.FindChar('-');
  charsetHyphen = aFFREName.FindChar('-', charsetHyphen + 1);
  aFFREName.Truncate(charsetHyphen+1);
  aFFREName.Append(aReplacementCharset);
}

Here is the caller graph for this function:

static void FFRESubstituteEncoding ( nsACString &  aFFREName,
const char *  aReplacementEncoding 
) [static]

Definition at line 5918 of file nsFontMetricsGTK.cpp.

{
  PRInt32 encodingHyphen;
  /* Search for the 3rd apperance of '-' */
  encodingHyphen = aFFREName.FindChar('-');
  encodingHyphen = aFFREName.FindChar('-', encodingHyphen + 1);
  encodingHyphen = aFFREName.FindChar('-', encodingHyphen + 1);
  aFFREName.Truncate(encodingHyphen+1);
  aFFREName.Append(aReplacementEncoding);
}

Here is the caller graph for this function:

static void FFREToXLFDPattern ( nsACString &  aFFREName,
nsACString &  oPattern 
) [static]

Definition at line 5888 of file nsFontMetricsGTK.cpp.

{
  PRInt32 charsetHyphen;

  oPattern.Append("-");
  oPattern.Append(aFFREName);
  /* Search for the 3rd appearance of '-' */
  charsetHyphen = oPattern.FindChar('-');
  charsetHyphen = oPattern.FindChar('-', charsetHyphen + 1);
  charsetHyphen = oPattern.FindChar('-', charsetHyphen + 1);
  oPattern.Insert("-*-*-*-*-*-*-*-*-*-*", charsetHyphen);
}

Here is the caller graph for this function:

static nsFontFamily* FindFamily ( nsCString aName) [static]

Definition at line 5794 of file nsFontMetricsGTK.cpp.

{
  nsCStringKey key(*aName);
  nsFontFamily* family = (nsFontFamily*) gFamilies->Get(&key);
  if (!family) {
    family = new nsFontFamily();
    if (family) {
      char pattern[256];
      PR_snprintf(pattern, sizeof(pattern), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
        aName->get());
      GetFontNames(pattern, PR_TRUE, gForceOutlineScaledFonts, &family->mNodes);
      gFamilies->Put(&key, family);
    }
  }

  return family;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool FontEnumCallback ( const nsString aFamily,
PRBool  aGeneric,
void aData 
) [static]

Definition at line 1570 of file nsFontMetricsGTK.cpp.

{
#ifdef REALLY_NOISY_FONTS
  printf("font = '");
  fputs(NS_LossyConvertUCS2toASCII(aFamily).get(), stdout);
  printf("'\n");
#endif

  if (!IsASCIIFontName(aFamily)) {
    return PR_TRUE; // skip and continue
  }

  nsCAutoString name;
  name.AssignWithConversion(aFamily.get());
  ToLowerCase(name);
  nsFontMetricsGTK* metrics = (nsFontMetricsGTK*) aData;
  metrics->mFonts.AppendCString(name);
  metrics->mFontIsGeneric.AppendElement((void*) aGeneric);
  if (aGeneric) {
    metrics->mGeneric = metrics->mFonts.CStringAt(metrics->mFonts.Count() - 1);
    return PR_FALSE; // stop
  }

  return PR_TRUE; // continue
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool FreeCharSetMap ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 881 of file nsFontMetricsGTK.cpp.

{
  nsFontCharSetMap* charsetMap = (nsFontCharSetMap*) aData;
  NS_IF_RELEASE(charsetMap->mInfo->mConverter);
  NS_IF_RELEASE(charsetMap->mInfo->mLangGroup);
  FreeCCMap(charsetMap->mInfo->mCCMap);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool FreeFamily ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 892 of file nsFontMetricsGTK.cpp.

{
  delete (nsFontFamily*) aData;

  return PR_TRUE;
}

Here is the caller graph for this function:

static void FreeGlobals ( void  ) [static]

Definition at line 978 of file nsFontMetricsGTK.cpp.

{
  // XXX complete this

  gInitialized = 0;

#ifdef MOZ_ENABLE_FREETYPE2
  nsFT2FontNode::FreeGlobals();
#endif

#ifdef ENABLE_X_FONT_BANNING
  if (gFontRejectRegEx) {
    regfree(gFontRejectRegEx);
    delete gFontRejectRegEx;
    gFontRejectRegEx = nsnull;
  }
  
  if (gFontAcceptRegEx) {
    regfree(gFontAcceptRegEx);
    delete gFontAcceptRegEx;
    gFontAcceptRegEx = nsnull;
  }  
#endif /* ENABLE_X_FONT_BANNING */

  nsXFontAAScaledBitmap::FreeGlobals();
  nsX11AlphaBlendFreeGlobals();

  if (gAliases) {
    delete gAliases;
    gAliases = nsnull;
  }
  NS_IF_RELEASE(gCharSetManager);
  if (gCharSetMaps) {
    gCharSetMaps->Reset(FreeCharSetMap, nsnull);
    delete gCharSetMaps;
    gCharSetMaps = nsnull;
  }
  if (gFamilies) {
    gFamilies->Reset(FreeFamily, nsnull);
    delete gFamilies;
    gFamilies = nsnull;
  }
  if (gGlobalList) {
    delete gGlobalList;
    gGlobalList = nsnull;
  }
  if (gCachedFFRESearches) {
    gCachedFFRESearches->Reset(FreeNodeArray, nsnull);
    delete gCachedFFRESearches;
    gCachedFFRESearches = nsnull;
  }
  if (gFFRENodes) {
    gFFRENodes->Reset(FreeNode, nsnull);
    delete gFFRENodes;
    gFFRENodes = nsnull;
  }
  if (gAFRENodes) {
    gAFRENodes->Reset(FreeNode, nsnull);
    delete gAFRENodes;
    gAFRENodes = nsnull;
  }
  NS_IF_RELEASE(gPref);
  if (gSpecialCharSets) {
    gSpecialCharSets->Reset(FreeCharSetMap, nsnull);
    delete gSpecialCharSets;
    gSpecialCharSets = nsnull;
  }
  if (gStretches) {
    delete gStretches;
    gStretches = nsnull;
  }
  NS_IF_RELEASE(gUnicode);
  NS_IF_RELEASE(gUserDefined);
  NS_IF_RELEASE(gZHTW);
  NS_IF_RELEASE(gZHHK);
  NS_IF_RELEASE(gZHTWHK);
  NS_IF_RELEASE(gUserDefinedConverter);
  NS_IF_RELEASE(gUsersLocale);
  NS_IF_RELEASE(gWesternLocale);
  NS_IF_RELEASE(gFontSubConverter);
  if (gWeights) {
    delete gWeights;
    gWeights = nsnull;
  }
  nsFontCharSetMap* charSetMap;
  for (charSetMap=gCharSetMap; charSetMap->mFontLangGroup; charSetMap++) {
    NS_IF_RELEASE(charSetMap->mFontLangGroup->mFontLangGroupAtom);
    charSetMap->mFontLangGroup->mFontLangGroupAtom = nsnull;
  }
  FreeCCMap(gUserDefinedCCMap);
  FreeCCMap(gEmptyCCMap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool FreeNode ( nsHashKey *  aKey,
void aData,
void aClosure 
)

Definition at line 950 of file nsFontMetricsGTK.cpp.

{
  nsFontNode* node = (nsFontNode*) aData;
  for (int i = 0; i < 3; i++) {
    if (node->mStyles[i]) {
      for (int j = i + 1; j < 3; j++) {
        if (node->mStyles[j] == node->mStyles[i]) {
          node->mStyles[j] = nsnull;
        }
      }
      FreeStyle(node->mStyles[i]);
    }
  }
  delete node;

  return PR_TRUE;
}

Here is the call graph for this function:

static PRBool FreeNodeArray ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 969 of file nsFontMetricsGTK.cpp.

{
  nsFontNodeArray* nodes = (nsFontNodeArray*) aData;
  delete nodes;

  return PR_TRUE;
}

Here is the caller graph for this function:

static void FreeStretch ( nsFontStretch aStretch) [static]

Definition at line 900 of file nsFontMetricsGTK.cpp.

{
  PR_smprintf_free(aStretch->mScalable);

  for (PRInt32 count = aStretch->mScaledFonts.Count()-1; count >= 0; --count) {
    nsFontGTK *font = (nsFontGTK*)aStretch->mScaledFonts.ElementAt(count);
    if (font) delete font;
  }
  // aStretch->mScaledFonts.Clear(); handled by delete of aStretch

  for (int i = 0; i < aStretch->mSizesCount; i++) {
    delete aStretch->mSizes[i];
  }
  delete [] aStretch->mSizes;
  delete aStretch;
}

Here is the caller graph for this function:

static void FreeStyle ( nsFontStyle aStyle) [static]

Definition at line 934 of file nsFontMetricsGTK.cpp.

{
  for (int i = 0; i < 9; i++) {
    if (aStyle->mWeights[i]) {
      for (int j = i + 1; j < 9; j++) {
        if (aStyle->mWeights[j] == aStyle->mWeights[i]) {
          aStyle->mWeights[j] = nsnull;
        }
      }
      FreeWeight(aStyle->mWeights[i]);
    }
  }
  delete aStyle;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void FreeWeight ( nsFontWeight aWeight) [static]

Definition at line 918 of file nsFontMetricsGTK.cpp.

{
  for (int i = 0; i < 9; i++) {
    if (aWeight->mStretches[i]) {
      for (int j = i + 1; j < 9; j++) {
        if (aWeight->mStretches[j] == aWeight->mStretches[i]) {
          aWeight->mStretches[j] = nsnull;
        }
      }
      FreeStretch(aWeight->mStretches[i]);
    }
  }
  delete aWeight;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult GetAllFontNames ( void  ) [static]

Definition at line 5776 of file nsFontMetricsGTK.cpp.

{
  if (!gGlobalList) {
    // This may well expand further (families * sizes * styles?), but it's
    // only created once.
    gGlobalList = new nsFontNodeArray;
    if (!gGlobalList) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
    /* Using "-*" instead of the full-qualified "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
     * because it's faster and "smarter" - see bug 34242 for details. */
    GetFontNames("-*", PR_FALSE, PR_FALSE, gGlobalList);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsFontCharSetMap* GetCharSetMap ( const char *  aCharSetName)

Definition at line 6780 of file nsFontMetricsGTK.cpp.

{
    nsCStringKey charSetKey(aCharSetName);
    nsFontCharSetMap* charSetMap =
      (nsFontCharSetMap*) gCharSetMaps->Get(&charSetKey);
    if (!charSetMap)
      charSetMap = gNoneCharSetMap;
  return charSetMap;
}

Here is the caller graph for this function:

static void GetFontNames ( const char *  aPattern,
PRBool  aAnyFoundry,
PRBool  aOnlyOutlineScaledFonts,
nsFontNodeArray aNodes 
) [static]

Definition at line 5406 of file nsFontMetricsGTK.cpp.

{
#ifdef NS_FONT_DEBUG_CALL_TRACE
  if (gFontDebug & NS_FONT_DEBUG_CALL_TRACE) {
    printf("GetFontNames %s\n", aPattern);
  }
#endif

#ifdef MOZ_ENABLE_FREETYPE2
  // get FreeType fonts
  nsFT2FontNode::GetFontNames(aPattern, aNodes);
#endif

  nsCAutoString previousNodeName;
  nsHashtable* node_hash;
  if (aAnyFoundry) {
    NS_ASSERTION(aPattern[1] == '*', "invalid 'anyFoundry' pattern");
    node_hash = gAFRENodes;
  }
  else {
    node_hash = gFFRENodes;
  }
  
#ifdef ENABLE_X_FONT_BANNING
  int  screen_xres,
       screen_yres;
  /* Get Xserver DPI. 
   * We cannot use Mozilla's API here because it may "override" the DPI
   * got from the Xserver via prefs. But we want to filter ("ban") fonts
   * we get from the Xserver which _it_(=Xserver) has "choosen" for us
   * using its DPI value ...
   */
  screen_xres = int((float(::gdk_screen_width())  / (float(::gdk_screen_width_mm())  / 25.4f)) + 0.5f);
  screen_yres = int((float(::gdk_screen_height()) / (float(::gdk_screen_height_mm()) / 25.4f)) + 0.5f);
#endif /* ENABLE_X_FONT_BANNING */
      
  BANNED_FONT_PRINTF(("Loading font '%s'", aPattern));
  /*
   * We do not use XListFontsWithInfo here, because it is very expensive.
   * Instead, we get that info at the time when we actually load the font.
   */
  int count;
  char** list = ::XListFonts(GDK_DISPLAY(), aPattern, INT_MAX, &count);
  if ((!list) || (count < 1)) {
    return;
  }
  for (int i = 0; i < count; i++) {
    char name[256]; /* X11 font names are never larger than 255 chars */
    strcpy(name, list[i]);
 
    /* Check if we can handle the font name ('*' and '?' are only valid in
     * input patterns passed as argument to |XListFont()|&co. but _not_ in
     * font names returned by these functions (see bug 136743 ("xlib complains
     * a lot about fonts with '*' in the XLFD string"))) */
    if ((!name) || (name[0] != '-') || (PL_strpbrk(name, "*?") != nsnull)) {
      continue;
    }
    
    char buf[512];
    PL_strncpyz(buf, name, sizeof(buf));
    char *fName = buf;
    char* p = name + 1;
    int scalable = 0;
    PRBool outline_scaled = PR_FALSE;
    int    resX = -1,
           resY = -1;

#ifdef FIND_FIELD
#undef FIND_FIELD
#endif
#define FIND_FIELD(var)           \
  char* var = p;                  \
  while ((*p) && ((*p) != '-')) { \
    p++;                          \
  }                               \
  if (*p) {                       \
    *p++ = 0;                     \
  }                               \
  else {                          \
    continue;                     \
  }

#ifdef SKIP_FIELD
#undef SKIP_FIELD
#endif
#define SKIP_FIELD(var)           \
  while ((*p) && ((*p) != '-')) { \
    p++;                          \
  }                               \
  if (*p) {                       \
    p++;                          \
  }                               \
  else {                          \
    continue;                     \
  }

    FIND_FIELD(foundry);
    // XXX What to do about the many Applix fonts that start with "ax"?
    FIND_FIELD(familyName);
    FIND_FIELD(weightName);
    FIND_FIELD(slant);
    FIND_FIELD(setWidth);
    FIND_FIELD(addStyle);
    FIND_FIELD(pixelSize);
    if (pixelSize[0] == '0') {
      scalable = 1;
    }
    FIND_FIELD(pointSize);
    if (pointSize[0] == '0') {
      scalable = 1;
    }
    FIND_FIELD(resolutionX);
    resX = atoi(resolutionX);
    NS_ASSERTION(!(resolutionX[0] != '0' && resX == 0), "atoi(resolutionX) failure.");
    if (resolutionX[0] == '0') {
      scalable = 1;
    }
    FIND_FIELD(resolutionY);
    resY = atoi(resolutionY);
    NS_ASSERTION(!(resolutionY[0] != '0' && resY == 0), "atoi(resolutionY) failure.");
    if (resolutionY[0] == '0') {
      scalable = 1;
    }
    // check if bitmap non-scaled font
    if ((pixelSize[0] != '0') || (pointSize[0] != '0')) {
      SCALED_FONT_PRINTF(("bitmap (non-scaled) font: %s", fName));
    }
    // check if bitmap scaled font
    else if ((pixelSize[0] == '0') && (pointSize[0] == '0')
          && (resolutionX[0] != '0') && (resolutionY[0] != '0')) {
      SCALED_FONT_PRINTF(("bitmap scaled font: %s", fName));
    }
    // check if outline scaled font
    else if ((pixelSize[0] == '0') && (pointSize[0] == '0')
          && (resolutionX[0] == '0') && (resolutionY[0] == '0')) {
      outline_scaled = PR_TRUE;
      SCALED_FONT_PRINTF(("outline scaled font: %s", fName));
    }
    else {
      SCALED_FONT_PRINTF(("unexpected font values: %s", fName));
      SCALED_FONT_PRINTF(("      pixelSize[0] = %c", pixelSize[0]));
      SCALED_FONT_PRINTF(("      pointSize[0] = %c", pointSize[0]));
      SCALED_FONT_PRINTF(("    resolutionX[0] = %c", resolutionX[0]));
      SCALED_FONT_PRINTF(("    resolutionY[0] = %c", resolutionY[0]));
      static PRBool already_complained = PR_FALSE;
      // only complaing once 
      if (!already_complained) {
        already_complained = PR_TRUE;
        NS_ASSERTION(pixelSize[0] == '0', "font scaler type test failed");
        NS_ASSERTION(pointSize[0] == '0', "font scaler type test failed");
        NS_ASSERTION(resolutionX[0] == '0', "font scaler type test failed");
        NS_ASSERTION(resolutionY[0] == '0', "font scaler type test failed");
      }
    }
    FIND_FIELD(spacing);
    FIND_FIELD(averageWidth);
    if (averageWidth[0] == '0') {
      scalable = 1;
/* Workaround for bug 103159 ("sorting fonts by foundry names cause font
 * size of css ignored in some cases").
 * Hardcoded font ban until bug 104075 ("need X font banning") has been
 * implemented. See http://bugzilla.mozilla.org/show_bug.cgi?id=94327#c34
 * for additional comments...
 */      
#ifndef DISABLE_WORKAROUND_FOR_BUG_103159
      // skip 'mysterious' and 'spurious' cases like
      // -adobe-times-medium-r-normal--17-120-100-100-p-0-iso8859-9
      if ((pixelSize[0] != '0' || pointSize[0] != 0) && 
          (outline_scaled == PR_FALSE)) {
        PR_LOG(FontMetricsGTKLM, PR_LOG_DEBUG, ("rejecting font '%s' (via hardcoded workaround for bug 103159)\n", list[i]));
        BANNED_FONT_PRINTF(("rejecting font '%s' (via hardcoded workaround for bug 103159)", list[i]));          
        continue;
      }  
#endif /* DISABLE_WORKAROUND_FOR_BUG_103159 */
    }
    char* charSetName = p; // CHARSET_REGISTRY & CHARSET_ENCODING
    if (!*charSetName) {
      continue;
    }
    
    if (aOnlyOutlineScaledFonts && (outline_scaled == PR_FALSE)) {
      continue;
    }

#ifdef ENABLE_X_FONT_BANNING
#define BOOL2STR(b) ((b)?("true"):("false"))    
    if (gFontRejectRegEx || gFontAcceptRegEx) {
      char fmatchbuf[512]; /* See sprintf() below. */
           
      sprintf(fmatchbuf, "fname=%s;scalable=%s;outline_scaled=%s;xdisplay=%s;xdpy=%d;ydpy=%d;xdevice=%s",
              list[i], /* full font name */
              BOOL2STR(scalable), 
              BOOL2STR(outline_scaled),
              XDisplayString(GDK_DISPLAY()),
              screen_xres,
              screen_yres,
              "display" /* Xlib gfx supports other devices like "printer", too - DO NOT REMOVE! */
              );
#undef BOOL2STR
                  
      if (gFontRejectRegEx) {
        /* reject font if reject pattern matches it... */        
        if (regexec(gFontRejectRegEx, fmatchbuf, 0, nsnull, 0) == REG_OK) {
          PR_LOG(FontMetricsGTKLM, PR_LOG_DEBUG, ("rejecting font '%s' (via reject pattern)\n", fmatchbuf));
          BANNED_FONT_PRINTF(("rejecting font '%s' (via reject pattern)", fmatchbuf));
          continue;
        }  
      }

      if (gFontAcceptRegEx) {
        if (regexec(gFontAcceptRegEx, fmatchbuf, 0, nsnull, 0) == REG_NOMATCH) {
          PR_LOG(FontMetricsGTKLM, PR_LOG_DEBUG, ("rejecting font '%s' (via accept pattern)\n", fmatchbuf));
          BANNED_FONT_PRINTF(("rejecting font '%s' (via accept pattern)", fmatchbuf));
          continue;
        }
      }       
    }    
#endif /* ENABLE_X_FONT_BANNING */    

    nsFontCharSetMap *charSetMap = GetCharSetMap(charSetName);
    nsFontCharSetInfo* charSetInfo = charSetMap->mInfo;
    // indirection for font specific charset encoding 
    if (charSetInfo == &Special) {
      nsCAutoString familyCharSetName(familyName);
      familyCharSetName.Append('-');
      familyCharSetName.Append(charSetName);
      nsCStringKey familyCharSetKey(familyCharSetName);
      charSetMap = NS_STATIC_CAST(nsFontCharSetMap*, gSpecialCharSets->Get(&familyCharSetKey));
      if (!charSetMap)
        charSetMap = gNoneCharSetMap;
      charSetInfo = charSetMap->mInfo;
    }
    if (!charSetInfo) {
#ifdef NOISY_FONTS
      printf("cannot find charset %s\n", charSetName);
#endif
      charSetInfo = &Unknown;
    }
    SetCharsetLangGroup(charSetInfo);
    SetFontLangGroupInfo(charSetMap);

    nsCAutoString nodeName;
    if (aAnyFoundry)
      nodeName.Assign('*');
    else
      nodeName.Assign(foundry);
    nodeName.Append('-');
    nodeName.Append(familyName);
    nodeName.Append('-');
    nodeName.Append(charSetName);
    nsCStringKey key(nodeName);
    nsFontNode* node = (nsFontNode*) node_hash->Get(&key);
    if (!node) {
      node = new nsFontNode;
      if (!node) {
        continue;
      }
      node_hash->Put(&key, node);
      node->mName = nodeName;
      node->mCharSetInfo = charSetInfo;
    }

    int found = 0;
    if (nodeName == previousNodeName) {
      found = 1;
    }
    else {
      found = (aNodes->IndexOf(node) >= 0);
    }
    previousNodeName = nodeName;
    if (!found) {
      aNodes->AppendElement(node);
    }

    int styleIndex;
    // XXX This does not cover the full XLFD spec for SLANT.
    switch (slant[0]) {
    case 'i':
      styleIndex = NS_FONT_STYLE_ITALIC;
      break;
    case 'o':
      styleIndex = NS_FONT_STYLE_OBLIQUE;
      break;
    case 'r':
    default:
      styleIndex = NS_FONT_STYLE_NORMAL;
      break;
    }
    nsFontStyle* style = NodeGetStyle(node, styleIndex);
    if (!style)
      continue;

    nsCStringKey weightKey(weightName);
    int weightNumber = NS_PTR_TO_INT32(gWeights->Get(&weightKey));
    if (!weightNumber) {
#ifdef NOISY_FONTS
      printf("cannot find weight %s\n", weightName);
#endif
      weightNumber = NS_FONT_WEIGHT_NORMAL;
    }
    int weightIndex = WEIGHT_INDEX(weightNumber);
    nsFontWeight* weight = NodeGetWeight(style, weightIndex);
    if (!weight)
      continue;
  
    nsCStringKey setWidthKey(setWidth);
    int stretchIndex = NS_PTR_TO_INT32(gStretches->Get(&setWidthKey));
    if (!stretchIndex) {
#ifdef NOISY_FONTS
      printf("cannot find stretch %s\n", setWidth);
#endif
      stretchIndex = 5;
    }
    stretchIndex--;
    nsFontStretch* stretch = NodeGetStretch(weight, stretchIndex);
    if (!stretch)
      continue;

    if (scalable) {
      if (!NodeAddScalable(stretch, outline_scaled, name, familyName, 
           weightName, slant, setWidth, addStyle, spacing, charSetName))
        continue;
    }
  
     // get pixel size before the string is changed
    int pixels,
        points;

    pixels = atoi(pixelSize);
    points = atoi(pointSize);

    if (pixels) {
      if (gScaleBitmapFontsWithDevScale && (gDevScale > 1.0f)) {
        /* Add a font size which is exactly scaled as the scaling factor ... */
        if (!NodeAddSize(stretch, pixels, points, gDevScale, resX, resY, name, familyName, weightName, 
                         slant, setWidth, addStyle, spacing, charSetName, charSetInfo))
          continue;

        /* ... and offer a range of scaled fonts with integer scaling factors
         * (we're taking half steps between integers, too - to avoid too big
         * steps between font sizes) */
        float minScaler = PR_MAX(gDevScale / 2.0f, 1.5f),
              maxScaler = gDevScale * 2.f,
              scaler;
        for( scaler = minScaler ; scaler <= maxScaler ; scaler += 0.5f )
        {
          if (!NodeAddSize(stretch, pixels, points, scaler, resX, resY, name, familyName, weightName, 
                           slant, setWidth, addStyle, spacing, charSetName, charSetInfo))
            break;
        }
        if (scaler <= maxScaler) {
          continue; /* |NodeAddSize| returned an error in the loop above... */
        }
      }
      else
      {
        if (!NodeAddSize(stretch, pixels, points, 1.0f, resX, resY, name, familyName, weightName, 
                         slant, setWidth, addStyle, spacing, charSetName, charSetInfo))
          continue;     
      }
    }
  }
  XFreeFontNames(list);

#ifdef DEBUG_DUMP_TREE
  DumpTree();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRUint16* GetMapFor10646Font ( XFontStruct *  aFont) [static]

Definition at line 2613 of file nsFontMetricsGTK.cpp.

{
  if (!aFont->per_char)
    return nsnull;

  nsCompressedCharMap ccmapObj;
  PRInt32 minByte1 = aFont->min_byte1;
  PRInt32 maxByte1 = aFont->max_byte1;
  PRInt32 minByte2 = aFont->min_char_or_byte2;
  PRInt32 maxByte2 = aFont->max_char_or_byte2;
  PRInt32 charsPerRow = maxByte2 - minByte2 + 1;
  for (PRInt32 row = minByte1; row <= maxByte1; row++) {
    PRInt32 offset = (((row - minByte1) * charsPerRow) - minByte2);
    for (PRInt32 cell = minByte2; cell <= maxByte2; cell++) {
      XCharStruct* bounds = &aFont->per_char[offset + cell];
      // From Section 8.5 Font Metrics in the Xlib programming manual:
      // A nonexistent character is represented with all members of its XCharStruct set to zero. 
      if (bounds->ascent ||
          bounds->descent ||
          bounds->lbearing ||
          bounds->rbearing ||
          bounds->width ||
          bounds->attributes) {
        ccmapObj.SetChar((row << 8) | cell);
      }
    }
  }
  PRUint16 *ccmap = ccmapObj.NewCCMap();
  return ccmap;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult InitGlobals ( nsIDeviceContext aDevice) [static]

Definition at line 1075 of file nsFontMetricsGTK.cpp.

{
#ifdef NS_FONT_DEBUG
  /* First check gfx/src/gtk/-specific env var "NS_FONT_DEBUG_GTK",
   * then the more general "NS_FONT_DEBUG" if "NS_FONT_DEBUG_GTK"
   * is not present */
  const char *debug = PR_GetEnv("NS_FONT_DEBUG_GTK");
  if (!debug) {
    debug = PR_GetEnv("NS_FONT_DEBUG");
  }
  
  if (debug) {
    PR_sscanf(debug, "%lX", &gFontDebug);
  }
#endif /* NS_FONT_DEBUG */

  NS_ENSURE_TRUE(nsnull != aDevice, NS_ERROR_NULL_POINTER);

  aDevice->GetCanonicalPixelScale(gDevScale);

  CallGetService(kCharSetManagerCID, &gCharSetManager);
  if (!gCharSetManager) {
    FreeGlobals();
    return NS_ERROR_FAILURE;
  }
  CallGetService(kPrefCID, &gPref);
  if (!gPref) {
    FreeGlobals();
    return NS_ERROR_FAILURE;
  }

  nsCompressedCharMap empty_ccmapObj;
  gEmptyCCMap = empty_ccmapObj.NewCCMap();
  if (!gEmptyCCMap)
    return NS_ERROR_OUT_OF_MEMORY;

  // get the "disable double byte font special chars" setting
  PRBool val = PR_TRUE;
  nsresult rv = gPref->GetBoolPref("font.allow_double_byte_special_chars", &val);
  if (NS_SUCCEEDED(rv))
    gAllowDoubleByteSpecialChars = val;

  PRInt32 scale_minimum = 0;
  rv = gPref->GetIntPref("font.scale.outline.min", &scale_minimum);
  if (NS_SUCCEEDED(rv)) {
    gOutlineScaleMinimum = scale_minimum;
    SIZE_FONT_PRINTF(("gOutlineScaleMinimum = %d", gOutlineScaleMinimum));
  }

  val = PR_TRUE;
  rv = gPref->GetBoolPref("font.scale.aa_bitmap.enable", &val);
  if (NS_SUCCEEDED(rv)) {
    gAABitmapScaleEnabled = val;
    SIZE_FONT_PRINTF(("gAABitmapScaleEnabled = %d", gAABitmapScaleEnabled));
  }

  val = PR_FALSE;
  rv = gPref->GetBoolPref("font.scale.aa_bitmap.always", &val);
  if (NS_SUCCEEDED(rv)) {
    gAABitmapScaleAlways = val;
    SIZE_FONT_PRINTF(("gAABitmapScaleAlways = %d", gAABitmapScaleAlways));
  }

  rv = gPref->GetIntPref("font.scale.aa_bitmap.min", &scale_minimum);
  if (NS_SUCCEEDED(rv)) {
    gAABitmapScaleMinimum = scale_minimum;
    SIZE_FONT_PRINTF(("gAABitmapScaleMinimum = %d", gAABitmapScaleMinimum));
  }

  PRInt32 percent = 0;
  rv = gPref->GetIntPref("font.scale.aa_bitmap.undersize", &percent);
  if ((NS_SUCCEEDED(rv)) && (percent)) {
    gAABitmapUndersize = percent/100.0;
    SIZE_FONT_PRINTF(("gAABitmapUndersize = %g", gAABitmapUndersize));
  }
  percent = 0;
  rv = gPref->GetIntPref("font.scale.aa_bitmap.oversize", &percent);
  if ((NS_SUCCEEDED(rv)) && (percent)) {
    gAABitmapOversize = percent/100.0;
    SIZE_FONT_PRINTF(("gAABitmapOversize = %g", gAABitmapOversize));
  }
  PRInt32 int_val = 0;
  rv = gPref->GetIntPref("font.scale.aa_bitmap.dark_text.min", &int_val);
  if (NS_SUCCEEDED(rv)) {
    gAASBDarkTextMinValue = int_val;
    SIZE_FONT_PRINTF(("gAASBDarkTextMinValue = %d", gAASBDarkTextMinValue));
  }
  nsXPIDLCString str;
  rv = gPref->GetCharPref("font.scale.aa_bitmap.dark_text.gain",
                           getter_Copies(str));
  if (NS_SUCCEEDED(rv)) {
    gAASBDarkTextGain = atof(str.get());
    SIZE_FONT_PRINTF(("gAASBDarkTextGain = %g", gAASBDarkTextGain));
  }
  int_val = 0;
  rv = gPref->GetIntPref("font.scale.aa_bitmap.light_text.min", &int_val);
  if (NS_SUCCEEDED(rv)) {
    gAASBLightTextMinValue = int_val;
    SIZE_FONT_PRINTF(("gAASBLightTextMinValue = %d", gAASBLightTextMinValue));
  }
  rv = gPref->GetCharPref("font.scale.aa_bitmap.light_text.gain",
                           getter_Copies(str));
  if (NS_SUCCEEDED(rv)) {
    gAASBLightTextGain = atof(str.get());
    SIZE_FONT_PRINTF(("gAASBLightTextGain = %g", gAASBLightTextGain));
  }

  rv = gPref->GetIntPref("font.scale.bitmap.min", &scale_minimum);
  if (NS_SUCCEEDED(rv)) {
    gBitmapScaleMinimum = scale_minimum;
    SIZE_FONT_PRINTF(("gBitmapScaleMinimum = %d", gBitmapScaleMinimum));
  }
  percent = 0;
  gPref->GetIntPref("font.scale.bitmap.oversize", &percent);
  if (percent) {
    gBitmapOversize = percent/100.0;
    SIZE_FONT_PRINTF(("gBitmapOversize = %g", gBitmapOversize));
  }
  percent = 0;
  gPref->GetIntPref("font.scale.bitmap.undersize", &percent);
  if (percent) {
    gBitmapUndersize = percent/100.0;
    SIZE_FONT_PRINTF(("gBitmapUndersize = %g", gBitmapUndersize));
  }

  PRBool force_outline_scaled_fonts = gForceOutlineScaledFonts;
  rv = gPref->GetBoolPref("font.x11.force_outline_scaled_fonts", &force_outline_scaled_fonts);
  if (NS_SUCCEEDED(rv)) {
    gForceOutlineScaledFonts = force_outline_scaled_fonts;
  }
  
  PRBool scale_bitmap_fonts_with_devscale = gScaleBitmapFontsWithDevScale;

  rv = gPref->GetBoolPref("font.x11.scale_bitmap_fonts_with_devscale", &scale_bitmap_fonts_with_devscale);
  if (NS_SUCCEEDED(rv)) {
    gScaleBitmapFontsWithDevScale = scale_bitmap_fonts_with_devscale;
  }

  gFFRENodes = new nsHashtable();
  if (!gFFRENodes) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gAFRENodes = new nsHashtable();
  if (!gAFRENodes) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gCachedFFRESearches = new nsHashtable();
  if (!gCachedFFRESearches) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gFamilies = new nsHashtable();
  if (!gFamilies) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gAliases = new nsHashtable();
  if (!gAliases) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsFontFamilyName* f = gFamilyNameTable;
  while (f->mName) {
    nsCStringKey key(f->mName);
    gAliases->Put(&key, (void *)f->mXName);
    f++;
  }
  gWeights = new nsHashtable();
  if (!gWeights) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsFontPropertyName* p = gWeightNames;
  while (p->mName) {
    nsCStringKey key(p->mName);
    gWeights->Put(&key, (void*) p->mValue);
    p++;
  }
  gStretches = new nsHashtable();
  if (!gStretches) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  p = gStretchNames;
  while (p->mName) {
    nsCStringKey key(p->mName);
    gStretches->Put(&key, (void*) p->mValue);
    p++;
  }
  gCharSetMaps = new nsHashtable();
  if (!gCharSetMaps) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsFontCharSetMap* charSetMap = gCharSetMap;
  while (charSetMap->mName) {
    nsCStringKey key(charSetMap->mName);
    gCharSetMaps->Put(&key, charSetMap);
    charSetMap++;
  }
  gSpecialCharSets = new nsHashtable();
  if (!gSpecialCharSets) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsFontCharSetMap* specialCharSetMap = gSpecialCharSetMap;
  while (specialCharSetMap->mName) {
    nsCStringKey key(specialCharSetMap->mName);
    gSpecialCharSets->Put(&key, specialCharSetMap);
    specialCharSetMap++;
  }

  gUnicode = NS_NewAtom("x-unicode");
  if (!gUnicode) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gUserDefined = NS_NewAtom(USER_DEFINED);
  if (!gUserDefined) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gZHTW = NS_NewAtom("zh-TW");
  if (!gZHTW) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gZHHK = NS_NewAtom("zh-HK");
  if (!gZHHK) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
  gZHTWHK = NS_NewAtom("x-zh-TWHK");
  if (!gZHTWHK) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }

  // the user's locale
  nsCOMPtr<nsILanguageAtomService> langService;
  langService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID);
  if (langService) {
    NS_IF_ADDREF(gUsersLocale = langService->GetLocaleLanguageGroup());
  }
  if (!gUsersLocale) {
    gUsersLocale = NS_NewAtom("x-western");
  }
  gWesternLocale = NS_NewAtom("x-western");
  if (!gUsersLocale) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }

  rv = nsX11AlphaBlendInitGlobals(GDK_DISPLAY());
  if (NS_FAILED(rv) || (!nsX11AlphaBlend::CanAntiAlias())) {
    gAABitmapScaleEnabled = PR_FALSE;
  }

  if (gAABitmapScaleEnabled) {
      gAABitmapScaleEnabled = nsXFontAAScaledBitmap::InitGlobals(GDK_DISPLAY(),
                                     DefaultScreen(GDK_DISPLAY()));
  }
  
#ifdef ENABLE_X_FONT_BANNING
  /* get the font banning pattern */
  nsXPIDLCString fbpattern;
  rv = gPref->GetCharPref("font.x11.rejectfontpattern", getter_Copies(fbpattern));
  if (NS_SUCCEEDED(rv)) {
    gFontRejectRegEx = new regex_t;
    if (!gFontRejectRegEx) {
      FreeGlobals();
      return NS_ERROR_OUT_OF_MEMORY;
    }
    
    /* Compile the pattern - and return an error if we get an invalid pattern... */
    if (regcomp(gFontRejectRegEx, fbpattern.get(), REG_EXTENDED|REG_NOSUB) != REG_OK) {
      PR_LOG(FontMetricsGTKLM, PR_LOG_DEBUG, ("Invalid rejectfontpattern '%s'\n", fbpattern.get()));
      BANNED_FONT_PRINTF(("Invalid font.x11.rejectfontpattern '%s'", fbpattern.get()));
      delete gFontRejectRegEx;
      gFontRejectRegEx = nsnull;
      
      FreeGlobals();
      return NS_ERROR_INVALID_ARG;
    }    
  }

  rv = gPref->GetCharPref("font.x11.acceptfontpattern", getter_Copies(fbpattern));
  if (NS_SUCCEEDED(rv)) {
    gFontAcceptRegEx = new regex_t;
    if (!gFontAcceptRegEx) {
      FreeGlobals();
      return NS_ERROR_OUT_OF_MEMORY;
    }
    
    /* Compile the pattern - and return an error if we get an invalid pattern... */
    if (regcomp(gFontAcceptRegEx, fbpattern.get(), REG_EXTENDED|REG_NOSUB) != REG_OK) {
      PR_LOG(FontMetricsGTKLM, PR_LOG_DEBUG, ("Invalid acceptfontpattern '%s'\n", fbpattern.get()));
      BANNED_FONT_PRINTF(("Invalid font.x11.acceptfontpattern '%s'", fbpattern.get()));
      delete gFontAcceptRegEx;
      gFontAcceptRegEx = nsnull;
      
      FreeGlobals();
      return NS_ERROR_INVALID_ARG;
    }    
  }
#endif /* ENABLE_X_FONT_BANNING */

#ifdef MOZ_ENABLE_FREETYPE2
  rv = nsFT2FontNode::InitGlobals();
  if (NS_FAILED(rv)) {
    FreeGlobals();
    return NS_ERROR_OUT_OF_MEMORY;
  }
#endif

  gInitialized = 1;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsASCIIFontName ( const nsString aName) [static]

Definition at line 1553 of file nsFontMetricsGTK.cpp.

{
  PRUint32 len = aName.Length();
  const PRUnichar* str = aName.get();
  for (PRUint32 i = 0; i < len; i++) {
    /*
     * X font names are printable ASCII, ignore others (for now)
     */
    if ((str[i] < 0x20) || (str[i] > 0x7E)) {
      return PR_FALSE;
    }
  }

  return PR_TRUE;
}

Here is the caller graph for this function:

static gint ISO10646Convert ( nsFontCharSetInfo aSelf,
XFontStruct *  aFont,
const PRUnichar aSrcBuf,
PRInt32  aSrcLen,
char *  aDestBuf,
PRInt32  aDestLen 
) [static]

Definition at line 2385 of file nsFontMetricsGTK.cpp.

{
  aDestLen /= 2;
  if (aSrcLen > aDestLen) {
    aSrcLen = aDestLen;
  }
  if (aSrcLen < 0) {
    aSrcLen = 0;
  }
  XChar2b* dest = (XChar2b*) aDestBuf;
  for (PRInt32 i = 0; i < aSrcLen; i++) {
    dest[i].byte1 = (aSrcBuf[i] >> 8);
    dest[i].byte2 = (aSrcBuf[i] & 0xFF);
  }

  return (gint) aSrcLen * 2;
}
static PRBool NodeAddScalable ( nsFontStretch aStretch,
PRBool  aOutlineScaled,
const char *  aDashFoundry,
const char *  aFamily,
const char *  aWeight,
const char *  aSlant,
const char *  aWidth,
const char *  aStyle,
const char *  aSpacing,
const char *  aCharSet 
) [static]

Definition at line 5305 of file nsFontMetricsGTK.cpp.

{
  // if we have both an outline scaled font and a bitmap 
  // scaled font pick the outline scaled font
  if ((aStretch->mScalable) && (!aStretch->mOutlineScaled) 
      && (aOutlineScaled)) {
    PR_smprintf_free(aStretch->mScalable);
    aStretch->mScalable = nsnull;
  }
  if (!aStretch->mScalable) {
    aStretch->mOutlineScaled = aOutlineScaled;
    if (aOutlineScaled) {
      aStretch->mScalable = 
          PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-0-0-%s-*-%s", 
          aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle, 
          aSpacing, aCharSet);
      if (!aStretch->mScalable)
        return PR_FALSE;
    }
    else {
      aStretch->mScalable = 
          PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-*-*-%s-*-%s", 
          aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle, 
          aSpacing, aCharSet);
      if (!aStretch->mScalable)
        return PR_FALSE;
    }
  }
  return PR_TRUE;
}

Here is the caller graph for this function:

static PRBool NodeAddSize ( nsFontStretch aStretch,
int  aPixelSize,
int  aPointSize,
float  scaler,
int  aResX,
int  aResY,
const char *  aDashFoundry,
const char *  aFamily,
const char *  aWeight,
const char *  aSlant,
const char *  aWidth,
const char *  aStyle,
const char *  aSpacing,
const char *  aCharSet,
nsFontCharSetInfo aCharSetInfo 
) [static]

Definition at line 5341 of file nsFontMetricsGTK.cpp.

{
  if (scaler!=1.0f)
  {
    aPixelSize = int(float(aPixelSize) * scaler);
    aPointSize = int(float(aPointSize) * scaler);
    aResX = 0;
    aResY = 0;
  }

  PRBool haveSize = PR_FALSE;
  if (aStretch->mSizesCount) {
    nsFontGTK** end = &aStretch->mSizes[aStretch->mSizesCount];
    nsFontGTK** s;
    for (s = aStretch->mSizes; s < end; s++) {
      if ((*s)->mSize == aPixelSize) {
        haveSize = PR_TRUE;
        break;
      }
    }
  }
  if (!haveSize) {
    if (aStretch->mSizesCount == aStretch->mSizesAlloc) {
      int newSize = 2 * (aStretch->mSizesAlloc ? aStretch->mSizesAlloc : 1);
      nsFontGTK** newSizes = new nsFontGTK*[newSize];
      if (!newSizes)
        return PR_FALSE;
      for (int j = aStretch->mSizesAlloc - 1; j >= 0; j--) {
        newSizes[j] = aStretch->mSizes[j];
      }
      aStretch->mSizesAlloc = newSize;
      delete [] aStretch->mSizes;
      aStretch->mSizes = newSizes;
    }
    char *name = PR_smprintf("%s-%s-%s-%s-%s-%s-%d-%d-%d-%d-%s-*-%s", 
                             aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle, 
                             aPixelSize, aPointSize, aResX, aResY, aSpacing, aCharSet);  

    if (!name) {
      return PR_FALSE;
    }
    nsFontGTK* size = new nsFontGTKNormal();
    if (!size) {
      return PR_FALSE;
    }
    aStretch->mSizes[aStretch->mSizesCount++] = size;
    size->mName           = name;
    // size->mFont is initialized in the constructor
    size->mSize           = aPixelSize;
    size->mBaselineAdjust = 0;
    size->mCCMap          = nsnull;
    size->mCharSetInfo    = aCharSetInfo;
  }
  return PR_TRUE;
}

Here is the caller graph for this function:

static nsFontStretch* NodeGetStretch ( nsFontWeight aWeight,
int  aStretchIndex 
) [static]

Definition at line 5291 of file nsFontMetricsGTK.cpp.

{
  nsFontStretch* stretch = aWeight->mStretches[aStretchIndex];
  if (!stretch) {
    stretch = new nsFontStretch;
    if (!stretch) {
      return nsnull;
    }
    aWeight->mStretches[aStretchIndex] = stretch;
  }
  return stretch;
}

Here is the caller graph for this function:

static nsFontStyle* NodeGetStyle ( nsFontNode aNode,
int  aStyleIndex 
) [static]

Definition at line 5263 of file nsFontMetricsGTK.cpp.

{
  nsFontStyle* style = aNode->mStyles[aStyleIndex];
  if (!style) {
    style = new nsFontStyle;
    if (!style) {
      return nsnull;
    }
    aNode->mStyles[aStyleIndex] = style;
  }
  return style;
}

Here is the caller graph for this function:

static nsFontWeight* NodeGetWeight ( nsFontStyle aStyle,
int  aWeightIndex 
) [static]

Definition at line 5277 of file nsFontMetricsGTK.cpp.

{
  nsFontWeight* weight = aStyle->mWeights[aWeightIndex];
  if (!weight) {
    weight = new nsFontWeight;
    if (!weight) {
      return nsnull;
    }
    aStyle->mWeights[aWeightIndex] = weight;
  }
  return weight;
}

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCharSetManagerCID  ,
NS_ICHARSETCONVERTERMANAGER_CID   
) [static]
static NS_DEFINE_CID ( kPrefCID  ,
NS_PREF_CID   
) [static]
static NS_DEFINE_CID ( kSaveAsCharsetCID  ,
NS_SAVEASCHARSET_CID   
) [static]
static void PrefEnumCallback ( const char *  aName,
void aClosure 
) [static]

Definition at line 6164 of file nsFontMetricsGTK.cpp.

{
  nsFontSearch* s = (nsFontSearch*) aClosure;
  if (s->mFont) {
    NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support this char");
    return;
  }
  nsXPIDLCString value;
  gPref->CopyCharPref(aName, getter_Copies(value));
  nsCAutoString name;
  if (value.get()) {
    name = value;
    FIND_FONT_PRINTF(("       PrefEnumCallback"));
    s->mFont = s->mMetrics->TryNode(&name, s->mChar);
    if (s->mFont) {
      NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support this char");
      return;
    }
    s->mFont = s->mMetrics->TryLangGroup(s->mMetrics->mLangGroup, &name, s->mChar);
    if (s->mFont) {
      NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support this char");
      return;
    }
  }
  gPref->CopyDefaultCharPref(aName, getter_Copies(value));
  if (value.get() && (!name.Equals(value))) {
    name = value;
    FIND_FONT_PRINTF(("       PrefEnumCallback:default"));
    s->mFont = s->mMetrics->TryNode(&name, s->mChar);
    if (s->mFont) {
      NS_ASSERTION(s->mFont->SupportsChar(s->mChar), "font supposed to support this char");
      return;
    }
    s->mFont = s->mMetrics->TryLangGroup(s->mMetrics->mLangGroup, &name, s->mChar);
    NS_ASSERTION(s->mFont ? s->mFont->SupportsChar(s->mChar) : 1, "font supposed to support this char");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void SetCharsetLangGroup ( nsFontCharSetInfo aCharSetInfo) [static]

Definition at line 5020 of file nsFontMetricsGTK.cpp.

{
  if (!aCharSetInfo->mCharSet || aCharSetInfo->mLangGroup)
    return;

  nsresult res;
  
  res = gCharSetManager->GetCharsetLangGroupRaw(aCharSetInfo->mCharSet,
                                                &aCharSetInfo->mLangGroup);
  if (NS_FAILED(res)) {
    aCharSetInfo->mLangGroup = NS_NewAtom("");
#ifdef NOISY_FONTS
    printf("=== cannot get lang group for %s\n", aCharSetInfo->mCharSet);
#endif
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool SetFontCharsetInfo ( nsFontGTK aFont,
nsFontCharSetInfo aCharSet,
PRUint32  aChar 
) [static]

Definition at line 3369 of file nsFontMetricsGTK.cpp.

{
  if (aCharSet->mCharSet) {
    aFont->mCCMap = aCharSet->mCCMap;
    // check that the font is not empty
    if (!aFont->mCCMap || CCMAP_HAS_CHAR_EXT(aFont->mCCMap, aChar)) {
      aFont->LoadFont();
      if (!aFont->GetXFont()) {
        return PR_FALSE;
      }
    }
  }
  else {
    if (aCharSet == &ISO106461) {
      aFont->LoadFont();
      if (!aFont->GetXFont()) {
        return PR_FALSE;
      }
    }
  }
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void SetFontLangGroupInfo ( nsFontCharSetMap aCharSetMap) [static]

Definition at line 5145 of file nsFontMetricsGTK.cpp.

{
  nsFontLangGroup *fontLangGroup = aCharSetMap->mFontLangGroup;
  if (!fontLangGroup)
    return;

  // get the atom for mFontLangGroup->mFontLangGroupName so we can
  // apply fontLangGroup operations to it
  // eg: search for related groups, check for scaling prefs
  const char *langGroup = fontLangGroup->mFontLangGroupName;

  // the font.scale prefs don't make sense without a langGroup
  // XXX FIX!!!  if langGroup is "", we need to bypass the font.scale stuff
  if (!langGroup)
    langGroup = "";
  if (!fontLangGroup->mFontLangGroupAtom) {
    fontLangGroup->mFontLangGroupAtom = NS_NewAtom(langGroup);
  }

  // hack : map 'x-zh-TWHK' to 'zh-TW' when retrieving font scaling-control
  // preferences via |Get*Pref|.
  // XXX : This would make the font scaling controls for 
  // zh-HK NOT work if a font common to zh-TW and zh-HK (e.g. big5-0) 
  // were chosen for zh-HK. An alternative would be to make it 
  // locale-dependent. Even with that, it'd work only under zh-HK locale.
  if (fontLangGroup->mFontLangGroupAtom == gZHTWHK) {
    langGroup = "zh-TW";  
  }

  // get the font scaling controls
  nsFontCharSetInfo *charSetInfo = aCharSetMap->mInfo;
  if (!charSetInfo->mInitedSizeInfo) {
    charSetInfo->mInitedSizeInfo = PR_TRUE;

    nsCAutoString name;
    nsresult rv;
    name.Assign("font.scale.outline.min.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &charSetInfo->mOutlineScaleMin);
    if (NS_SUCCEEDED(rv))
      SIZE_FONT_PRINTF(("%s = %d", name.get(), charSetInfo->mOutlineScaleMin));
    else
      charSetInfo->mOutlineScaleMin = gOutlineScaleMinimum;

    name.Assign("font.scale.aa_bitmap.min.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &charSetInfo->mAABitmapScaleMin);
    if (NS_SUCCEEDED(rv))
      SIZE_FONT_PRINTF(("%s = %d", name.get(), charSetInfo->mAABitmapScaleMin));
    else
      charSetInfo->mAABitmapScaleMin = gAABitmapScaleMinimum;

    name.Assign("font.scale.bitmap.min.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &charSetInfo->mBitmapScaleMin);
    if (NS_SUCCEEDED(rv))
      SIZE_FONT_PRINTF(("%s = %d", name.get(), charSetInfo->mBitmapScaleMin));
    else
      charSetInfo->mBitmapScaleMin = gBitmapScaleMinimum;

    name.Assign("font.scale.aa_bitmap.oversize.");
    name.Append(langGroup);
    PRInt32 percent = 0;
    rv = gPref->GetIntPref(name.get(), &percent);
    if (NS_SUCCEEDED(rv)) {
      charSetInfo->mAABitmapOversize = percent/100.0;
      SIZE_FONT_PRINTF(("%s = %g", name.get(), charSetInfo->mAABitmapOversize));
    }
    else
      charSetInfo->mAABitmapOversize = gAABitmapOversize;

    percent = 0;
    name.Assign("font.scale.aa_bitmap.undersize.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &percent);
    if (NS_SUCCEEDED(rv)) {
      charSetInfo->mAABitmapUndersize = percent/100.0;
      SIZE_FONT_PRINTF(("%s = %g", name.get(),charSetInfo->mAABitmapUndersize));
    }
    else
      charSetInfo->mAABitmapUndersize = gAABitmapUndersize;

    PRBool val = PR_TRUE;
    name.Assign("font.scale.aa_bitmap.always.");
    name.Append(langGroup);
    rv = gPref->GetBoolPref(name.get(), &val);
    if (NS_SUCCEEDED(rv)) {
      charSetInfo->mAABitmapScaleAlways = val;
      SIZE_FONT_PRINTF(("%s = %d", name.get(),charSetInfo->mAABitmapScaleAlways));
    }
    else
      charSetInfo->mAABitmapScaleAlways = gAABitmapScaleAlways;

    percent = 0;
    name.Assign("font.scale.bitmap.oversize.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &percent);
    if (NS_SUCCEEDED(rv)) {
      charSetInfo->mBitmapOversize = percent/100.0;
      SIZE_FONT_PRINTF(("%s = %g", name.get(), charSetInfo->mBitmapOversize));
    }
    else
      charSetInfo->mBitmapOversize = gBitmapOversize;

    percent = 0;
    name.Assign("font.scale.bitmap.undersize.");
    name.Append(langGroup);
    rv = gPref->GetIntPref(name.get(), &percent);
    if (NS_SUCCEEDED(rv)) {
      charSetInfo->mBitmapUndersize = percent/100.0;
      SIZE_FONT_PRINTF(("%s = %g", name.get(), charSetInfo->mBitmapUndersize));
    }
    else
      charSetInfo->mBitmapUndersize = gBitmapUndersize;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool SetUpFontCharSetInfo ( nsFontCharSetInfo aSelf) [static]

Definition at line 2438 of file nsFontMetricsGTK.cpp.

{

#ifdef DEBUG
  static int checkedSelf = 0;
  if (!checkedSelf) {
    CheckSelf();
    checkedSelf = 1;
  }
#endif

  nsresult res;
  // used NS_NewAtom before??
  nsIUnicodeEncoder* converter = nsnull;
  res = gCharSetManager->GetUnicodeEncoderRaw(aSelf->mCharSet, &converter);
  if (NS_SUCCEEDED(res)) {
    aSelf->mConverter = converter;
    res = converter->SetOutputErrorBehavior(converter->kOnError_Replace,
                                            nsnull, '?');
    nsCOMPtr<nsICharRepresentable> mapper = do_QueryInterface(converter);
    if (mapper) {
      aSelf->mCCMap = MapperToCCMap(mapper);
      if (aSelf->mCCMap) {
#ifdef DEBUG_bzbarsky
          NS_WARNING(nsPrintfCString("\n\ncharset = %s", aSelf->mCharSet).get());
#endif /* DEBUG */
  
        /*
         * We used to disable special characters like smart quotes
         * in CJK fonts because if they are quite a bit larger than
         * western glyphs and we did not want glyph fill-in to use them
         * in single byte documents.
         *
         * Now, single byte documents find these special chars before
         * the CJK fonts are searched so this is no longer needed
         * but is useful when trying to determine which font(s) the
         * special chars are found in.
         */
        if ((aSelf->Convert == DoubleByteConvert) 
            && (!gAllowDoubleByteSpecialChars)) {
          PRUint16* ccmap = aSelf->mCCMap;
          PRUint32 page = CCMAP_BEGIN_AT_START_OF_MAP;
          const PRUint16* specialmap = gDoubleByteSpecialCharsCCMap;
          while (NextNonEmptyCCMapPage(specialmap, &page)) {
            PRUint32 pagechar = page;
            for (int i=0; i < CCMAP_BITS_PER_PAGE; i++) {
              if (CCMAP_HAS_CHAR(specialmap, pagechar)) 
                CCMAP_UNSET_CHAR(ccmap, pagechar);
              pagechar++;
            }
          }
        }
        return PR_TRUE;
      }
    }
    else {
      NS_WARNING("cannot get nsICharRepresentable");
    }
  }
  else {
    NS_WARNING("cannot get Unicode converter");
  }

  //
  // always try to return a map even if it is empty
  //
  nsCompressedCharMap empty_ccmapObj;
  aSelf->mCCMap = empty_ccmapObj.NewCCMap();

  // return false if unable to alloc a map
  if (aSelf->mCCMap == nsnull)
    return PR_FALSE;

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsFontGTK* SetupUserDefinedFont ( nsFontGTK aFont) [static]

Definition at line 3394 of file nsFontMetricsGTK.cpp.

{
  if (!aFont->mUserDefinedFont) {
    aFont->mUserDefinedFont = new nsFontGTKUserDefined();
    if (!aFont->mUserDefinedFont) {
      return nsnull;
    }
    if (!aFont->mUserDefinedFont->Init(aFont)) {
      return nsnull;
    }
  }
  return aFont->mUserDefinedFont;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint SingleByteConvert ( nsFontCharSetInfo aSelf,
XFontStruct *  aFont,
const PRUnichar aSrcBuf,
PRInt32  aSrcLen,
char *  aDestBuf,
PRInt32  aDestLen 
) [static]

Definition at line 2307 of file nsFontMetricsGTK.cpp.

{
  gint count = 0;
  if (aSelf->mConverter) {
    aSelf->mConverter->Convert(aSrcBuf, &aSrcLen, aDestBuf, &aDestLen);
    count = aDestLen;
  }

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Widen8To16AndDraw ( GdkDrawable *  drawable,
nsXFont xFont,
GdkGC *  gc,
gint  x,
gint  y,
const gchar *  text,
gint  text_length 
)

Definition at line 1442 of file nsFontMetricsGTK.cpp.

{
  NS_ASSERTION(!xFont->IsSingleByte(),"wrong string/font size");
  XChar2b buf[WIDEN_8_TO_16_BUF_SIZE];
  XChar2b *p = buf;
  int uchar_size;

  if (text_length > WIDEN_8_TO_16_BUF_SIZE) {
    p = (XChar2b*)PR_Malloc(text_length*sizeof(XChar2b));
    if (!p) return; // handle malloc failure
  }

  uchar_size = Widen8To16AndMove(text, text_length, p);
  xFont->DrawText16(drawable, gc, x, y, p, uchar_size/2);

  if (text_length > WIDEN_8_TO_16_BUF_SIZE) {
    PR_Free((char*)p);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint Widen8To16AndGetWidth ( nsXFont xFont,
const gchar *  text,
gint  text_length 
)

Definition at line 1417 of file nsFontMetricsGTK.cpp.

{
  NS_ASSERTION(!xFont->IsSingleByte(),"wrong string/font size");
  XChar2b buf[WIDEN_8_TO_16_BUF_SIZE];
  XChar2b *p = buf;
  int uchar_size;
  gint rawWidth;

  if (text_length > WIDEN_8_TO_16_BUF_SIZE) {
    p = (XChar2b*)PR_Malloc(text_length*sizeof(XChar2b));
    if (!p) return(0); // handle malloc failure
  }

  uchar_size = Widen8To16AndMove(text, text_length, p);
  rawWidth = xFont->TextWidth16(p, uchar_size/2);

  if (text_length > WIDEN_8_TO_16_BUF_SIZE) {
    PR_Free((char*)p);
  }
  return(rawWidth);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint Widen8To16AndMove ( const gchar *  char_p,
gint  char_len,
XChar2b *  xchar2b_p 
)

Definition at line 1403 of file nsFontMetricsGTK.cpp.

{
  int i;
  for (i=0; i<char_len; i++) {
    (xchar2b_p)->byte1 = 0;
    (xchar2b_p++)->byte2 = *char_p++;
  }
  return(char_len*2);
}

Here is the caller graph for this function:


Variable Documentation

Initial value:
  { "x-adobe-euro", SingleByteConvert, 0 }

Definition at line 565 of file nsFontMetricsGTK.cpp.

Initial value:
   { "Adobe-Symbol-Encoding", SingleByteConvert, 0 }

Definition at line 563 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-x-big5", DoubleByteConvert, 1 }

Definition at line 498 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-x-big5", DoubleByteConvert, 1 }

Definition at line 502 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-1", DoubleByteConvert, 1 }

Definition at line 504 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-2", DoubleByteConvert, 1 }

Definition at line 506 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-3", DoubleByteConvert, 1 }

Definition at line 508 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-4", DoubleByteConvert, 1 }

Definition at line 510 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-5", DoubleByteConvert, 1 }

Definition at line 512 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-6", DoubleByteConvert, 1 }

Definition at line 514 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-cns-11643-7", DoubleByteConvert, 1 }

Definition at line 516 of file nsFontMetricsGTK.cpp.

Initial value:
  { "windows-1250", SingleByteConvert, 0 }

Definition at line 542 of file nsFontMetricsGTK.cpp.

Initial value:
  { "windows-1251", SingleByteConvert, 0 }

Definition at line 544 of file nsFontMetricsGTK.cpp.

Initial value:
  { "windows-1252", SingleByteConvert, 0 }

Definition at line 546 of file nsFontMetricsGTK.cpp.

Initial value:
  { "windows-1253", SingleByteConvert, 0 }

Definition at line 548 of file nsFontMetricsGTK.cpp.

Initial value:
  { "windows-1257", SingleByteConvert, 0 }

Definition at line 550 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_ARABIC = { "ar", nsnull } [static]

Definition at line 597 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_BALTIC = { "x-baltic", nsnull } [static]

Definition at line 592 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_CE = { "x-central-euro",nsnull } [static]

Definition at line 593 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_GREEK = { "el", nsnull } [static]

Definition at line 594 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_HEBREW = { "he", nsnull } [static]

Definition at line 596 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_JA = { "ja", nsnull } [static]

Definition at line 603 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_KO = { "ko", nsnull } [static]

Definition at line 604 of file nsFontMetricsGTK.cpp.

Definition at line 609 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_RUSSIAN = { "x-cyrillic", nsnull } [static]

Definition at line 591 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_TAMIL = { "x-tamil", nsnull } [static]

Definition at line 608 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_THAI = { "th", nsnull } [static]

Definition at line 598 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_TURKISH = { "tr", nsnull } [static]

Definition at line 595 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_WESTERN = { "x-western", nsnull } [static]

Definition at line 590 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_ZHCN = { "zh-CN", nsnull } [static]

Definition at line 599 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_ZHHK = { "zh-HK", nsnull } [static]

Definition at line 601 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_ZHTW = { "zh-TW", nsnull } [static]

Definition at line 600 of file nsFontMetricsGTK.cpp.

nsFontLangGroup FLG_ZHTWHK = { "x-zh-TWHK", nsnull } [static]

Definition at line 602 of file nsFontMetricsGTK.cpp.

double gAABitmapOversize = 1.1 [static]

Definition at line 206 of file nsFontMetricsGTK.cpp.

Definition at line 204 of file nsFontMetricsGTK.cpp.

Definition at line 203 of file nsFontMetricsGTK.cpp.

Definition at line 205 of file nsFontMetricsGTK.cpp.

double gAABitmapUndersize = 0.9 [static]

Definition at line 207 of file nsFontMetricsGTK.cpp.

nsHashtable* gAFRENodes = nsnull [static]

Definition at line 180 of file nsFontMetricsGTK.cpp.

nsHashtable* gAliases = nsnull [static]

Definition at line 176 of file nsFontMetricsGTK.cpp.

Definition at line 166 of file nsFontMetricsGTK.cpp.

Initial value:
  { "gb18030.2000-0", DoubleByteConvert, 1 }

Definition at line 520 of file nsFontMetricsGTK.cpp.

Initial value:
  { "gb18030.2000-1", DoubleByteConvert, 1 }

Definition at line 522 of file nsFontMetricsGTK.cpp.

Initial value:
  { "gb_2312-80", DoubleByteConvert, 1 }

Definition at line 518 of file nsFontMetricsGTK.cpp.

double gBitmapOversize = 1.2 [static]

Definition at line 211 of file nsFontMetricsGTK.cpp.

Definition at line 210 of file nsFontMetricsGTK.cpp.

double gBitmapUndersize = 0.8 [static]

Definition at line 212 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-gbk-noascii", DoubleByteConvert, 1 }

Definition at line 524 of file nsFontMetricsGTK.cpp.

nsHashtable* gCachedFFRESearches = nsnull [static]

Definition at line 183 of file nsFontMetricsGTK.cpp.

Definition at line 173 of file nsFontMetricsGTK.cpp.

Definition at line 637 of file nsFontMetricsGTK.cpp.

nsHashtable* gCharSetMaps = nsnull [static]

Definition at line 177 of file nsFontMetricsGTK.cpp.

float gDevScale = 0.0f [static]

Definition at line 171 of file nsFontMetricsGTK.cpp.

Definition at line 868 of file nsFontMetricsGTK.cpp.

nsHashtable* gFamilies = nsnull [static]

Definition at line 178 of file nsFontMetricsGTK.cpp.

Initial value:
{
  { "arial",           "helvetica" },
  { "courier new",     "courier" },
  { "times new roman", "times" },








  { nsnull, nsnull }
}

Definition at line 784 of file nsFontMetricsGTK.cpp.

nsHashtable* gFFRENodes = nsnull [static]

Definition at line 179 of file nsFontMetricsGTK.cpp.

regex_t * gFontAcceptRegEx = nsnull [static]

Definition at line 216 of file nsFontMetricsGTK.cpp.

Definition at line 106 of file nsFontMetricsGTK.cpp.

int gFontMetricsGTKCount = 0 [static]

Definition at line 163 of file nsFontMetricsGTK.cpp.

regex_t* gFontRejectRegEx = nsnull [static]

Definition at line 215 of file nsFontMetricsGTK.cpp.

Definition at line 187 of file nsFontMetricsGTK.cpp.

Definition at line 165 of file nsFontMetricsGTK.cpp.

Definition at line 189 of file nsFontMetricsGTK.cpp.

int gInitialized = 0 [static]

Definition at line 164 of file nsFontMetricsGTK.cpp.

nsFontCharSetMap gNoneCharSetMap[] = { { nsnull }, } [static]

Definition at line 800 of file nsFontMetricsGTK.cpp.

Definition at line 201 of file nsFontMetricsGTK.cpp.

nsIPref* gPref = nsnull [static]

Definition at line 170 of file nsFontMetricsGTK.cpp.

Definition at line 172 of file nsFontMetricsGTK.cpp.

Initial value:
{
  { "symbol-adobe-fontspecific", &FLG_NONE, &AdobeSymbol  },
  { "euromono-adobe-fontspecific",  &FLG_NONE, &AdobeEuro },
  { "eurosans-adobe-fontspecific",  &FLG_NONE, &AdobeEuro },
  { "euroserif-adobe-fontspecific", &FLG_NONE, &AdobeEuro },




















  { nsnull,                      nsnull        }
}

Definition at line 802 of file nsFontMetricsGTK.cpp.

nsHashtable* gSpecialCharSets = nsnull [static]

Definition at line 184 of file nsFontMetricsGTK.cpp.

nsHashtable* gStretches = nsnull [static]

Definition at line 185 of file nsFontMetricsGTK.cpp.

Initial value:
{
  { "block",         5 }, 
  { "bold",          7 }, 
  { "double wide",   9 },
  { "medium",        5 },
  { "narrow",        3 },
  { "normal",        5 },
  { "semicondensed", 4 },
  { "wide",          7 },

  { nsnull,          0 }
}

Definition at line 831 of file nsFontMetricsGTK.cpp.

nsIAtom* gUnicode = nsnull [static]

Definition at line 191 of file nsFontMetricsGTK.cpp.

Definition at line 192 of file nsFontMetricsGTK.cpp.

Definition at line 867 of file nsFontMetricsGTK.cpp.

Definition at line 174 of file nsFontMetricsGTK.cpp.

Definition at line 196 of file nsFontMetricsGTK.cpp.

Initial value:
{
  { "black",    900 },
  { "bold",     700 },
  { "book",     400 },
  { "demi",     600 },
  { "demibold", 600 },
  { "light",    300 },
  { "medium",   400 },
  { "regular",  400 },
  
  { nsnull,     0 }
}

Definition at line 845 of file nsFontMetricsGTK.cpp.

nsHashtable* gWeights = nsnull [static]

Definition at line 186 of file nsFontMetricsGTK.cpp.

Definition at line 197 of file nsFontMetricsGTK.cpp.

nsIAtom* gZHHK = nsnull [static]

Definition at line 194 of file nsFontMetricsGTK.cpp.

nsIAtom* gZHTW = nsnull [static]

Definition at line 193 of file nsFontMetricsGTK.cpp.

nsIAtom* gZHTWHK = nsnull [static]

Definition at line 195 of file nsFontMetricsGTK.cpp.

Initial value:
  { "hkscs-1", DoubleByteConvert, 1 }

Definition at line 526 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-IBM1046", SingleByteConvert, 0 }

Definition at line 457 of file nsFontMetricsGTK.cpp.

Initial value:

Definition at line 560 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-1", SingleByteConvert, 0 }

Definition at line 441 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-11", SingleByteConvert, 0 }

Definition at line 496 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-13", SingleByteConvert, 0 }

Definition at line 476 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-15", SingleByteConvert, 0 }

Definition at line 478 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-2", SingleByteConvert, 0 }

Definition at line 443 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-3", SingleByteConvert, 0 }

Definition at line 445 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-4", SingleByteConvert, 0 }

Definition at line 447 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-5", SingleByteConvert, 0 }

Definition at line 449 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-6", SingleByteConvert, 0 }

Definition at line 451 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-iso-8859-6-16", SingleByteConvert, 0 }

Definition at line 455 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-iso-8859-6-8-x", SingleByteConvert, 0 }

Definition at line 453 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-7", SingleByteConvert, 0 }

Definition at line 459 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-8", SingleByteConvert, 0 }

Definition at line 461 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ISO-8859-9", SingleByteConvert, 0 }

Definition at line 466 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-koreanjamo-0", DoubleByteConvert, 1 }

Definition at line 538 of file nsFontMetricsGTK.cpp.

Initial value:
  { "jis_0201", SingleByteConvert, 1 }

Definition at line 480 of file nsFontMetricsGTK.cpp.

Initial value:
  { "jis_0208-1983", DoubleByteConvert, 1 }

Definition at line 528 of file nsFontMetricsGTK.cpp.

Initial value:
  { "jis_0212-1990", DoubleByteConvert, 1 }

Definition at line 530 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-johab-noascii", DoubleByteConvert, 1 }

Definition at line 536 of file nsFontMetricsGTK.cpp.

Initial value:
  { "KOI8-R", SingleByteConvert, 0 }

Definition at line 482 of file nsFontMetricsGTK.cpp.

Initial value:
  { "KOI8-U", SingleByteConvert, 0 }

Definition at line 484 of file nsFontMetricsGTK.cpp.

Initial value:
  { "ks_c_5601-1987", DoubleByteConvert, 1 }

Definition at line 532 of file nsFontMetricsGTK.cpp.

Definition at line 227 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-tamilttf-0", DoubleByteConvert, 0 }

Definition at line 540 of file nsFontMetricsGTK.cpp.

Initial value:
  { "TIS-620", SingleByteConvert, 0 }

Definition at line 494 of file nsFontMetricsGTK.cpp.

Initial value:




  { "windows-874", SingleByteConvert, 0 }

Definition at line 486 of file nsFontMetricsGTK.cpp.

Definition at line 226 of file nsFontMetricsGTK.cpp.

Initial value:
  { "us-ascii", SingleByteConvert, 0 }

Definition at line 439 of file nsFontMetricsGTK.cpp.

Initial value:
  { "x-x11johab", DoubleByteConvert, 1 }

Definition at line 534 of file nsFontMetricsGTK.cpp.