Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Attributes
nsFontSubsetSubstitute Class Reference
Inheritance diagram for nsFontSubsetSubstitute:
Inheritance graph
[legend]
Collaboration diagram for nsFontSubsetSubstitute:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFontSubsetSubstitute (PRBool aIsForIgnorable=FALSE)
virtual ~nsFontSubsetSubstitute ()
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 void Convert (const PRUnichar *aString, PRUint32 aLength, nsAutoCharBuffer &aResult, PRUint32 *aResultLength)
virtual PRBool HasGlyph (PRUnichar ch)
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)
int Load (HDC aDC, nsFontMetricsWinA *aFontMetricsWin, nsFontWinA *aFont)
virtual PRBool HasGlyph (PRUint32 ch)
PRBool FillClipRect (PRInt32 aX, PRInt32 aY, UINT aLength, UINT uOptions, RECT &clipRect)

Public Attributes

BYTE mCharset
PRUint16 mCodePage
char mName [LF_FACESIZE]
HFONT mFont
PRUint16mCCMap
nscoord mMaxAscent
nscoord mMaxDescent
LONG mOverhangCorrection
LONG mMaxCharWidthMetric
LONG mMaxHeightMetric
BYTE mPitchAndFamily

Private Attributes

PRBool mIsForIgnorable

Detailed Description

Definition at line 325 of file nsFontMetricsWin.cpp.


Constructor & Destructor Documentation

Definition at line 4893 of file nsFontMetricsWin.cpp.

  : nsFontSubset(), mIsForIgnorable(aIsForIgnorable)
{
}

Definition at line 4898 of file nsFontMetricsWin.cpp.

{
}

Member Function Documentation

void nsFontSubsetSubstitute::Convert ( const PRUnichar aString,
PRUint32  aLength,
nsAutoCharBuffer aResult,
PRUint32 aResultLength 
) [virtual]

Reimplemented from nsFontSubset.

Definition at line 4948 of file nsFontMetricsWin.cpp.

{
  nsAutoChar16Buffer buffer;
  nsresult rv = SubstituteChars(PR_FALSE, aString, aLength, buffer, &aLength);
  if (NS_FAILED(rv)) {
    // this is the out-of-memory error case
    *aResultLength = 0;
    return;
  }
  if (!aLength) {
    // this is the case where the substitute string collapsed to nothingness
    *(aResult.get()) = '\0';
    *aResultLength = 0;
    return;
  }
  nsFontSubset::Convert(buffer.get(), aLength, aResult, aResultLength);
}

Here is the call graph for this function:

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 nsFontSubsetSubstitute::DrawString ( HDC  aDC,
PRInt32  aX,
PRInt32  aY,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Reimplemented from nsFontSubset.

Definition at line 4913 of file nsFontMetricsWin.cpp.

{
  if (mIsForIgnorable)
    return;

  nsFontSubset::DrawString(aDC, aX, aY, aString, aLength);
}
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:

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 nsFontSubsetSubstitute::GetWidth ( HDC  aDC,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Reimplemented from nsFontSubset.

Definition at line 4903 of file nsFontMetricsWin.cpp.

{
  if (mIsForIgnorable)
    return 0;

  return nsFontSubset::GetWidth(aDC, aString, aLength);
}
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:

virtual PRBool nsFontSubsetSubstitute::HasGlyph ( PRUnichar  ch) [inline, virtual]

Definition at line 350 of file nsFontMetricsWin.cpp.

{return PR_TRUE;};
int nsFontSubset::Load ( HDC  aDC,
nsFontMetricsWinA aFontMetricsWin,
nsFontWinA aFont 
) [inherited]

Definition at line 5174 of file nsFontMetricsWin.cpp.

{
  LOGFONT* logFont = &aFont->mLogFont;
  logFont->lfCharSet = mCharset;
  // create a font handle without filling & overwriting what is in logFont
  HFONT hfont = (aFontMetricsWinA->Font().sizeAdjust <= 0) 
    ? ::CreateFontIndirect(logFont)
    : aFontMetricsWinA->CreateFontAdjustHandle(aDC, logFont);
  if (hfont) {
    int i = gCharsetToIndex[mCharset];
    if (!gCharsetInfo[i].mCCMap)
      gCharsetInfo[i].mCCMap = gCharsetInfo[i].GenerateMap(&gCharsetInfo[i]);
    if (!gCharsetInfo[i].mCCMap) {
      ::DeleteObject(hfont);
      return 0;
    }
    mCCMap = gCharsetInfo[i].mCCMap;
    mCodePage = gCharsetInfo[i].mCodePage;
    mFont = hfont;

    //XXX can we safely assume the same metrics for all subsets and remove this?
    HFONT oldFont = (HFONT)::SelectObject(aDC, (HGDIOBJ)hfont);
    aFontMetricsWinA->InitMetricsFor(aDC, this);
    ::SelectObject(aDC, (HGDIOBJ)oldFont);

    return 1;
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file nsFontMetricsWin.h.

Definition at line 321 of file nsFontMetricsWin.cpp.

Definition at line 322 of file nsFontMetricsWin.cpp.

HFONT nsFontWin::mFont [inherited]

Definition at line 132 of file nsFontMetricsWin.h.

Definition at line 350 of file nsFontMetricsWin.cpp.

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.


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