Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsFontWinA Class Reference

#include <nsFontMetricsWin.h>

Inheritance diagram for nsFontWinA:
Inheritance graph
[legend]
Collaboration diagram for nsFontWinA:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFontWinA (LOGFONT *aLogFont, HFONT aFont, PRUint16 *aCCMap)
virtual ~nsFontWinA ()
virtual PRInt32 GetWidth (HDC aDC, const PRUnichar *aString, PRUint32 aLength)
virtual void DrawString (HDC aDC, PRInt32 aX, PRInt32 aY, const PRUnichar *aString, PRUint32 aLength)
virtual nsFontSubsetFindSubset (HDC aDC, PRUnichar aChar, nsFontMetricsWinA *aFontMetrics)
int GetSubsets (HDC aDC)
virtual PRInt32 GetWidth (HDC aDC, const char *aString, PRUint32 aLength)
virtual void DrawString (HDC aDC, PRInt32 aX, PRInt32 aY, const char *aString, PRUint32 aLength, INT *aDx0)
virtual PRBool HasGlyph (PRUint32 ch)
PRBool FillClipRect (PRInt32 aX, PRInt32 aY, UINT aLength, UINT uOptions, RECT &clipRect)

Public Attributes

LOGFONT mLogFont
nsFontSubset ** mSubsets
PRUint16 mSubsetsCount
char mName [LF_FACESIZE]
HFONT mFont
PRUint16mCCMap
nscoord mMaxAscent
nscoord mMaxDescent
LONG mOverhangCorrection
LONG mMaxCharWidthMetric
LONG mMaxHeightMetric
BYTE mPitchAndFamily

Detailed Description

Definition at line 384 of file nsFontMetricsWin.h.


Constructor & Destructor Documentation

nsFontWinA::nsFontWinA ( LOGFONT *  aLogFont,
HFONT  aFont,
PRUint16 aCCMap 
)

Definition at line 4967 of file nsFontMetricsWin.cpp.

  : nsFontWin(aLogFont, aFont, aCCMap)
{
  if (aLogFont) {
    mLogFont = *aLogFont;
  }
}
nsFontWinA::~nsFontWinA ( ) [virtual]

Definition at line 4975 of file nsFontMetricsWin.cpp.

{
  if (mSubsets) {
    nsFontSubset** subset = mSubsets;
    nsFontSubset** endSubsets = subset + mSubsetsCount;
    while (subset < endSubsets) {
      delete *subset;
      ++subset;
    }
    nsMemory::Free(mSubsets);
    mSubsets = nsnull;
  }
}

Member Function Documentation

void nsFontWin::DrawString ( HDC  aDC,
PRInt32  aX,
PRInt32  aY,
const char *  aString,
PRUint32  aLength,
INT aDx0 
) [virtual, inherited]

Definition at line 4300 of file nsFontMetricsWin.cpp.

{
  NS_ExtTextOutA(aDC, this, aX, aY, 0, NULL, aString, aLength, lpDx);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFontWinA::DrawString ( HDC  aDC,
PRInt32  aX,
PRInt32  aY,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Implements nsFontWin.

Definition at line 5064 of file nsFontMetricsWin.cpp.

{
  NS_ERROR("must call nsFontSubset's DrawString");
}
PRBool nsFontWin::FillClipRect ( PRInt32  aX,
PRInt32  aY,
UINT  aLength,
UINT  uOptions,
RECT &  clipRect 
) [inherited]

Definition at line 4259 of file nsFontMetricsWin.cpp.

{
  if (!(uOptions & (ETO_CLIPPED | ETO_OPAQUE)) &&
      mOverhangCorrection > 0 && !(mPitchAndFamily & TMPF_FIXED_PITCH)) {
    // bug 52596 - although the clipping rectangle is said to be optional, we
    // have to use a clipping rectange to work around a GDI bug on
    // Win9X-Japanese that causes the text to be truncated incorrectly.
    clipRect.top = aY - mMaxHeightMetric;
    clipRect.bottom = aY + mMaxHeightMetric;
    clipRect.left = aX;
    clipRect.right = aX + mMaxCharWidthMetric * aLength;
    return PR_TRUE;
  }
  return PR_FALSE;
}

Here is the caller graph for this function:

nsFontSubset * nsFontWinA::FindSubset ( HDC  aDC,
PRUnichar  aChar,
nsFontMetricsWinA aFontMetrics 
) [virtual]

Reimplemented in nsFontWinSubstituteA.

Definition at line 5071 of file nsFontMetricsWin.cpp.

{
  nsFontSubset **subsetPtr = mSubsets;
  nsFontSubset **endSubset = subsetPtr + mSubsetsCount;

  while (subsetPtr < endSubset) {
    if (!(*subsetPtr)->mCCMap)
      if (!(*subsetPtr)->Load(aDC, aFontMetrics, this))
        continue;
    if ((*subsetPtr)->HasGlyph(aChar)) {
      return *subsetPtr;
    }
    ++subsetPtr;
  }
  return nsnull;
}

Here is the caller graph for this function:

Definition at line 4990 of file nsFontMetricsWin.cpp.

{
  mSubsetsCount = 0;

  FONTSIGNATURE signature;
  if (::GetTextCharsetInfo(aDC, &signature, 0) == DEFAULT_CHARSET) {
    return 0;
  }

  int dword;
  DWORD* array = signature.fsCsb;
  int i = 0;
  for (dword = 0; dword < 2; ++dword) {
    for (int bit = 0; bit < sizeof(DWORD) * 8; ++bit, ++i) {
      if ((array[dword] >> bit) & 1) {
        PRUint8 charset = gBitToCharset[i];
#ifdef DEBUG_FONT_SIGNATURE
        printf("  %02d %s\n", i, gCharsetInfo[gCharsetToIndex[charset]].mName);
#endif
        if ((charset != DEFAULT_CHARSET) && HaveConverterFor(charset)) {
          ++mSubsetsCount;
        }
      }
    }
  }

  if (!mSubsetsCount) {
    return 0;
  }
  mSubsets = (nsFontSubset**) nsMemory::Alloc(mSubsetsCount* sizeof(nsFontSubset*));
  if (!mSubsets) {
    mSubsetsCount = 0;
    return 0;
  }
  memset(mSubsets, 0, mSubsetsCount * sizeof(nsFontSubset*)); 

  int j;
  for (j = 0; j < mSubsetsCount; ++j) {
    mSubsets[j] = new nsFontSubset();
    if (!mSubsets[j]) {
      for (j = j - 1; j >= 0; --j) {
        delete mSubsets[j];
      }
      nsMemory::Free(mSubsets);
      mSubsets = nsnull;
      mSubsetsCount = 0;
      return 0;
    }
  }

  i = j = 0;
  for (dword = 0; dword < 2; ++dword) {
    for (int bit = 0; bit < sizeof(DWORD) * 8; ++bit, ++i) {
      if ((array[dword] >> bit) & 1) {
        PRUint8 charset = gBitToCharset[i];
        if ((charset != DEFAULT_CHARSET) && HaveConverterFor(charset)) {
          mSubsets[j]->mCharset = charset;
          ++j;
        }
      }
    }
  }

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsFontWin::GetWidth ( HDC  aDC,
const char *  aString,
PRUint32  aLength 
) [virtual, inherited]

Definition at line 4250 of file nsFontMetricsWin.cpp.

{
  SIZE size;
  ::GetTextExtentPoint32(aDC, aString, aLength, &size);
  size.cx -= mOverhangCorrection;
  return size.cx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsFontWinA::GetWidth ( HDC  aDC,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Implements nsFontWin.

Definition at line 5057 of file nsFontMetricsWin.cpp.

{
  NS_ERROR("must call nsFontSubset's GetWidth");
  return 0;
}
virtual PRBool nsFontWin::HasGlyph ( PRUint32  ch) [inline, virtual, inherited]

Reimplemented in nsFontWinSubstituteA, and nsFontWinSubstitute.

Definition at line 113 of file nsFontMetricsWin.h.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file nsFontMetricsWin.h.

HFONT nsFontWin::mFont [inherited]

Definition at line 132 of file nsFontMetricsWin.h.

Definition at line 408 of file nsFontMetricsWin.h.

Definition at line 138 of file nsFontMetricsWin.h.

Definition at line 143 of file nsFontMetricsWin.h.

Definition at line 139 of file nsFontMetricsWin.h.

Definition at line 144 of file nsFontMetricsWin.h.

char nsFontWin::mName[LF_FACESIZE] [inherited]

Definition at line 113 of file nsFontMetricsWin.h.

Definition at line 142 of file nsFontMetricsWin.h.

Definition at line 145 of file nsFontMetricsWin.h.

Definition at line 409 of file nsFontMetricsWin.h.

Definition at line 410 of file nsFontMetricsWin.h.


The documentation for this class was generated from the following files: